diff --git a/configs/mocharc.yml b/configs/mocharc.yml index 8bf8b95d7276f..f340113372089 100644 --- a/configs/mocharc.yml +++ b/configs/mocharc.yml @@ -1,6 +1,7 @@ require: - 'ignore-styles' - 'reflect-metadata/Reflect' + - '@theia/test-setup' reporter: 'spec' watch-files: - '**/*.js' diff --git a/dev-packages/cli/patches/@lumino+widgets+2.5.0.patch b/dev-packages/cli/patches/@lumino+widgets+2.5.0.patch new file mode 100644 index 0000000000000..bbfe28bfc3378 --- /dev/null +++ b/dev-packages/cli/patches/@lumino+widgets+2.5.0.patch @@ -0,0 +1,167 @@ +diff --git a/node_modules/@lumino/widgets/dist/index.es6.js b/node_modules/@lumino/widgets/dist/index.es6.js +index c6bd869..ec2c392 100644 +--- a/node_modules/@lumino/widgets/dist/index.es6.js ++++ b/node_modules/@lumino/widgets/dist/index.es6.js +@@ -6527,7 +6527,7 @@ class Menu extends Widget { + this.node.addEventListener('mouseenter', this); + this.node.addEventListener('mouseleave', this); + this.node.addEventListener('contextmenu', this); +- document.addEventListener('mousedown', this, true); ++ this.node.ownerDocument.addEventListener('mousedown', this, true); + } + /** + * A message handler invoked on an `'after-detach'` message. +@@ -6539,7 +6539,7 @@ class Menu extends Widget { + this.node.removeEventListener('mouseenter', this); + this.node.removeEventListener('mouseleave', this); + this.node.removeEventListener('contextmenu', this); +- document.removeEventListener('mousedown', this, true); ++ this.node.ownerDocument.removeEventListener('mousedown', this, true); + } + /** + * A message handler invoked on an `'activate-request'` message. +@@ -7305,7 +7305,7 @@ var Private$9; + style.opacity = '0'; + style.maxHeight = `${maxHeight}px`; + // Attach the menu to the document. +- Widget.attach(submenu, document.body); ++ Widget.attach(submenu, itemNode.ownerDocument.body); + // Measure the size of the menu. + let { width, height } = node.getBoundingClientRect(); + // Compute the box sizing for the menu. +@@ -13198,10 +13198,6 @@ class MenuBar extends Widget { + if (value < 0 || value >= this._menus.length) { + value = -1; + } +- // An empty menu cannot be active +- if (value > -1 && this._menus[value].items.length === 0) { +- value = -1; +- } + // Bail early if the index will not change. + if (this._activeIndex === value) { + return; +diff --git a/node_modules/@lumino/widgets/dist/index.es6.js.map b/node_modules/@lumino/widgets/dist/index.es6.js.map +index be4059b..2158c77 100644 +--- a/node_modules/@lumino/widgets/dist/index.es6.js.map ++++ b/node_modules/@lumino/widgets/dist/index.es6.js.map +@@ -1 +1 @@ +-{"version":3,"file":"index.es6.js","sources":["../src/boxengine.ts","../src/title.ts","../src/widget.ts","../src/layout.ts","../src/panellayout.ts","../src/utils.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/focustracker.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/stackedpanel.ts","../src/tabpanel.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n /**\n * The preferred size for the sizer.\n *\n * #### Notes\n * The sizer will be given this initial size subject to its size\n * bounds. The sizer will not deviate from this size unless such\n * deviation is required to fit into the available layout space.\n *\n * There is no limit to this value, but it will be clamped to the\n * bounds defined by {@link minSize} and {@link maxSize}.\n *\n * The default value is `0`.\n */\n sizeHint = 0;\n\n /**\n * The minimum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized less than this value, even if\n * it means the sizer will overflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity)`\n * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `0`.\n */\n minSize = 0;\n\n /**\n * The maximum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized greater than this value, even if\n * it means the sizer will underflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity]`\n * and that it is `>=` to {@link minSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `Infinity`.\n */\n maxSize = Infinity;\n\n /**\n * The stretch factor for the sizer.\n *\n * #### Notes\n * This controls how much the sizer stretches relative to its sibling\n * sizers when layout space is distributed. A stretch factor of zero\n * is special and will cause the sizer to only be resized after all\n * other sizers with a stretch factor greater than zero have been\n * resized to their limits.\n *\n * It is assumed that this value is an integer that lies in the range\n * `[0, Infinity)`. Failure to adhere to this constraint will yield\n * undefined results.\n *\n * The default value is `1`.\n */\n stretch = 1;\n\n /**\n * The computed size of the sizer.\n *\n * #### Notes\n * This value is the output of a call to {@link BoxEngine.calc}. It represents\n * the computed size for the object along the layout orientation,\n * and will always lie in the range `[minSize, maxSize]`.\n *\n * This value is output only.\n *\n * Changing this value will have no effect.\n */\n size = 0;\n\n /**\n * An internal storage property for the layout algorithm.\n *\n * #### Notes\n * This value is used as temporary storage by the layout algorithm.\n *\n * Changing this value will have no effect.\n */\n done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n /**\n * Calculate the optimal layout sizes for a sequence of box sizers.\n *\n * This distributes the available layout space among the box sizers\n * according to the following algorithm:\n *\n * 1. Initialize the sizers's size to its size hint and compute the\n * sums for each of size hint, min size, and max size.\n *\n * 2. If the total size hint equals the available space, return.\n *\n * 3. If the available space is less than the total min size, set all\n * sizers to their min size and return.\n *\n * 4. If the available space is greater than the total max size, set\n * all sizers to their max size and return.\n *\n * 5. If the layout space is less than the total size hint, distribute\n * the negative delta as follows:\n *\n * a. Shrink each sizer with a stretch factor greater than zero by\n * an amount proportional to the negative space and the sum of\n * stretch factors. If the sizer reaches its min size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains negative\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its min size,\n * remove it from the computation.\n *\n * 6. If the layout space is greater than the total size hint,\n * distribute the positive delta as follows:\n *\n * a. Expand each sizer with a stretch factor greater than zero by\n * an amount proportional to the postive space and the sum of\n * stretch factors. If the sizer reaches its max size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains positive\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its max size,\n * remove it from the computation.\n *\n * 7. return\n *\n * @param sizers - The sizers for a particular layout line.\n *\n * @param space - The available layout space for the sizers.\n *\n * @returns The delta between the provided available space and the\n * actual consumed space. This value will be zero if the sizers\n * can be adjusted to fit, negative if the available space is too\n * small, and positive if the available space is too large.\n *\n * #### Notes\n * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n *\n * This function can be called at any time to recompute the layout for\n * an existing sequence of sizers. The previously computed results will\n * have no effect on the new output. It is therefore not necessary to\n * create new sizer objects on each resize event.\n */\n export function calc(sizers: ArrayLike, space: number): number {\n // Bail early if there is nothing to do.\n let count = sizers.length;\n if (count === 0) {\n return space;\n }\n\n // Setup the size and stretch counters.\n let totalMin = 0;\n let totalMax = 0;\n let totalSize = 0;\n let totalStretch = 0;\n let stretchCount = 0;\n\n // Setup the sizers and compute the totals.\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n let min = sizer.minSize;\n let max = sizer.maxSize;\n let hint = sizer.sizeHint;\n sizer.done = false;\n sizer.size = Math.max(min, Math.min(hint, max));\n totalSize += sizer.size;\n totalMin += min;\n totalMax += max;\n if (sizer.stretch > 0) {\n totalStretch += sizer.stretch;\n stretchCount++;\n }\n }\n\n // If the space is equal to the total size, return early.\n if (space === totalSize) {\n return 0;\n }\n\n // If the space is less than the total min, minimize each sizer.\n if (space <= totalMin) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.minSize;\n }\n return space - totalMin;\n }\n\n // If the space is greater than the total max, maximize each sizer.\n if (space >= totalMax) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.maxSize;\n }\n return space - totalMax;\n }\n\n // The loops below perform sub-pixel precision sizing. A near zero\n // value is used for compares instead of zero to ensure that the\n // loop terminates when the subdivided space is reasonably small.\n let nearZero = 0.01;\n\n // A counter which is decremented each time a sizer is resized to\n // its limit. This ensures the loops terminate even if there is\n // space remaining to distribute.\n let notDoneCount = count;\n\n // Distribute negative delta space.\n if (space < totalSize) {\n // Shrink each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its min size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = totalSize - space;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n }\n // Distribute positive delta space.\n else {\n // Expand each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its max size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = space - totalSize;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n }\n\n // Indicate that the consumed space equals the available space.\n return 0;\n }\n\n /**\n * Adjust a sizer by a delta and update its neighbors accordingly.\n *\n * @param sizers - The sizers which should be adjusted.\n *\n * @param index - The index of the sizer to grow.\n *\n * @param delta - The amount to adjust the sizer, positive or negative.\n *\n * #### Notes\n * This will adjust the indicated sizer by the specified amount, along\n * with the sizes of the appropriate neighbors, subject to the limits\n * specified by each of the sizers.\n *\n * This is useful when implementing box layouts where the boundaries\n * between the sizers are interactively adjustable by the user.\n */\n export function adjust(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Bail early when there is nothing to do.\n if (sizers.length === 0 || delta === 0) {\n return;\n }\n\n // Dispatch to the proper implementation.\n if (delta > 0) {\n growSizer(sizers, index, delta);\n } else {\n shrinkSizer(sizers, index, -delta);\n }\n }\n\n /**\n * Grow a sizer by a positive delta and adjust neighbors.\n */\n function growSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the left can expand.\n let growLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the right can shrink.\n let shrinkLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the left by the delta.\n let grow = delta;\n for (let i = index; i >= 0 && grow > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the right by the delta.\n let shrink = delta;\n for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n\n /**\n * Shrink a sizer by a positive delta and adjust neighbors.\n */\n function shrinkSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the right can expand.\n let growLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the left can shrink.\n let shrinkLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the right by the delta.\n let grow = delta;\n for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the left by the delta.\n let shrink = delta;\n for (let i = index; i >= 0 && shrink > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title implements IDisposable {\n /**\n * Construct a new title.\n *\n * @param options - The options for initializing the title.\n */\n constructor(options: Title.IOptions) {\n this.owner = options.owner;\n if (options.label !== undefined) {\n this._label = options.label;\n }\n if (options.mnemonic !== undefined) {\n this._mnemonic = options.mnemonic;\n }\n if (options.icon !== undefined) {\n this._icon = options.icon;\n }\n\n if (options.iconClass !== undefined) {\n this._iconClass = options.iconClass;\n }\n if (options.iconLabel !== undefined) {\n this._iconLabel = options.iconLabel;\n }\n if (options.caption !== undefined) {\n this._caption = options.caption;\n }\n if (options.className !== undefined) {\n this._className = options.className;\n }\n if (options.closable !== undefined) {\n this._closable = options.closable;\n }\n this._dataset = options.dataset || {};\n }\n\n /**\n * A signal emitted when the state of the title changes.\n */\n get changed(): ISignal {\n return this._changed;\n }\n\n /**\n * The object which owns the title.\n */\n readonly owner: T;\n\n /**\n * Get the label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get label(): string {\n return this._label;\n }\n\n /**\n * Set the label for the title.\n */\n set label(value: string) {\n if (this._label === value) {\n return;\n }\n this._label = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the mnemonic index for the title.\n *\n * #### Notes\n * The default value is `-1`.\n */\n get mnemonic(): number {\n return this._mnemonic;\n }\n\n /**\n * Set the mnemonic index for the title.\n */\n set mnemonic(value: number) {\n if (this._mnemonic === value) {\n return;\n }\n this._mnemonic = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon renderer for the title.\n *\n * #### Notes\n * The default value is undefined.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._icon;\n }\n\n /**\n * Set the icon renderer for the title.\n *\n * #### Notes\n * A renderer is an object that supplies a render and unrender function.\n */\n set icon(value: VirtualElement.IRenderer | undefined) {\n if (this._icon === value) {\n return;\n }\n this._icon = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconClass(): string {\n return this._iconClass;\n }\n\n /**\n * Set the icon class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconClass(value: string) {\n if (this._iconClass === value) {\n return;\n }\n this._iconClass = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconLabel(): string {\n return this._iconLabel;\n }\n\n /**\n * Set the icon label for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconLabel(value: string) {\n if (this._iconLabel === value) {\n return;\n }\n this._iconLabel = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the caption for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get caption(): string {\n return this._caption;\n }\n\n /**\n * Set the caption for the title.\n */\n set caption(value: string) {\n if (this._caption === value) {\n return;\n }\n this._caption = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the extra class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get className(): string {\n return this._className;\n }\n\n /**\n * Set the extra class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set className(value: string) {\n if (this._className === value) {\n return;\n }\n this._className = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the closable state for the title.\n *\n * #### Notes\n * The default value is `false`.\n */\n get closable(): boolean {\n return this._closable;\n }\n\n /**\n * Set the closable state for the title.\n *\n * #### Notes\n * This controls the presence of a close icon when applicable.\n */\n set closable(value: boolean) {\n if (this._closable === value) {\n return;\n }\n this._closable = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the dataset for the title.\n *\n * #### Notes\n * The default value is an empty dataset.\n */\n get dataset(): Title.Dataset {\n return this._dataset;\n }\n\n /**\n * Set the dataset for the title.\n *\n * #### Notes\n * This controls the data attributes when applicable.\n */\n set dataset(value: Title.Dataset) {\n if (this._dataset === value) {\n return;\n }\n this._dataset = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Test whether the title has been disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the title.\n *\n * #### Notes\n * It is the responsibility of the owner to call the title disposal.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n\n Signal.clearData(this);\n }\n\n private _label = '';\n private _caption = '';\n private _mnemonic = -1;\n private _icon: VirtualElement.IRenderer | undefined = undefined;\n private _iconClass = '';\n private _iconLabel = '';\n private _className = '';\n private _closable = false;\n private _dataset: Title.Dataset;\n private _changed = new Signal(this);\n private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n /**\n * A type alias for a simple immutable string dataset.\n */\n export type Dataset = { readonly [key: string]: string };\n\n /**\n * An options object for initializing a title.\n */\n export interface IOptions {\n /**\n * The object which owns the title.\n */\n owner: T;\n\n /**\n * The label for the title.\n */\n label?: string;\n\n /**\n * The mnemonic index for the title.\n */\n mnemonic?: number;\n\n /**\n * The icon renderer for the title.\n */\n icon?: VirtualElement.IRenderer;\n\n /**\n * The icon class name for the title.\n */\n iconClass?: string;\n\n /**\n * The icon label for the title.\n */\n iconLabel?: string;\n\n /**\n * The caption for the title.\n */\n caption?: string;\n\n /**\n * The extra class name for the title.\n */\n className?: string;\n\n /**\n * The closable state for the title.\n */\n closable?: boolean;\n\n /**\n * The dataset for the title.\n */\n dataset?: Dataset;\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n ConflatableMessage,\n IMessageHandler,\n Message,\n MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n /**\n * Construct a new widget.\n *\n * @param options - The options for initializing the widget.\n */\n constructor(options: Widget.IOptions = {}) {\n this.node = Private.createNode(options);\n this.addClass('lm-Widget');\n }\n\n /**\n * Dispose of the widget and its descendant widgets.\n *\n * #### Notes\n * It is unsafe to use the widget after it has been disposed.\n *\n * All calls made to this method after the first are a no-op.\n */\n dispose(): void {\n // Do nothing if the widget is already disposed.\n if (this.isDisposed) {\n return;\n }\n\n // Set the disposed flag and emit the disposed signal.\n this.setFlag(Widget.Flag.IsDisposed);\n this._disposed.emit(undefined);\n\n // Remove or detach the widget if necessary.\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n\n // Dispose of the widget layout.\n if (this._layout) {\n this._layout.dispose();\n this._layout = null;\n }\n\n // Dispose the title\n this.title.dispose();\n\n // Clear the extra data associated with the widget.\n Signal.clearData(this);\n MessageLoop.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * A signal emitted when the widget is disposed.\n */\n get disposed(): ISignal {\n return this._disposed;\n }\n\n /**\n * Get the DOM node owned by the widget.\n */\n readonly node: HTMLElement;\n\n /**\n * Test whether the widget has been disposed.\n */\n get isDisposed(): boolean {\n return this.testFlag(Widget.Flag.IsDisposed);\n }\n\n /**\n * Test whether the widget's node is attached to the DOM.\n */\n get isAttached(): boolean {\n return this.testFlag(Widget.Flag.IsAttached);\n }\n\n /**\n * Test whether the widget is explicitly hidden.\n */\n get isHidden(): boolean {\n return this.testFlag(Widget.Flag.IsHidden);\n }\n\n /**\n * Test whether the widget is visible.\n *\n * #### Notes\n * A widget is visible when it is attached to the DOM, is not\n * explicitly hidden, and has no explicitly hidden ancestors.\n */\n get isVisible(): boolean {\n return this.testFlag(Widget.Flag.IsVisible);\n }\n\n /**\n * The title object for the widget.\n *\n * #### Notes\n * The title object is used by some container widgets when displaying\n * the widget alongside some title, such as a tab panel or side bar.\n *\n * Since not all widgets will use the title, it is created on demand.\n *\n * The `owner` property of the title is set to this widget.\n */\n get title(): Title {\n return Private.titleProperty.get(this);\n }\n\n /**\n * Get the id of the widget's DOM node.\n */\n get id(): string {\n return this.node.id;\n }\n\n /**\n * Set the id of the widget's DOM node.\n */\n set id(value: string) {\n this.node.id = value;\n }\n\n /**\n * The dataset for the widget's DOM node.\n */\n get dataset(): DOMStringMap {\n return this.node.dataset;\n }\n\n /**\n * Get the method for hiding the widget.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding the widget.\n */\n set hiddenMode(value: Widget.HiddenMode) {\n if (this._hiddenMode === value) {\n return;\n }\n\n if (this.isHidden) {\n // Reset styles set by previous mode.\n this._toggleHidden(false);\n }\n\n if (value == Widget.HiddenMode.Scale) {\n this.node.style.willChange = 'transform';\n } else {\n this.node.style.willChange = 'auto';\n }\n\n this._hiddenMode = value;\n\n if (this.isHidden) {\n // Set styles for new mode.\n this._toggleHidden(true);\n }\n }\n\n /**\n * Get the parent of the widget.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent of the widget.\n *\n * #### Notes\n * Children are typically added to a widget by using a layout, which\n * means user code will not normally set the parent widget directly.\n *\n * The widget will be automatically removed from its old parent.\n *\n * This is a no-op if there is no effective parent change.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (value && this.contains(value)) {\n throw new Error('Invalid parent widget.');\n }\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-removed', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n this._parent = value;\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-added', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n if (!this.isDisposed) {\n MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n }\n }\n\n /**\n * Get the layout for the widget.\n */\n get layout(): Layout | null {\n return this._layout;\n }\n\n /**\n * Set the layout for the widget.\n *\n * #### Notes\n * The layout is single-use only. It cannot be changed after the\n * first assignment.\n *\n * The layout is disposed automatically when the widget is disposed.\n */\n set layout(value: Layout | null) {\n if (this._layout === value) {\n return;\n }\n if (this.testFlag(Widget.Flag.DisallowLayout)) {\n throw new Error('Cannot set widget layout.');\n }\n if (this._layout) {\n throw new Error('Cannot change widget layout.');\n }\n if (value!.parent) {\n throw new Error('Cannot change layout parent.');\n }\n this._layout = value;\n value!.parent = this;\n }\n\n /**\n * Create an iterator over the widget's children.\n *\n * @returns A new iterator over the children of the widget.\n *\n * #### Notes\n * The widget must have a populated layout in order to have children.\n *\n * If a layout is not installed, the returned iterator will be empty.\n */\n *children(): IterableIterator {\n if (this._layout) {\n yield* this._layout;\n }\n }\n\n /**\n * Test whether a widget is a descendant of this widget.\n *\n * @param widget - The descendant widget of interest.\n *\n * @returns `true` if the widget is a descendant, `false` otherwise.\n */\n contains(widget: Widget): boolean {\n for (let value: Widget | null = widget; value; value = value._parent) {\n if (value === this) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Test whether the widget's DOM node has the given class name.\n *\n * @param name - The class name of interest.\n *\n * @returns `true` if the node has the class, `false` otherwise.\n */\n hasClass(name: string): boolean {\n return this.node.classList.contains(name);\n }\n\n /**\n * Add a class name to the widget's DOM node.\n *\n * @param name - The class name to add to the node.\n *\n * #### Notes\n * If the class name is already added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n addClass(name: string): void {\n this.node.classList.add(name);\n }\n\n /**\n * Remove a class name from the widget's DOM node.\n *\n * @param name - The class name to remove from the node.\n *\n * #### Notes\n * If the class name is not yet added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n removeClass(name: string): void {\n this.node.classList.remove(name);\n }\n\n /**\n * Toggle a class name on the widget's DOM node.\n *\n * @param name - The class name to toggle on the node.\n *\n * @param force - Whether to force add the class (`true`) or force\n * remove the class (`false`). If not provided, the presence of\n * the class will be toggled from its current state.\n *\n * @returns `true` if the class is now present, `false` otherwise.\n *\n * #### Notes\n * The class name must not contain whitespace.\n */\n toggleClass(name: string, force?: boolean): boolean {\n if (force === true) {\n this.node.classList.add(name);\n return true;\n }\n if (force === false) {\n this.node.classList.remove(name);\n return false;\n }\n return this.node.classList.toggle(name);\n }\n\n /**\n * Post an `'update-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n update(): void {\n MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n }\n\n /**\n * Post a `'fit-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n fit(): void {\n MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n }\n\n /**\n * Post an `'activate-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n activate(): void {\n MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n }\n\n /**\n * Send a `'close-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for sending the message.\n */\n close(): void {\n MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n }\n\n /**\n * Show the widget and make it visible to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `false`.\n *\n * If the widget is not explicitly hidden, this is a no-op.\n */\n show(): void {\n if (!this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n }\n this.clearFlag(Widget.Flag.IsHidden);\n this._toggleHidden(false);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-shown', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Hide the widget and make it hidden to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `true`.\n *\n * If the widget is explicitly hidden, this is a no-op.\n */\n hide(): void {\n if (this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n }\n this.setFlag(Widget.Flag.IsHidden);\n this._toggleHidden(true);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-hidden', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Show or hide the widget according to a boolean value.\n *\n * @param hidden - `true` to hide the widget, or `false` to show it.\n *\n * #### Notes\n * This is a convenience method for `hide()` and `show()`.\n */\n setHidden(hidden: boolean): void {\n if (hidden) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Test whether the given widget flag is set.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n testFlag(flag: Widget.Flag): boolean {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * Set the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n setFlag(flag: Widget.Flag): void {\n this._flags |= flag;\n }\n\n /**\n * Clear the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n clearFlag(flag: Widget.Flag): void {\n this._flags &= ~flag;\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n *\n * #### Notes\n * Subclasses may reimplement this method as needed.\n */\n processMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.notifyLayout(msg);\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.notifyLayout(msg);\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.notifyLayout(msg);\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.notifyLayout(msg);\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.setFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.notifyLayout(msg);\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.clearFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.notifyLayout(msg);\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n this.setFlag(Widget.Flag.IsVisible);\n }\n this.setFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.notifyLayout(msg);\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.clearFlag(Widget.Flag.IsVisible);\n this.clearFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterDetach(msg);\n break;\n case 'activate-request':\n this.notifyLayout(msg);\n this.onActivateRequest(msg);\n break;\n case 'close-request':\n this.notifyLayout(msg);\n this.onCloseRequest(msg);\n break;\n case 'child-added':\n this.notifyLayout(msg);\n this.onChildAdded(msg as Widget.ChildMessage);\n break;\n case 'child-removed':\n this.notifyLayout(msg);\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n default:\n this.notifyLayout(msg);\n break;\n }\n }\n\n /**\n * Invoke the message processing routine of the widget's layout.\n *\n * @param msg - The message to dispatch to the layout.\n *\n * #### Notes\n * This is a no-op if the widget does not have a layout.\n *\n * This will not typically be called directly by user code.\n */\n protected notifyLayout(msg: Message): void {\n if (this._layout) {\n this._layout.processParentMessage(msg);\n }\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n *\n * #### Notes\n * The default implementation unparents or detaches the widget.\n */\n protected onCloseRequest(msg: Message): void {\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onResize(msg: Widget.ResizeMessage): void {}\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onUpdateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onActivateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeShow(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterShow(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeHide(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterHide(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-added'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n private _toggleHidden(hidden: boolean) {\n if (hidden) {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.addClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = 'scale(0)';\n this.node.setAttribute('aria-hidden', 'true');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = 'hidden';\n this.node.style.zIndex = '-1';\n break;\n }\n } else {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.removeClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = '';\n this.node.removeAttribute('aria-hidden');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = '';\n this.node.style.zIndex = '';\n break;\n }\n }\n }\n\n private _flags = 0;\n private _layout: Layout | null = null;\n private _parent: Widget | null = null;\n private _disposed = new Signal(this);\n private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n /**\n * An options object for initializing a widget.\n */\n export interface IOptions {\n /**\n * The optional node to use for the widget.\n *\n * If a node is provided, the widget will assume full ownership\n * and control of the node, as if it had created the node itself.\n *\n * The default is a new `
`.\n */\n node?: HTMLElement;\n\n /**\n * The optional element tag, used for constructing the widget's node.\n *\n * If a pre-constructed node is provided via the `node` arg, this\n * value is ignored.\n */\n tag?: keyof HTMLElementTagNameMap;\n }\n\n /**\n * The method for hiding the widget.\n *\n * The default is Display.\n *\n * Using `Scale` will often increase performance as most browsers will not\n * trigger style computation for the `transform` action. This should be used\n * sparingly and tested, since increasing the number of composition layers\n * may slow things down.\n *\n * To ensure the transformation does not trigger style recomputation, you\n * may need to set the widget CSS style `will-change: transform`. This\n * should be used only when needed as it may overwhelm the browser with a\n * high number of layers. See\n * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n */\n export enum HiddenMode {\n /**\n * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n * CSS from the standard Lumino CSS.\n */\n Display = 0,\n\n /**\n * Hide the widget by setting the `transform` to `'scale(0)'`.\n */\n Scale,\n\n /**\n *Hide the widget by setting the `content-visibility` to `'hidden'`.\n */\n ContentVisibility\n }\n\n /**\n * An enum of widget bit flags.\n */\n export enum Flag {\n /**\n * The widget has been disposed.\n */\n IsDisposed = 0x1,\n\n /**\n * The widget is attached to the DOM.\n */\n IsAttached = 0x2,\n\n /**\n * The widget is hidden.\n */\n IsHidden = 0x4,\n\n /**\n * The widget is visible.\n */\n IsVisible = 0x8,\n\n /**\n * A layout cannot be set on the widget.\n */\n DisallowLayout = 0x10\n }\n\n /**\n * A collection of stateless messages related to widgets.\n */\n export namespace Msg {\n /**\n * A singleton `'before-show'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const BeforeShow = new Message('before-show');\n\n /**\n * A singleton `'after-show'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const AfterShow = new Message('after-show');\n\n /**\n * A singleton `'before-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const BeforeHide = new Message('before-hide');\n\n /**\n * A singleton `'after-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const AfterHide = new Message('after-hide');\n\n /**\n * A singleton `'before-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is attached.\n */\n export const BeforeAttach = new Message('before-attach');\n\n /**\n * A singleton `'after-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is attached.\n */\n export const AfterAttach = new Message('after-attach');\n\n /**\n * A singleton `'before-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is detached.\n */\n export const BeforeDetach = new Message('before-detach');\n\n /**\n * A singleton `'after-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is detached.\n */\n export const AfterDetach = new Message('after-detach');\n\n /**\n * A singleton `'parent-changed'` message.\n *\n * #### Notes\n * This message is sent to a widget when its parent has changed.\n */\n export const ParentChanged = new Message('parent-changed');\n\n /**\n * A singleton conflatable `'update-request'` message.\n *\n * #### Notes\n * This message can be dispatched to supporting widgets in order to\n * update their content based on the current widget state. Not all\n * widgets will respond to messages of this type.\n *\n * For widgets with a layout, this message will inform the layout to\n * update the position and size of its child widgets.\n */\n export const UpdateRequest = new ConflatableMessage('update-request');\n\n /**\n * A singleton conflatable `'fit-request'` message.\n *\n * #### Notes\n * For widgets with a layout, this message will inform the layout to\n * recalculate its size constraints to fit the space requirements of\n * its child widgets, and to update their position and size. Not all\n * layouts will respond to messages of this type.\n */\n export const FitRequest = new ConflatableMessage('fit-request');\n\n /**\n * A singleton conflatable `'activate-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should\n * perform the actions necessary to activate the widget, which\n * may include focusing its node or descendant node.\n */\n export const ActivateRequest = new ConflatableMessage('activate-request');\n\n /**\n * A singleton conflatable `'close-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should close\n * and remove itself from the widget hierarchy.\n */\n export const CloseRequest = new ConflatableMessage('close-request');\n }\n\n /**\n * A message class for child related messages.\n */\n export class ChildMessage extends Message {\n /**\n * Construct a new child message.\n *\n * @param type - The message type.\n *\n * @param child - The child widget for the message.\n */\n constructor(type: string, child: Widget) {\n super(type);\n this.child = child;\n }\n\n /**\n * The child widget for the message.\n */\n readonly child: Widget;\n }\n\n /**\n * A message class for `'resize'` messages.\n */\n export class ResizeMessage extends Message {\n /**\n * Construct a new resize message.\n *\n * @param width - The **offset width** of the widget, or `-1` if\n * the width is not known.\n *\n * @param height - The **offset height** of the widget, or `-1` if\n * the height is not known.\n */\n constructor(width: number, height: number) {\n super('resize');\n this.width = width;\n this.height = height;\n }\n\n /**\n * The offset width of the widget.\n *\n * #### Notes\n * This will be `-1` if the width is unknown.\n */\n readonly width: number;\n\n /**\n * The offset height of the widget.\n *\n * #### Notes\n * This will be `-1` if the height is unknown.\n */\n readonly height: number;\n }\n\n /**\n * The namespace for the `ResizeMessage` class statics.\n */\n export namespace ResizeMessage {\n /**\n * A singleton `'resize'` message with an unknown size.\n */\n export const UnknownSize = new ResizeMessage(-1, -1);\n }\n\n /**\n * Attach a widget to a host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * @param host - The DOM node to use as the widget's host.\n *\n * @param ref - The child of `host` to use as the reference element.\n * If this is provided, the widget will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * widget to be added as the last child of the host.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget, if\n * the widget is already attached, or if the host is not attached\n * to the DOM.\n */\n export function attach(\n widget: Widget,\n host: HTMLElement,\n ref: HTMLElement | null = null\n ): void {\n if (widget.parent) {\n throw new Error('Cannot attach a child widget.');\n }\n if (widget.isAttached || widget.node.isConnected) {\n throw new Error('Widget is already attached.');\n }\n if (!host.isConnected) {\n throw new Error('Host is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n host.insertBefore(widget.node, ref);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n /**\n * Detach the widget from its host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget,\n * or if the widget is not attached to the DOM.\n */\n export function detach(widget: Widget): void {\n if (widget.parent) {\n throw new Error('Cannot detach a child widget.');\n }\n if (!widget.isAttached || !widget.node.isConnected) {\n throw new Error('Widget is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n widget.node.parentNode!.removeChild(widget.node);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An attached property for the widget title object.\n */\n export const titleProperty = new AttachedProperty>({\n name: 'title',\n create: owner => new Title({ owner })\n });\n\n /**\n * Create a DOM node for the given widget options.\n */\n export function createNode(options: Widget.IOptions): HTMLElement {\n return options.node || document.createElement(options.tag || 'div');\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable, IDisposable {\n /**\n * Construct a new layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: Layout.IOptions = {}) {\n this._fitPolicy = options.fitPolicy || 'set-min-size';\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This should be reimplemented to clear and dispose of the widgets.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n this._parent = null;\n this._disposed = true;\n Signal.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * Test whether the layout is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Get the parent widget of the layout.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent widget of the layout.\n *\n * #### Notes\n * This is set automatically when installing the layout on the parent\n * widget. The parent widget should not be set directly by user code.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (this._parent) {\n throw new Error('Cannot change parent widget.');\n }\n if (value!.layout !== this) {\n throw new Error('Invalid parent widget.');\n }\n this._parent = value;\n this.init();\n }\n\n /**\n * Get the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n get fitPolicy(): Layout.FitPolicy {\n return this._fitPolicy;\n }\n\n /**\n * Set the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n *\n * Changing the fit policy will clear the current size constraint\n * for the parent widget and then re-fit the parent.\n */\n set fitPolicy(value: Layout.FitPolicy) {\n // Bail if the policy does not change\n if (this._fitPolicy === value) {\n return;\n }\n\n // Update the internal policy.\n this._fitPolicy = value;\n\n // Clear the size constraints and schedule a fit of the parent.\n if (this._parent) {\n let style = this._parent.node.style;\n style.minWidth = '';\n style.minHeight = '';\n style.maxWidth = '';\n style.maxHeight = '';\n this._parent.fit();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This abstract method must be implemented by a subclass.\n */\n abstract [Symbol.iterator](): IterableIterator;\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method should *not* modify the widget's `parent`.\n */\n abstract removeWidget(widget: Widget): void;\n\n /**\n * Process a message sent to the parent widget.\n *\n * @param msg - The message sent to the parent widget.\n *\n * #### Notes\n * This method is called by the parent widget to process a message.\n *\n * Subclasses may reimplement this method as needed.\n */\n processParentMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.onAfterDetach(msg);\n break;\n case 'child-removed':\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n case 'child-shown':\n this.onChildShown(msg as Widget.ChildMessage);\n break;\n case 'child-hidden':\n this.onChildHidden(msg as Widget.ChildMessage);\n break;\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n *\n * #### Notes\n * This method is invoked immediately after the layout is installed\n * on the parent widget.\n *\n * The default implementation reparents all of the widgets to the\n * layout parent widget.\n *\n * Subclasses should reimplement this method and attach the child\n * widget nodes to the parent widget's node.\n */\n protected init(): void {\n for (const widget of this) {\n widget.parent = this.parent;\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the specified layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the available layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onUpdateRequest(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * This will remove the child widget from the layout.\n *\n * Subclasses should **not** typically reimplement this method.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n this.removeWidget(msg.child);\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n private _disposed = false;\n private _fitPolicy: Layout.FitPolicy;\n private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n /**\n * A type alias for the layout fit policy.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n export type FitPolicy =\n | /**\n * No size constraint will be applied to the parent widget.\n */\n 'set-no-constraint'\n\n /**\n * The computed min size will be applied to the parent widget.\n */\n | 'set-min-size';\n\n /**\n * An options object for initializing a layout.\n */\n export interface IOptions {\n /**\n * The fit policy for the layout.\n *\n * The default is `'set-min-size'`.\n */\n fitPolicy?: FitPolicy;\n }\n\n /**\n * A type alias for the horizontal alignment of a widget.\n */\n export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n /**\n * A type alias for the vertical alignment of a widget.\n */\n export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n /**\n * Get the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The horizontal alignment for the widget.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n */\n export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n return Private.horizontalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the horizontal alignment.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setHorizontalAlignment(\n widget: Widget,\n value: HorizontalAlignment\n ): void {\n Private.horizontalAlignmentProperty.set(widget, value);\n }\n\n /**\n * Get the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The vertical alignment for the widget.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n */\n export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n return Private.verticalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the vertical alignment.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setVerticalAlignment(\n widget: Widget,\n value: VerticalAlignment\n ): void {\n Private.verticalAlignmentProperty.set(widget, value);\n }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n /**\n * Construct a new layout item.\n *\n * @param widget - The widget to be managed by the item.\n *\n * #### Notes\n * The widget will be set to absolute positioning.\n * The widget will use strict CSS containment.\n */\n constructor(widget: Widget) {\n this.widget = widget;\n this.widget.node.style.position = 'absolute';\n this.widget.node.style.contain = 'strict';\n }\n\n /**\n * Dispose of the the layout item.\n *\n * #### Notes\n * This will reset the positioning of the widget.\n */\n dispose(): void {\n // Do nothing if the item is already disposed.\n if (this._disposed) {\n return;\n }\n\n // Mark the item as disposed.\n this._disposed = true;\n\n // Reset the widget style.\n let style = this.widget.node.style;\n style.position = '';\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n style.contain = '';\n }\n\n /**\n * The widget managed by the layout item.\n */\n readonly widget: Widget;\n\n /**\n * The computed minimum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minWidth(): number {\n return this._minWidth;\n }\n\n /**\n * The computed minimum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minHeight(): number {\n return this._minHeight;\n }\n\n /**\n * The computed maximum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxWidth(): number {\n return this._maxWidth;\n }\n\n /**\n * The computed maximum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxHeight(): number {\n return this._maxHeight;\n }\n\n /**\n * Whether the layout item is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Whether the managed widget is hidden.\n */\n get isHidden(): boolean {\n return this.widget.isHidden;\n }\n\n /**\n * Whether the managed widget is visible.\n */\n get isVisible(): boolean {\n return this.widget.isVisible;\n }\n\n /**\n * Whether the managed widget is attached.\n */\n get isAttached(): boolean {\n return this.widget.isAttached;\n }\n\n /**\n * Update the computed size limits of the managed widget.\n */\n fit(): void {\n let limits = ElementExt.sizeLimits(this.widget.node);\n this._minWidth = limits.minWidth;\n this._minHeight = limits.minHeight;\n this._maxWidth = limits.maxWidth;\n this._maxHeight = limits.maxHeight;\n }\n\n /**\n * Update the position and size of the managed widget.\n *\n * @param left - The left edge position of the layout box.\n *\n * @param top - The top edge position of the layout box.\n *\n * @param width - The width of the layout box.\n *\n * @param height - The height of the layout box.\n */\n update(left: number, top: number, width: number, height: number): void {\n // Clamp the size to the computed size limits.\n let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n // Adjust the left edge for the horizontal alignment, if needed.\n if (clampW < width) {\n switch (Layout.getHorizontalAlignment(this.widget)) {\n case 'left':\n break;\n case 'center':\n left += (width - clampW) / 2;\n break;\n case 'right':\n left += width - clampW;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Adjust the top edge for the vertical alignment, if needed.\n if (clampH < height) {\n switch (Layout.getVerticalAlignment(this.widget)) {\n case 'top':\n break;\n case 'center':\n top += (height - clampH) / 2;\n break;\n case 'bottom':\n top += height - clampH;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Set up the resize variables.\n let resized = false;\n let style = this.widget.node.style;\n\n // Update the top edge of the widget if needed.\n if (this._top !== top) {\n this._top = top;\n style.top = `${top}px`;\n }\n\n // Update the left edge of the widget if needed.\n if (this._left !== left) {\n this._left = left;\n style.left = `${left}px`;\n }\n\n // Update the width of the widget if needed.\n if (this._width !== clampW) {\n resized = true;\n this._width = clampW;\n style.width = `${clampW}px`;\n }\n\n // Update the height of the widget if needed.\n if (this._height !== clampH) {\n resized = true;\n this._height = clampH;\n style.height = `${clampH}px`;\n }\n\n // Send a resize message to the widget if needed.\n if (resized) {\n let msg = new Widget.ResizeMessage(clampW, clampH);\n MessageLoop.sendMessage(this.widget, msg);\n }\n }\n\n private _top = NaN;\n private _left = NaN;\n private _width = NaN;\n private _height = NaN;\n private _minWidth = 0;\n private _minHeight = 0;\n private _maxWidth = Infinity;\n private _maxHeight = Infinity;\n private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The attached property for a widget horizontal alignment.\n */\n export const horizontalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.HorizontalAlignment\n >({\n name: 'horizontalAlignment',\n create: () => 'center',\n changed: onAlignmentChanged\n });\n\n /**\n * The attached property for a widget vertical alignment.\n */\n export const verticalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.VerticalAlignment\n >({\n name: 'verticalAlignment',\n create: () => 'top',\n changed: onAlignmentChanged\n });\n\n /**\n * The change handler for the attached alignment properties.\n */\n function onAlignmentChanged(child: Widget): void {\n if (child.parent && child.parent.layout) {\n child.parent.update();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n while (this._widgets.length > 0) {\n this._widgets.pop()!.dispose();\n }\n super.dispose();\n }\n\n /**\n * A read-only array of the widgets in the layout.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n yield* this._widgets;\n }\n\n /**\n * Add a widget to the end of the layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, it will be moved.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this._widgets.length, widget);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n widget.parent = this.parent;\n\n // Look up the current index of the widget.\n let i = this._widgets.indexOf(widget);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._widgets.length));\n\n // If the widget is not in the array, insert it.\n if (i === -1) {\n // Insert the widget into the array.\n ArrayExt.insert(this._widgets, j, widget);\n\n // If the layout is parented, attach the widget to the DOM.\n if (this.parent) {\n this.attachWidget(j, widget);\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the widget exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._widgets.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the widget to the new location.\n ArrayExt.move(this._widgets, i, j);\n\n // If the layout is parented, move the widget in the DOM.\n if (this.parent) {\n this.moveWidget(i, j, widget);\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n this.removeWidgetAt(this._widgets.indexOf(widget));\n }\n\n /**\n * Remove the widget at a given index from the layout.\n *\n * @param index - The index of the widget to remove.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n removeWidgetAt(index: number): void {\n // Remove the widget from the array.\n let widget = ArrayExt.removeAt(this._widgets, index);\n\n // If the layout is parented, detach the widget from the DOM.\n if (widget && this.parent) {\n this.detachWidget(index, widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n let index = 0;\n for (const widget of this) {\n this.attachWidget(index++, widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[index];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation moves the widget's node to the proper\n * location in the parent's node and sends the appropriate attach and\n * detach messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is moved in the parent's node.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` and message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[toIndex];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widgets: Widget[] = [];\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n /**\n * Clamp a dimension value to an integer >= 0.\n */\n export function clampDimension(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n /**\n * Construct a new split layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: SplitLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.orientation !== undefined) {\n this._orientation = options.orientation;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n this._handles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the split layout.\n */\n readonly renderer: SplitLayout.IRenderer;\n\n /**\n * Get the layout orientation for the split layout.\n */\n get orientation(): SplitLayout.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the layout orientation for the split layout.\n */\n set orientation(value: SplitLayout.Orientation) {\n if (this._orientation === value) {\n return;\n }\n this._orientation = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['orientation'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n get alignment(): SplitLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n set alignment(value: SplitLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the split layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the split layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the split handles in the layout.\n */\n get handles(): ReadonlyArray {\n return this._handles;\n }\n\n /**\n * Get the absolute sizes of the widgets in the layout.\n *\n * @returns A new array of the absolute sizes of the widgets.\n *\n * This method **does not** measure the DOM nodes.\n */\n absoluteSizes(): number[] {\n return this._sizers.map(sizer => sizer.size);\n }\n\n /**\n * Get the relative sizes of the widgets in the layout.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return Private.normalize(this._sizers.map(sizer => sizer.size));\n }\n\n /**\n * Set the relative sizes for the widgets in the layout.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n // Copy the sizes and pad with zeros as needed.\n let n = this._sizers.length;\n let temp = sizes.slice(0, n);\n while (temp.length < n) {\n temp.push(0);\n }\n\n // Normalize the padded sizes.\n let normed = Private.normalize(temp);\n\n // Apply the normalized sizes to the sizers.\n for (let i = 0; i < n; ++i) {\n let sizer = this._sizers[i];\n sizer.sizeHint = normed[i];\n sizer.size = normed[i];\n }\n\n // Set the flag indicating the sizes are normalized.\n this._hasNormedSizes = true;\n\n // Trigger an update of the parent widget.\n if (update && this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Move the offset position of a split handle.\n *\n * @param index - The index of the handle of the interest.\n *\n * @param position - The desired offset position of the handle.\n *\n * #### Notes\n * The position is relative to the offset parent.\n *\n * This will move the handle as close as possible to the desired\n * position. The sibling widgets will be adjusted as necessary.\n */\n moveHandle(index: number, position: number): void {\n // Bail if the index is invalid or the handle is hidden.\n let handle = this._handles[index];\n if (!handle || handle.classList.contains('lm-mod-hidden')) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (this._orientation === 'horizontal') {\n delta = position - handle.offsetLeft;\n } else {\n delta = position - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent widget resizing unless needed.\n for (let sizer of this._sizers) {\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(this._sizers, index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['orientation'] = this.orientation;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create the item, handle, and sizer for the new widget.\n let item = new LayoutItem(widget);\n let handle = Private.createHandle(this.renderer);\n let average = Private.averageSize(this._sizers);\n let sizer = Private.createSizer(average);\n\n // Insert the item, handle, and sizer into the internal arrays.\n ArrayExt.insert(this._items, index, item);\n ArrayExt.insert(this._sizers, index, sizer);\n ArrayExt.insert(this._handles, index, handle);\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget and handle nodes to the parent.\n this.parent!.node.appendChild(widget.node);\n this.parent!.node.appendChild(handle);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the item, sizer, and handle for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n ArrayExt.move(this._handles, fromIndex, toIndex);\n\n // Post a fit request to the parent to show/hide last handle.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the item, handle, and sizer for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n let handle = ArrayExt.removeAt(this._handles, index);\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget and handle nodes from the parent.\n this.parent!.node.removeChild(widget.node);\n this.parent!.node.removeChild(handle!);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const item = this._items[i];\n if (item.isHidden) {\n return;\n }\n\n // Fetch the style for the handle.\n let handleStyle = this._handles[i].style;\n\n // Update the widget and handle, and advance the relevant edge.\n if (isHorizontal) {\n left += this.widgetOffset;\n item.update(left, top, size, height);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${this._spacing}px`;\n handleStyle.height = `${height}px`;\n } else {\n top += this.widgetOffset;\n item.update(left, top, width, size);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${this._spacing}px`;\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Update the handles and track the visible widget count.\n let nVisible = 0;\n let lastHandleIndex = -1;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n if (this._items[i].isHidden) {\n this._handles[i].classList.add('lm-mod-hidden');\n } else {\n this._handles[i].classList.remove('lm-mod-hidden');\n lastHandleIndex = i;\n nVisible++;\n }\n }\n\n // Hide the handle for the last visible widget.\n if (lastHandleIndex !== -1) {\n this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n }\n\n // Update the fixed space for the visible items.\n this._fixed =\n this._spacing * Math.max(0, nVisible - 1) +\n this.widgetOffset * this._items.length;\n\n // Setup the computed minimum size.\n let horz = this._orientation === 'horizontal';\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed size limits.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // Prevent resizing unless necessary.\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the stretch factor.\n sizer.stretch = SplitLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0 && this.widgetOffset === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Set up the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n let horz = this._orientation === 'horizontal';\n\n if (nVisible > 0) {\n // Compute the adjusted layout space.\n let space: number;\n if (horz) {\n // left += this.widgetOffset;\n space = Math.max(0, width - this._fixed);\n } else {\n // top += this.widgetOffset;\n space = Math.max(0, height - this._fixed);\n }\n\n // Scale the size hints if they are normalized.\n if (this._hasNormedSizes) {\n for (let sizer of this._sizers) {\n sizer.sizeHint *= space;\n }\n this._hasNormedSizes = false;\n }\n\n // Distribute the layout space to the box sizers.\n let delta = BoxEngine.calc(this._sizers, space);\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n const item = this._items[i];\n\n // Fetch the computed size for the widget.\n const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n this.updateItemPosition(\n i,\n horz,\n horz ? left + offset : left,\n horz ? top : top + offset,\n height,\n width,\n size\n );\n\n const fullOffset =\n this.widgetOffset +\n (this._handles[i].classList.contains('lm-mod-hidden')\n ? 0\n : this._spacing);\n\n if (horz) {\n left += size + fullOffset;\n } else {\n top += size + fullOffset;\n }\n }\n }\n\n protected widgetOffset = 0;\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _hasNormedSizes = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _handles: HTMLDivElement[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: SplitLayout.Alignment = 'start';\n private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n /**\n * A type alias for a split layout orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a split layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a split layout.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split layout.\n */\n renderer: IRenderer;\n\n /**\n * The orientation of the layout.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a split layout.\n */\n export interface IRenderer {\n /**\n * Create a new handle for use with a split layout.\n *\n * @returns A new handle element.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * Get the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Create a new box sizer with the given size hint.\n */\n export function createSizer(size: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = Math.floor(size);\n return sizer;\n }\n\n /**\n * Create a new split handle node using the given renderer.\n */\n export function createHandle(\n renderer: SplitLayout.IRenderer\n ): HTMLDivElement {\n let handle = renderer.createHandle();\n handle.style.position = 'absolute';\n // Do not use size containment to allow the handle to fill the available space\n handle.style.contain = 'style';\n return handle;\n }\n\n /**\n * Compute the average size of an array of box sizers.\n */\n export function averageSize(sizers: BoxSizer[]): number {\n return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n }\n\n /**\n * Normalize an array of values.\n */\n export function normalize(values: number[]): number[] {\n let n = values.length;\n if (n === 0) {\n return [];\n }\n let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof SplitLayout) {\n child.parent.fit();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n /**\n * Construct a new accordion layout.\n *\n * @param options - The options for initializing the layout.\n *\n * #### Notes\n * The default orientation will be vertical.\n *\n * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n */\n constructor(options: AccordionLayout.IOptions) {\n super({ ...options, orientation: options.orientation || 'vertical' });\n this.titleSpace = options.titleSpace || 22;\n }\n\n /**\n * The section title height or width depending on the orientation.\n */\n get titleSpace(): number {\n return this.widgetOffset;\n }\n set titleSpace(value: number) {\n value = Utils.clampDimension(value);\n if (this.widgetOffset === value) {\n return;\n }\n this.widgetOffset = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return this._titles;\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n\n // Clear the layout state.\n this._titles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the accordion layout.\n */\n readonly renderer: AccordionLayout.IRenderer;\n\n public updateTitle(index: number, widget: Widget): void {\n const oldTitle = this._titles[index];\n const expanded = oldTitle.classList.contains('lm-mod-expanded');\n const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n this._titles[index] = newTitle;\n\n // Add the title node to the parent before the widget.\n this.parent!.node.replaceChild(newTitle, oldTitle);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n if (!widget.id) {\n widget.id = `id-${UUID.uuid4()}`;\n }\n super.insertWidget(index, widget);\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(index: number, widget: Widget): void {\n const title = Private.createTitle(this.renderer, widget.title);\n\n ArrayExt.insert(this._titles, index, title);\n\n // Add the title node to the parent before the widget.\n this.parent!.node.appendChild(title);\n\n widget.node.setAttribute('role', 'region');\n widget.node.setAttribute('aria-labelledby', title.id);\n\n super.attachWidget(index, widget);\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n ArrayExt.move(this._titles, fromIndex, toIndex);\n super.moveWidget(fromIndex, toIndex, widget);\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n const title = ArrayExt.removeAt(this._titles, index);\n\n this.parent!.node.removeChild(title!);\n\n super.detachWidget(index, widget);\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const titleStyle = this._titles[i].style;\n\n // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n titleStyle.top = `${top}px`;\n titleStyle.left = `${left}px`;\n titleStyle.height = `${this.widgetOffset}px`;\n if (isHorizontal) {\n titleStyle.width = `${height}px`;\n } else {\n titleStyle.width = `${width}px`;\n }\n\n super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n }\n\n private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n /**\n * A type alias for a accordion layout orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion layout alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * An options object for initializing a accordion layout.\n */\n export interface IOptions extends SplitLayout.IOptions {\n /**\n * The renderer to use for the accordion layout.\n */\n renderer: IRenderer;\n\n /**\n * The section title height or width depending on the orientation.\n *\n * The default is `22`.\n */\n titleSpace?: number;\n }\n\n /**\n * A renderer for use with an accordion layout.\n */\n export interface IRenderer extends SplitLayout.IRenderer {\n /**\n * Common class name for all accordion titles.\n */\n readonly titleClassName: string;\n\n /**\n * Render the element for a section title.\n *\n * @param title - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(title: Title): HTMLElement;\n }\n}\n\nnamespace Private {\n /**\n * Create the title HTML element.\n *\n * @param renderer Accordion renderer\n * @param data Widget title\n * @returns Title HTML element\n */\n export function createTitle(\n renderer: AccordionLayout.IRenderer,\n data: Title,\n expanded: boolean = true\n ): HTMLElement {\n const title = renderer.createSectionTitle(data);\n title.style.position = 'absolute';\n title.style.contain = 'strict';\n title.setAttribute('aria-label', `${data.label} Section`);\n title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n title.setAttribute('aria-controls', data.owner.id);\n if (expanded) {\n title.classList.add('lm-mod-expanded');\n }\n return title;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n /**\n * Construct a new panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: Panel.IOptions = {}) {\n super();\n this.addClass('lm-Panel');\n this.layout = Private.createLayout(options);\n }\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return (this.layout as PanelLayout).widgets;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n (this.layout as PanelLayout).addWidget(widget);\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n (this.layout as PanelLayout).insertWidget(index, widget);\n }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n /**\n * An options object for creating a panel.\n */\n export interface IOptions {\n /**\n * The panel layout to use for the panel.\n *\n * The default is a new `PanelLayout`.\n */\n layout?: PanelLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a panel layout for the given panel options.\n */\n export function createLayout(options: Panel.IOptions): PanelLayout {\n return options.layout || new PanelLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n /**\n * Construct a new split panel.\n *\n * @param options - The options for initializing the split panel.\n */\n constructor(options: SplitPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-SplitPanel');\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n this._releaseMouse();\n super.dispose();\n }\n\n /**\n * Get the layout orientation for the split panel.\n */\n get orientation(): SplitPanel.Orientation {\n return (this.layout as SplitLayout).orientation;\n }\n\n /**\n * Set the layout orientation for the split panel.\n */\n set orientation(value: SplitPanel.Orientation) {\n (this.layout as SplitLayout).orientation = value;\n }\n\n /**\n * Get the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n get alignment(): SplitPanel.Alignment {\n return (this.layout as SplitLayout).alignment;\n }\n\n /**\n * Set the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n set alignment(value: SplitPanel.Alignment) {\n (this.layout as SplitLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the split panel.\n */\n get spacing(): number {\n return (this.layout as SplitLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the split panel.\n */\n set spacing(value: number) {\n (this.layout as SplitLayout).spacing = value;\n }\n\n /**\n * The renderer used by the split panel.\n */\n get renderer(): SplitPanel.IRenderer {\n return (this.layout as SplitLayout).renderer;\n }\n\n /**\n * A signal emitted when a split handle has moved.\n */\n get handleMoved(): ISignal {\n return this._handleMoved;\n }\n\n /**\n * A read-only array of the split handles in the panel.\n */\n get handles(): ReadonlyArray {\n return (this.layout as SplitLayout).handles;\n }\n\n /**\n * Get the relative sizes of the widgets in the panel.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return (this.layout as SplitLayout).relativeSizes();\n }\n\n /**\n * Set the relative sizes for the widgets in the panel.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n }\n\n /**\n * Handle the DOM events for the split panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * Handle the `'keydown'` event for the split panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n if (this._pressData) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the split panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the primary button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the target, if any.\n let layout = this.layout as SplitLayout;\n let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n return handle.contains(event.target as HTMLElement);\n });\n\n // Bail early if the mouse press was not on a handle.\n if (index === -1) {\n return;\n }\n\n // Stop the event when a split handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n document.addEventListener('pointerup', this, true);\n document.addEventListener('pointermove', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Compute the offset delta for the handle press.\n let delta: number;\n let handle = layout.handles[index];\n let rect = handle.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n delta = event.clientX - rect.left;\n } else {\n delta = event.clientY - rect.top;\n }\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!);\n this._pressData = { index, delta, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the split panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Stop the event when dragging a split handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let pos: number;\n let layout = this.layout as SplitLayout;\n let rect = this.node.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n pos = event.clientX - rect.left - this._pressData!.delta;\n } else {\n pos = event.clientY - rect.top - this._pressData!.delta;\n }\n\n // Move the handle as close to the desired position as possible.\n layout.moveHandle(this._pressData!.index, pos);\n }\n\n /**\n * Handle the `'pointerup'` event for the split panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the primary button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse grab for the split panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Emit the handle moved signal.\n this._handleMoved.emit();\n\n // Remove the extra document listeners.\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('pointerup', this, true);\n document.removeEventListener('pointermove', this, true);\n document.removeEventListener('contextmenu', this, true);\n }\n\n private _handleMoved = new Signal(this);\n private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n /**\n * A type alias for a split panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a split panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a split panel renderer.\n */\n export type IRenderer = SplitLayout.IRenderer;\n\n /**\n * An options object for initializing a split panel.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The layout orientation of the panel.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The split layout to use for the split panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `SplitLayout`.\n */\n layout?: SplitLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new handle for use with a split panel.\n *\n * @returns A new handle element for a split panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-SplitPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * Get the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return SplitLayout.getStretch(widget);\n }\n\n /**\n * Set the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n SplitLayout.setStretch(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The index of the pressed handle.\n */\n index: number;\n\n /**\n * The offset of the press in handle coordinates.\n */\n delta: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * Create a split layout for the given panel options.\n */\n export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n return (\n options.layout ||\n new SplitLayout({\n renderer: options.renderer || SplitPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n */\nexport class AccordionPanel extends SplitPanel {\n /**\n * Construct a new accordion panel.\n *\n * @param options - The options for initializing the accordion panel.\n */\n constructor(options: AccordionPanel.IOptions = {}) {\n super({ ...options, layout: Private.createLayout(options) });\n this.addClass('lm-AccordionPanel');\n }\n\n /**\n * The renderer used by the accordion panel.\n */\n get renderer(): AccordionPanel.IRenderer {\n return (this.layout as AccordionLayout).renderer;\n }\n\n /**\n * The section title space.\n *\n * This is the height if the panel is vertical and the width if it is\n * horizontal.\n */\n get titleSpace(): number {\n return (this.layout as AccordionLayout).titleSpace;\n }\n set titleSpace(value: number) {\n (this.layout as AccordionLayout).titleSpace = value;\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return (this.layout as AccordionLayout).titles;\n }\n\n /**\n * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n */\n get expansionToggled(): ISignal {\n return this._expansionToggled;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n super.addWidget(widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Collapse the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n collapse(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && !widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Expand the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n expand(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n super.insertWidget(index, widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Handle the DOM events for the accordion panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n super.handleEvent(event);\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._eventKeyDown(event as KeyboardEvent);\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n super.onBeforeAttach(msg);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n super.onAfterDetach(msg);\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n return widget.contains(sender.owner);\n });\n\n if (index >= 0) {\n (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n this.update();\n }\n }\n\n /**\n * Compute the size of widgets in this panel on the title click event.\n * On closing, the size of the widget is cached and we will try to expand\n * the last opened widget.\n * On opening, we will use the cached size if it is available to restore the\n * widget.\n * In both cases, if we can not compute the size of widgets, we will let\n * `SplitLayout` decide.\n *\n * @param index - The index of widget to be opened of closed\n *\n * @returns Relative size of widgets in this panel, if this size can\n * not be computed, return `undefined`\n */\n private _computeWidgetSize(index: number): number[] | undefined {\n const layout = this.layout as AccordionLayout;\n\n const widget = layout.widgets[index];\n if (!widget) {\n return undefined;\n }\n const isHidden = widget.isHidden;\n const widgetSizes = layout.absoluteSizes();\n const delta = (isHidden ? -1 : 1) * this.spacing;\n const totalSize = widgetSizes.reduce(\n (prev: number, curr: number) => prev + curr\n );\n\n let newSize = [...widgetSizes];\n\n if (!isHidden) {\n // Hide the widget\n const currentSize = widgetSizes[index];\n\n this._widgetSizesCache.set(widget, currentSize);\n newSize[index] = 0;\n\n const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // All widget are closed, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n\n newSize[widgetToCollapse] =\n widgetSizes[widgetToCollapse] + currentSize + delta;\n } else {\n // Show the widget\n const previousSize = this._widgetSizesCache.get(widget);\n if (!previousSize) {\n // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n newSize[index] += previousSize;\n\n const widgetToCollapse = newSize\n .map(sz => sz - previousSize > 0)\n .lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // Can not reduce the size of one widget, reduce all opened widgets\n // proportionally with its size.\n newSize.forEach((_, idx) => {\n if (idx !== index) {\n newSize[idx] -=\n (widgetSizes[idx] / totalSize) * (previousSize - delta);\n }\n });\n } else {\n newSize[widgetToCollapse] -= previousSize - delta;\n }\n }\n return newSize.map(sz => sz / (totalSize + delta));\n }\n /**\n * Handle the `'click'` event for the accordion panel\n */\n private _evtClick(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this._toggleExpansion(index);\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the accordion panel.\n */\n private _eventKeyDown(event: KeyboardEvent): void {\n if (event.defaultPrevented) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n let handled = false;\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n const keyCode = event.keyCode.toString();\n\n // If Space or Enter is pressed on title, emulate click event\n if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n target.click();\n handled = true;\n } else if (\n this.orientation === 'horizontal'\n ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n ) {\n // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n const direction =\n event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n ? -1\n : 1;\n const length = this.titles.length;\n const newIndex = (index + length + direction) % length;\n\n this.titles[newIndex].focus();\n handled = true;\n } else if (event.key === 'End' || keyCode === '35') {\n // If End is pressed on title, focus on the last title\n this.titles[this.titles.length - 1].focus();\n handled = true;\n } else if (event.key === 'Home' || keyCode === '36') {\n // If Home is pressed on title, focus on the first title\n this.titles[0].focus();\n handled = true;\n }\n }\n\n if (handled) {\n event.preventDefault();\n }\n }\n }\n\n private _toggleExpansion(index: number) {\n const title = this.titles[index];\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n const newSize = this._computeWidgetSize(index);\n if (newSize) {\n this.setRelativeSizes(newSize, false);\n }\n\n if (widget.isHidden) {\n title.classList.add('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'true');\n widget.show();\n } else {\n title.classList.remove('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'false');\n widget.hide();\n }\n\n // Emit the expansion state signal.\n this._expansionToggled.emit(index);\n }\n\n private _widgetSizesCache: WeakMap = new WeakMap();\n private _expansionToggled = new Signal(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n /**\n * A type alias for a accordion panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a accordion panel renderer.\n */\n export type IRenderer = AccordionLayout.IRenderer;\n\n /**\n * An options object for initializing a accordion panel.\n */\n export interface IOptions extends Partial {\n /**\n * The accordion layout to use for the accordion panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `AccordionLayout`.\n */\n layout?: AccordionLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer extends SplitPanel.Renderer implements IRenderer {\n constructor() {\n super();\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches any title node in the accordion.\n */\n readonly titleClassName = 'lm-AccordionPanel-title';\n\n /**\n * Render the collapse indicator for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the collapse indicator.\n */\n createCollapseIcon(data: Title): HTMLElement {\n return document.createElement('span');\n }\n\n /**\n * Render the element for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(data: Title): HTMLElement {\n const handle = document.createElement('h3');\n handle.setAttribute('tabindex', '0');\n handle.id = this.createTitleKey(data);\n handle.className = this.titleClassName;\n for (const aData in data.dataset) {\n handle.dataset[aData] = data.dataset[aData];\n }\n\n const collapser = handle.appendChild(this.createCollapseIcon(data));\n collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n const label = handle.appendChild(document.createElement('span'));\n label.className = 'lm-AccordionPanel-titleLabel';\n label.textContent = data.label;\n label.title = data.caption || data.label;\n\n return handle;\n }\n\n /**\n * Create a unique render key for the title.\n *\n * @param data - The data to use for the title.\n *\n * @returns The unique render key for the title.\n *\n * #### Notes\n * This method caches the key against the section title the first time\n * the key is generated.\n */\n createTitleKey(data: Title): string {\n let key = this._titleKeys.get(data);\n if (key === undefined) {\n key = `title-key-${this._uuid}-${this._titleID++}`;\n this._titleKeys.set(data, key);\n }\n return key;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _titleID = 0;\n private _titleKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n /**\n * Create an accordion layout for the given panel options.\n *\n * @param options Panel options\n * @returns Panel layout\n */\n export function createLayout(\n options: AccordionPanel.IOptions\n ): AccordionLayout {\n return (\n options.layout ||\n new AccordionLayout({\n renderer: options.renderer || AccordionPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing,\n titleSpace: options.titleSpace\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n /**\n * Construct a new box layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: BoxLayout.IOptions = {}) {\n super();\n if (options.direction !== undefined) {\n this._direction = options.direction;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the layout direction for the box layout.\n */\n get direction(): BoxLayout.Direction {\n return this._direction;\n }\n\n /**\n * Set the layout direction for the box layout.\n */\n set direction(value: BoxLayout.Direction) {\n if (this._direction === value) {\n return;\n }\n this._direction = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['direction'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the box layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the box layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['direction'] = this.direction;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Create and add a new sizer for the widget.\n ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Move the sizer for the widget.\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Remove the sizer for the widget.\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Update the fixed space for the visible items.\n this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n // Setup the computed minimum size.\n let horz = Private.isHorizontal(this._direction);\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the size basis and stretch factor.\n sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n sizer.stretch = BoxLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Distribute the layout space and adjust the start position.\n let delta: number;\n switch (this._direction) {\n case 'left-to-right':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n break;\n case 'top-to-bottom':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n break;\n case 'right-to-left':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n left += width;\n break;\n case 'bottom-to-top':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n top += height;\n break;\n default:\n throw 'unreachable';\n }\n\n // Setup the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the computed size for the widget.\n let size = this._sizers[i].size;\n\n // Update the widget geometry and advance the relevant edge.\n switch (this._direction) {\n case 'left-to-right':\n item.update(left + offset, top, size + extra, height);\n left += size + extra + this._spacing;\n break;\n case 'top-to-bottom':\n item.update(left, top + offset, width, size + extra);\n top += size + extra + this._spacing;\n break;\n case 'right-to-left':\n item.update(left - offset - size - extra, top, size + extra, height);\n left -= size + extra + this._spacing;\n break;\n case 'bottom-to-top':\n item.update(left, top - offset - size - extra, width, size + extra);\n top -= size + extra + this._spacing;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: BoxLayout.Alignment = 'start';\n private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n /**\n * A type alias for a box layout direction.\n */\n export type Direction =\n | 'left-to-right'\n | 'right-to-left'\n | 'top-to-bottom'\n | 'bottom-to-top';\n\n /**\n * A type alias for a box layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a box layout.\n */\n export interface IOptions {\n /**\n * The direction of the layout.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * Get the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n\n /**\n * Get the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return Private.sizeBasisProperty.get(widget);\n }\n\n /**\n * Set the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n Private.sizeBasisProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * The property descriptor for a widget size basis.\n */\n export const sizeBasisProperty = new AttachedProperty({\n name: 'sizeBasis',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Test whether a direction has horizontal orientation.\n */\n export function isHorizontal(dir: BoxLayout.Direction): boolean {\n return dir === 'left-to-right' || dir === 'right-to-left';\n }\n\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n export function clampSpacing(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof BoxLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n /**\n * Construct a new box panel.\n *\n * @param options - The options for initializing the box panel.\n */\n constructor(options: BoxPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-BoxPanel');\n }\n\n /**\n * Get the layout direction for the box panel.\n */\n get direction(): BoxPanel.Direction {\n return (this.layout as BoxLayout).direction;\n }\n\n /**\n * Set the layout direction for the box panel.\n */\n set direction(value: BoxPanel.Direction) {\n (this.layout as BoxLayout).direction = value;\n }\n\n /**\n * Get the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxPanel.Alignment {\n return (this.layout as BoxLayout).alignment;\n }\n\n /**\n * Set the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxPanel.Alignment) {\n (this.layout as BoxLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the box panel.\n */\n get spacing(): number {\n return (this.layout as BoxLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the box panel.\n */\n set spacing(value: number) {\n (this.layout as BoxLayout).spacing = value;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-BoxPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-BoxPanel-child');\n }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n /**\n * A type alias for a box panel direction.\n */\n export type Direction = BoxLayout.Direction;\n\n /**\n * A type alias for a box panel alignment.\n */\n export type Alignment = BoxLayout.Alignment;\n\n /**\n * An options object for initializing a box panel.\n */\n export interface IOptions {\n /**\n * The layout direction of the panel.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The box layout to use for the box panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `BoxLayout`.\n */\n layout?: BoxLayout;\n }\n\n /**\n * Get the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return BoxLayout.getStretch(widget);\n }\n\n /**\n * Set the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n BoxLayout.setStretch(widget, value);\n }\n\n /**\n * Get the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return BoxLayout.getSizeBasis(widget);\n }\n\n /**\n * Set the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n BoxLayout.setSizeBasis(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a box layout for the given panel options.\n */\n export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n return options.layout || new BoxLayout(options);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n /**\n * Construct a new command palette.\n *\n * @param options - The options for initializing the palette.\n */\n constructor(options: CommandPalette.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-CommandPalette');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || CommandPalette.defaultRenderer;\n this.commands.commandChanged.connect(this._onGenericChange, this);\n this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._items.length = 0;\n this._results = null;\n super.dispose();\n }\n\n /**\n * The command registry used by the command palette.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the command palette.\n */\n readonly renderer: CommandPalette.IRenderer;\n\n /**\n * The command palette search node.\n *\n * #### Notes\n * This is the node which contains the search-related elements.\n */\n get searchNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-search'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The command palette input node.\n *\n * #### Notes\n * This is the actual input node for the search area.\n */\n get inputNode(): HTMLInputElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-input'\n )[0] as HTMLInputElement;\n }\n\n /**\n * The command palette content node.\n *\n * #### Notes\n * This is the node which holds the command item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * A read-only array of the command items in the palette.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Add a command item to the command palette.\n *\n * @param options - The options for creating the command item.\n *\n * @returns The command item added to the palette.\n */\n addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n // Create a new command item for the options.\n let item = Private.createItem(this.commands, options);\n\n // Add the item to the array.\n this._items.push(item);\n\n // Refresh the search results.\n this.refresh();\n\n // Return the item added to the palette.\n return item;\n }\n\n /**\n * Adds command items to the command palette.\n *\n * @param items - An array of options for creating each command item.\n *\n * @returns The command items added to the palette.\n */\n addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n const newItems = items.map(item => Private.createItem(this.commands, item));\n newItems.forEach(item => this._items.push(item));\n this.refresh();\n return newItems;\n }\n\n /**\n * Remove an item from the command palette.\n *\n * @param item - The item to remove from the palette.\n *\n * #### Notes\n * This is a no-op if the item is not in the palette.\n */\n removeItem(item: CommandPalette.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the command palette.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Remove all items from the command palette.\n */\n clearItems(): void {\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the array of items.\n this._items.length = 0;\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Clear the search results and schedule an update.\n *\n * #### Notes\n * This should be called whenever the search results of the palette\n * should be updated.\n *\n * This is typically called automatically by the palette as needed,\n * but can be called manually if the input text is programatically\n * changed.\n *\n * The rendered results are updated asynchronously.\n */\n refresh(): void {\n this._results = null;\n if (this.inputNode.value !== '') {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'inherit';\n } else {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'none';\n }\n this.update();\n }\n\n /**\n * Handle the DOM events for the command palette.\n *\n * @param event - The DOM event sent to the command palette.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the command palette's DOM node.\n * It should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'input':\n this.refresh();\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('input', this);\n this.node.addEventListener('focus', this, true);\n this.node.addEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('input', this);\n this.node.removeEventListener('focus', this, true);\n this.node.removeEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n */\n protected onAfterShow(msg: Message): void {\n this.update();\n super.onAfterShow(msg);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n let input = this.inputNode;\n input.focus();\n input.select();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.isHidden) {\n return;\n }\n\n // Fetch the current query text and content node.\n let query = this.inputNode.value;\n let contentNode = this.contentNode;\n\n // Ensure the search results are generated.\n let results = this._results;\n if (!results) {\n // Generate and store the new search results.\n results = this._results = Private.search(this._items, query);\n\n // Reset the active index.\n this._activeIndex = query\n ? ArrayExt.findFirstIndex(results, Private.canActivate)\n : -1;\n }\n\n // If there is no query and no results, clear the content.\n if (!query && results.length === 0) {\n VirtualDOM.render(null, contentNode);\n return;\n }\n\n // If the is a query but no results, render the empty message.\n if (query && results.length === 0) {\n let content = this.renderer.renderEmptyMessage({ query });\n VirtualDOM.render(content, contentNode);\n return;\n }\n\n // Create the render content for the search results.\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let content = new Array(results.length);\n for (let i = 0, n = results.length; i < n; ++i) {\n let result = results[i];\n if (result.type === 'header') {\n let indices = result.indices;\n let category = result.category;\n content[i] = renderer.renderHeader({ category, indices });\n } else {\n let item = result.item;\n let indices = result.indices;\n let active = i === activeIndex;\n content[i] = renderer.renderItem({ item, indices, active });\n }\n }\n\n // Render the search result content.\n VirtualDOM.render(content, contentNode);\n\n // Adjust the scroll position as needed.\n if (activeIndex < 0 || activeIndex >= results.length) {\n contentNode.scrollTop = 0;\n } else {\n let element = contentNode.children[activeIndex];\n ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n }\n }\n\n /**\n * Handle the `'click'` event for the command palette.\n */\n private _evtClick(event: MouseEvent): void {\n // Bail if the click is not the left button.\n if (event.button !== 0) {\n return;\n }\n\n // Clear input if the target is clear button\n if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n this.inputNode.value = '';\n this.refresh();\n return;\n }\n\n // Find the index of the item which was clicked.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return node.contains(event.target as HTMLElement);\n });\n\n // Bail if the click was not on an item.\n if (index === -1) {\n return;\n }\n\n // Kill the event when a content item is clicked.\n event.preventDefault();\n event.stopPropagation();\n\n // Execute the item if possible.\n this._execute(index);\n }\n\n /**\n * Handle the `'keydown'` event for the command palette.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n return;\n }\n switch (event.keyCode) {\n case 13: // Enter\n event.preventDefault();\n event.stopPropagation();\n this._execute(this._activeIndex);\n break;\n case 38: // Up Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activatePreviousItem();\n break;\n case 40: // Down Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activateNextItem();\n break;\n }\n }\n\n /**\n * Activate the next enabled command item.\n */\n private _activateNextItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the next enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this._activeIndex = ArrayExt.findFirstIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Activate the previous enabled command item.\n */\n private _activatePreviousItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the previous enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this._activeIndex = ArrayExt.findLastIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Execute the command item at the given index, if possible.\n */\n private _execute(index: number): void {\n // Bail if there are no search results.\n if (!this._results) {\n return;\n }\n\n // Bail if the index is out of range.\n let part = this._results[index];\n if (!part) {\n return;\n }\n\n // Update the search text if the item is a header.\n if (part.type === 'header') {\n let input = this.inputNode;\n input.value = `${part.category.toLowerCase()} `;\n input.focus();\n this.refresh();\n return;\n }\n\n // Bail if item is not enabled.\n if (!part.item.isEnabled) {\n return;\n }\n\n // Execute the item.\n this.commands.execute(part.item.command, part.item.args);\n\n // Clear the query text.\n this.inputNode.value = '';\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Toggle the focused modifier based on the input node focus state.\n */\n private _toggleFocused(): void {\n let focused = document.activeElement === this.inputNode;\n this.toggleClass('lm-mod-focused', focused);\n }\n\n /**\n * A signal handler for generic command changes.\n */\n private _onGenericChange(): void {\n this.refresh();\n }\n\n private _activeIndex = -1;\n private _items: CommandPalette.IItem[] = [];\n private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n /**\n * An options object for creating a command palette.\n */\n export interface IOptions {\n /**\n * The command registry for use with the command palette.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the command palette.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for creating a command item.\n */\n export interface IItemOptions {\n /**\n * The category for the item.\n */\n category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n command: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n *\n * The rank is used as a tie-breaker when ordering command items\n * for display. Items are sorted in the following order:\n * 1. Text match (lower is better)\n * 2. Category (locale order)\n * 3. Rank (lower is better)\n * 4. Label (locale order)\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n\n /**\n * An object which represents an item in a command palette.\n *\n * #### Notes\n * Item objects are created automatically by a command palette.\n */\n export interface IItem {\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n readonly label: string;\n\n /**\n * The display caption for the command item.\n */\n readonly caption: string;\n\n /**\n * The icon renderer for the command item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the command item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the command item.\n */\n readonly iconLabel: string;\n\n /**\n * The extra class name for the command item.\n */\n readonly className: string;\n\n /**\n * The dataset for the command item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the command item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the command item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the command item is toggleable.\n */\n readonly isToggleable: boolean;\n\n /**\n * Whether the command item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the command item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * The render data for a command palette header.\n */\n export interface IHeaderRenderData {\n /**\n * The category of the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched characters in the category.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * The render data for a command palette item.\n */\n export interface IItemRenderData {\n /**\n * The command palette item to render.\n */\n readonly item: IItem;\n\n /**\n * The indices of the matched characters in the label.\n */\n readonly indices: ReadonlyArray | null;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n }\n\n /**\n * The render data for a command palette empty message.\n */\n export interface IEmptyMessageRenderData {\n /**\n * The query which failed to match any commands.\n */\n query: string;\n }\n\n /**\n * A renderer for use with a command palette.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement;\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n *\n * #### Notes\n * The command palette will not render invisible items.\n */\n renderItem(data: IItemRenderData): VirtualElement;\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement {\n let content = this.formatHeader(data);\n return h.li({ className: 'lm-CommandPalette-header' }, content);\n }\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IItemRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n if (data.item.isToggleable) {\n return h.li(\n {\n className,\n dataset,\n role: 'menuitemcheckbox',\n 'aria-checked': `${data.item.isToggled}`\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n return h.li(\n {\n className,\n dataset,\n role: 'menuitem'\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n let content = this.formatEmptyMessage(data);\n return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n }\n\n /**\n * Render the icon for a command palette item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the icon.\n */\n renderItemIcon(data: IItemRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the content for a command palette item.\n *\n * @param data - The data to use for rendering the content.\n *\n * @returns A virtual element representing the content.\n */\n renderItemContent(data: IItemRenderData): VirtualElement {\n return h.div(\n { className: 'lm-CommandPalette-itemContent' },\n this.renderItemLabel(data),\n this.renderItemCaption(data)\n );\n }\n\n /**\n * Render the label for a command palette item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the label.\n */\n renderItemLabel(data: IItemRenderData): VirtualElement {\n let content = this.formatItemLabel(data);\n return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n }\n\n /**\n * Render the caption for a command palette item.\n *\n * @param data - The data to use for rendering the caption.\n *\n * @returns A virtual element representing the caption.\n */\n renderItemCaption(data: IItemRenderData): VirtualElement {\n let content = this.formatItemCaption(data);\n return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n }\n\n /**\n * Render the shortcut for a command palette item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the shortcut.\n */\n renderItemShortcut(data: IItemRenderData): VirtualElement {\n let content = this.formatItemShortcut(data);\n return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n }\n\n /**\n * Create the class name for the command palette item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the command palette item.\n */\n createItemClass(data: IItemRenderData): string {\n // Set up the initial class name.\n let name = 'lm-CommandPalette-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the command palette item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the command palette item.\n */\n createItemDataset(data: IItemRenderData): ElementDataset {\n return { ...data.item.dataset, command: data.item.command };\n }\n\n /**\n * Create the class name for the command item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IItemRenderData): string {\n let name = 'lm-CommandPalette-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the header node.\n *\n * @param data - The data to use for the header content.\n *\n * @returns The content to add to the header node.\n */\n formatHeader(data: IHeaderRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.category;\n }\n return StringExt.highlight(data.category, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the empty message node.\n *\n * @param data - The data to use for the empty message content.\n *\n * @returns The content to add to the empty message node.\n */\n formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n return `No commands found that match '${data.query}'`;\n }\n\n /**\n * Create the render content for the item shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatItemShortcut(data: IItemRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n\n /**\n * Create the render content for the item label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatItemLabel(data: IItemRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.item.label;\n }\n return StringExt.highlight(data.item.label, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the item caption node.\n *\n * @param data - The data to use for the caption content.\n *\n * @returns The content to add to the caption node.\n */\n formatItemCaption(data: IItemRenderData): h.Child {\n return data.item.caption;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a command palette.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let search = document.createElement('div');\n let wrapper = document.createElement('div');\n let input = document.createElement('input');\n let content = document.createElement('ul');\n let clear = document.createElement('button');\n search.className = 'lm-CommandPalette-search';\n wrapper.className = 'lm-CommandPalette-wrapper';\n input.className = 'lm-CommandPalette-input';\n clear.className = 'lm-close-icon';\n\n content.className = 'lm-CommandPalette-content';\n content.setAttribute('role', 'menu');\n input.spellcheck = false;\n wrapper.appendChild(input);\n wrapper.appendChild(clear);\n search.appendChild(wrapper);\n node.appendChild(search);\n node.appendChild(content);\n return node;\n }\n\n /**\n * Create a new command item from a command registry and options.\n */\n export function createItem(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ): CommandPalette.IItem {\n return new CommandItem(commands, options);\n }\n\n /**\n * A search result object for a header label.\n */\n export interface IHeaderResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'header';\n\n /**\n * The category for the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched category characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A search result object for a command item.\n */\n export interface IItemResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'item';\n\n /**\n * The command item which was matched.\n */\n readonly item: CommandPalette.IItem;\n\n /**\n * The indices of the matched label characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A type alias for a search result item.\n */\n export type SearchResult = IHeaderResult | IItemResult;\n\n /**\n * Search an array of command items for fuzzy matches.\n */\n export function search(\n items: CommandPalette.IItem[],\n query: string\n ): SearchResult[] {\n // Fuzzy match the items for the query.\n let scores = matchItems(items, query);\n\n // Sort the items based on their score.\n scores.sort(scoreCmp);\n\n // Create the results for the search.\n return createResults(scores);\n }\n\n /**\n * Test whether a result item can be activated.\n */\n export function canActivate(result: SearchResult): boolean {\n return result.type === 'item' && result.item.isEnabled;\n }\n\n /**\n * Normalize a category for a command item.\n */\n function normalizeCategory(category: string): string {\n return category.trim().replace(/\\s+/g, ' ');\n }\n\n /**\n * Normalize the query text for a fuzzy search.\n */\n function normalizeQuery(text: string): string {\n return text.replace(/\\s+/g, '').toLowerCase();\n }\n\n /**\n * An enum of the supported match types.\n */\n const enum MatchType {\n Label,\n Category,\n Split,\n Default\n }\n\n /**\n * A text match score with associated command item.\n */\n interface IScore {\n /**\n * The numerical type for the text match.\n */\n matchType: MatchType;\n\n /**\n * The numerical score for the text match.\n */\n score: number;\n\n /**\n * The indices of the matched category characters.\n */\n categoryIndices: number[] | null;\n\n /**\n * The indices of the matched label characters.\n */\n labelIndices: number[] | null;\n\n /**\n * The command item associated with the match.\n */\n item: CommandPalette.IItem;\n }\n\n /**\n * Perform a fuzzy match on an array of command items.\n */\n function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n // Normalize the query text to lower case with no whitespace.\n query = normalizeQuery(query);\n\n // Create the array to hold the scores.\n let scores: IScore[] = [];\n\n // Iterate over the items and match against the query.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Ignore items which are not visible.\n let item = items[i];\n if (!item.isVisible) {\n continue;\n }\n\n // If the query is empty, all items are matched by default.\n if (!query) {\n scores.push({\n matchType: MatchType.Default,\n categoryIndices: null,\n labelIndices: null,\n score: 0,\n item\n });\n continue;\n }\n\n // Run the fuzzy search for the item and query.\n let score = fuzzySearch(item, query);\n\n // Ignore the item if it is not a match.\n if (!score) {\n continue;\n }\n\n // Penalize disabled items.\n // TODO - push disabled items all the way down in sort cmp?\n if (!item.isEnabled) {\n score.score += 1000;\n }\n\n // Add the score to the results.\n scores.push(score);\n }\n\n // Return the final array of scores.\n return scores;\n }\n\n /**\n * Perform a fuzzy search on a single command item.\n */\n function fuzzySearch(\n item: CommandPalette.IItem,\n query: string\n ): IScore | null {\n // Create the source text to be searched.\n let category = item.category.toLowerCase();\n let label = item.label.toLowerCase();\n let source = `${category} ${label}`;\n\n // Set up the match score and indices array.\n let score = Infinity;\n let indices: number[] | null = null;\n\n // The regex for search word boundaries\n let rgx = /\\b\\w/g;\n\n // Search the source by word boundary.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Find the next word boundary in the source.\n let rgxMatch = rgx.exec(source);\n\n // Break if there is no more source context.\n if (!rgxMatch) {\n break;\n }\n\n // Run the string match on the relevant substring.\n let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n // Break if there is no match.\n if (!match) {\n break;\n }\n\n // Update the match if the score is better.\n if (match.score <= score) {\n score = match.score;\n indices = match.indices;\n }\n }\n\n // Bail if there was no match.\n if (!indices || score === Infinity) {\n return null;\n }\n\n // Compute the pivot index between category and label text.\n let pivot = category.length + 1;\n\n // Find the slice index to separate matched indices.\n let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n // Extract the matched category and label indices.\n let categoryIndices = indices.slice(0, j);\n let labelIndices = indices.slice(j);\n\n // Adjust the label indices for the pivot offset.\n for (let i = 0, n = labelIndices.length; i < n; ++i) {\n labelIndices[i] -= pivot;\n }\n\n // Handle a pure label match.\n if (categoryIndices.length === 0) {\n return {\n matchType: MatchType.Label,\n categoryIndices: null,\n labelIndices,\n score,\n item\n };\n }\n\n // Handle a pure category match.\n if (labelIndices.length === 0) {\n return {\n matchType: MatchType.Category,\n categoryIndices,\n labelIndices: null,\n score,\n item\n };\n }\n\n // Handle a split match.\n return {\n matchType: MatchType.Split,\n categoryIndices,\n labelIndices,\n score,\n item\n };\n }\n\n /**\n * A sort comparison function for a match score.\n */\n function scoreCmp(a: IScore, b: IScore): number {\n // First compare based on the match type\n let m1 = a.matchType - b.matchType;\n if (m1 !== 0) {\n return m1;\n }\n\n // Otherwise, compare based on the match score.\n let d1 = a.score - b.score;\n if (d1 !== 0) {\n return d1;\n }\n\n // Find the match index based on the match type.\n let i1 = 0;\n let i2 = 0;\n switch (a.matchType) {\n case MatchType.Label:\n i1 = a.labelIndices![0];\n i2 = b.labelIndices![0];\n break;\n case MatchType.Category:\n case MatchType.Split:\n i1 = a.categoryIndices![0];\n i2 = b.categoryIndices![0];\n break;\n }\n\n // Compare based on the match index.\n if (i1 !== i2) {\n return i1 - i2;\n }\n\n // Otherwise, compare by category.\n let d2 = a.item.category.localeCompare(b.item.category);\n if (d2 !== 0) {\n return d2;\n }\n\n // Otherwise, compare by rank.\n let r1 = a.item.rank;\n let r2 = b.item.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity safe\n }\n\n // Finally, compare by label.\n return a.item.label.localeCompare(b.item.label);\n }\n\n /**\n * Create the results from an array of sorted scores.\n */\n function createResults(scores: IScore[]): SearchResult[] {\n // Set up the search results array.\n let results: SearchResult[] = [];\n\n // Iterate over each score in the array.\n for (let i = 0, n = scores.length; i < n; ++i) {\n // Extract the current item and indices.\n let { item, categoryIndices, labelIndices } = scores[i];\n\n // Extract the category for the current item.\n let category = item.category;\n\n // Is this the same category as the preceding result?\n if (i === 0 || category !== scores[i - 1].item.category) {\n // Add the header result for the category.\n results.push({ type: 'header', category, indices: categoryIndices });\n }\n\n // Create the item result for the score.\n results.push({ type: 'item', item, indices: labelIndices });\n }\n\n // Return the final results.\n return results;\n }\n\n /**\n * A concrete implementation of `CommandPalette.IItem`.\n */\n class CommandItem implements CommandPalette.IItem {\n /**\n * Construct a new command item.\n */\n constructor(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ) {\n this._commands = commands;\n this.category = normalizeCategory(options.category);\n this.command = options.command;\n this.args = options.args || JSONExt.emptyObject;\n this.rank = options.rank !== undefined ? options.rank : Infinity;\n }\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n get label(): string {\n return this._commands.label(this.command, this.args);\n }\n\n /**\n * The icon renderer for the command item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._commands.icon(this.command, this.args);\n }\n\n /**\n * The icon class for the command item.\n */\n get iconClass(): string {\n return this._commands.iconClass(this.command, this.args);\n }\n\n /**\n * The icon label for the command item.\n */\n get iconLabel(): string {\n return this._commands.iconLabel(this.command, this.args);\n }\n\n /**\n * The display caption for the command item.\n */\n get caption(): string {\n return this._commands.caption(this.command, this.args);\n }\n\n /**\n * The extra class name for the command item.\n */\n get className(): string {\n return this._commands.className(this.command, this.args);\n }\n\n /**\n * The dataset for the command item.\n */\n get dataset(): CommandRegistry.Dataset {\n return this._commands.dataset(this.command, this.args);\n }\n\n /**\n * Whether the command item is enabled.\n */\n get isEnabled(): boolean {\n return this._commands.isEnabled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggled.\n */\n get isToggled(): boolean {\n return this._commands.isToggled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggleable.\n */\n get isToggleable(): boolean {\n return this._commands.isToggleable(this.command, this.args);\n }\n\n /**\n * Whether the command item is visible.\n */\n get isVisible(): boolean {\n return this._commands.isVisible(this.command, this.args);\n }\n\n /**\n * The key binding for the command item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ARIAAttrNames,\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n pageXOffset: number;\n pageYOffset: number;\n clientWidth: number;\n clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n /**\n * Construct a new menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: Menu.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-Menu');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || Menu.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the menu.\n */\n dispose(): void {\n this.close();\n this._items.length = 0;\n super.dispose();\n }\n\n /**\n * A signal emitted just before the menu is closed.\n *\n * #### Notes\n * This signal is emitted when the menu receives a `'close-request'`\n * message, just before it removes itself from the DOM.\n *\n * This signal is not emitted if the menu is already detached from\n * the DOM when it receives the `'close-request'` message.\n */\n get aboutToClose(): ISignal {\n return this._aboutToClose;\n }\n\n /**\n * A signal emitted when a new menu is requested by the user.\n *\n * #### Notes\n * This signal is emitted whenever the user presses the right or left\n * arrow keys, and a submenu cannot be opened or closed in response.\n *\n * This signal is useful when implementing menu bars in order to open\n * the next or previous menu in response to a user key press.\n *\n * This signal is only emitted for the root menu in a hierarchy.\n */\n get menuRequested(): ISignal {\n return this._menuRequested;\n }\n\n /**\n * The command registry used by the menu.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the menu.\n */\n readonly renderer: Menu.IRenderer;\n\n /**\n * The parent menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu is an open submenu.\n */\n get parentMenu(): Menu | null {\n return this._parentMenu;\n }\n\n /**\n * The child menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu has an open submenu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The root menu of the menu hierarchy.\n */\n get rootMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._parentMenu) {\n menu = menu._parentMenu;\n }\n return menu;\n }\n\n /**\n * The leaf menu of the menu hierarchy.\n */\n get leafMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._childMenu) {\n menu = menu._childMenu;\n }\n return menu;\n }\n\n /**\n * The menu content node.\n *\n * #### Notes\n * This is the node which holds the menu item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-Menu-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu item.\n */\n get activeItem(): Menu.IItem | null {\n return this._items[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the item will be set to `null`.\n */\n set activeItem(value: Menu.IItem | null) {\n this.activeIndex = value ? this._items.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu item.\n *\n * #### Notes\n * This will be `-1` if no menu item is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._items.length) {\n value = -1;\n }\n\n // Ensure the item can be activated.\n if (value !== -1 && !Private.canActivate(this._items[value])) {\n value = -1;\n }\n\n // Bail if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Make active element in focus\n if (\n this._activeIndex >= 0 &&\n this.contentNode.childNodes[this._activeIndex]\n ) {\n (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n }\n\n // schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menu items in the menu.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Activate the next selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activateNextItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this.activeIndex = ArrayExt.findFirstIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Activate the previous selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activatePreviousItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this.activeIndex = ArrayExt.findLastIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Trigger the active menu item.\n *\n * #### Notes\n * If the active item is a submenu, it will be opened and the first\n * item will be activated.\n *\n * If the active item is a command, the command will be executed.\n *\n * If the menu is not attached, this is a no-op.\n *\n * If there is no active item, this is a no-op.\n */\n triggerActiveItem(): void {\n // Bail if the menu is not attached.\n if (!this.isAttached) {\n return;\n }\n\n // Bail if there is no active item.\n let item = this.activeItem;\n if (!item) {\n return;\n }\n\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // If the item is a submenu, open it.\n if (item.type === 'submenu') {\n this._openChildMenu(true);\n return;\n }\n\n // Close the root menu before executing the command.\n this.rootMenu.close();\n\n // Execute the command for the item.\n let { command, args } = item;\n if (this.commands.isEnabled(command, args)) {\n this.commands.execute(command, args);\n } else {\n console.log(`Command '${command}' is disabled.`);\n }\n }\n\n /**\n * Add a menu item to the end of the menu.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n */\n addItem(options: Menu.IItemOptions): Menu.IItem {\n return this.insertItem(this._items.length, options);\n }\n\n /**\n * Insert a menu item into the menu at the specified index.\n *\n * @param index - The index at which to insert the item.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n *\n * #### Notes\n * The index will be clamped to the bounds of the items.\n */\n insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Clamp the insert index to the array bounds.\n let i = Math.max(0, Math.min(index, this._items.length));\n\n // Create the item for the options.\n let item = Private.createItem(this, options);\n\n // Insert the item into the array.\n ArrayExt.insert(this._items, i, item);\n\n // Schedule an update of the items.\n this.update();\n\n // Return the item added to the menu.\n return item;\n }\n\n /**\n * Remove an item from the menu.\n *\n * @param item - The item to remove from the menu.\n *\n * #### Notes\n * This is a no-op if the item is not in the menu.\n */\n removeItem(item: Menu.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the menu.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Remove all menu items from the menu.\n */\n clearItems(): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the items.\n this._items.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Open the menu at the specified location.\n *\n * @param x - The client X coordinate of the menu location.\n *\n * @param y - The client Y coordinate of the menu location.\n *\n * @param options - The additional options for opening the menu.\n *\n * #### Notes\n * The menu will be opened at the given location unless it will not\n * fully fit on the screen. If it will not fit, it will be adjusted\n * to fit naturally on the screen.\n *\n * The menu will be attached under the `host` element in the DOM\n * (or `document.body` if `host` is `null`) and before the `ref`\n * element (or as the last child of `host` if `ref` is `null`).\n * The menu may be displayed outside of the `host` element\n * following the rules of CSS absolute positioning.\n *\n * This is a no-op if the menu is already attached to the DOM.\n */\n open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n // Bail early if the menu is already attached.\n if (this.isAttached) {\n return;\n }\n\n // Extract the menu options.\n let forceX = options.forceX || false;\n let forceY = options.forceY || false;\n const host = options.host ?? null;\n const ref = options.ref ?? null;\n\n // Open the menu as a root menu.\n Private.openRootMenu(this, x, y, forceX, forceY, host, ref);\n\n // Activate the menu to accept keyboard input.\n this.activate();\n }\n\n /**\n * Handle the DOM events for the menu.\n *\n * @param event - The DOM event sent to the menu.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu's DOM nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseenter':\n this._evtMouseEnter(event as MouseEvent);\n break;\n case 'mouseleave':\n this._evtMouseLeave(event as MouseEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mouseup', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseenter', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('contextmenu', this);\n document.addEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mouseup', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseenter', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('contextmenu', this);\n document.removeEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this.node.focus();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let items = this._items;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let collapsedFlags = Private.computeCollapsed(items);\n let content = new Array(items.length);\n for (let i = 0, n = items.length; i < n; ++i) {\n let item = items[i];\n let active = i === activeIndex;\n let collapsed = collapsedFlags[i];\n content[i] = renderer.renderItem({\n item,\n active,\n collapsed,\n onfocus: () => {\n this.activeIndex = i;\n }\n });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n */\n protected onCloseRequest(msg: Message): void {\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Close any open child menu.\n let childMenu = this._childMenu;\n if (childMenu) {\n this._childIndex = -1;\n this._childMenu = null;\n childMenu._parentMenu = null;\n childMenu.close();\n }\n\n // Remove this menu from its parent and activate the parent.\n let parentMenu = this._parentMenu;\n if (parentMenu) {\n this._parentMenu = null;\n parentMenu._childIndex = -1;\n parentMenu._childMenu = null;\n parentMenu.activate();\n }\n\n // Emit the `aboutToClose` signal if the menu is attached.\n if (this.isAttached) {\n this._aboutToClose.emit(undefined);\n }\n\n // Finish closing the menu.\n super.onCloseRequest(msg);\n }\n\n /**\n * Handle the `'keydown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // A menu handles all keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Enter\n if (kc === 13) {\n this.triggerActiveItem();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this.close();\n return;\n }\n\n // Left Arrow\n if (kc === 37) {\n if (this._parentMenu) {\n this.close();\n } else {\n this._menuRequested.emit('previous');\n }\n return;\n }\n\n // Up Arrow\n if (kc === 38) {\n this.activatePreviousItem();\n return;\n }\n\n // Right Arrow\n if (kc === 39) {\n let item = this.activeItem;\n if (item && item.type === 'submenu') {\n this.triggerActiveItem();\n } else {\n this.rootMenu._menuRequested.emit('next');\n }\n return;\n }\n\n // Down Arrow\n if (kc === 40) {\n this.activateNextItem();\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._items, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that item is triggered.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.triggerActiveItem();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n }\n }\n\n /**\n * Handle the `'mouseup'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseUp(event: MouseEvent): void {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.triggerActiveItem();\n }\n\n /**\n * Handle the `'mousemove'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Hit test the item nodes for the item under the mouse.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the mouse is already over the active index.\n if (index === this._activeIndex) {\n return;\n }\n\n // Update and coerce the active index.\n this.activeIndex = index;\n index = this.activeIndex;\n\n // If the index is the current child index, cancel the timers.\n if (index === this._childIndex) {\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n return;\n }\n\n // If a child menu is currently open, start the close timer.\n if (this._childIndex !== -1) {\n this._startCloseTimer();\n }\n\n // Cancel the open timer to give a full delay for opening.\n this._cancelOpenTimer();\n\n // Bail if the active item is not a valid submenu item.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n return;\n }\n\n // Start the open timer to open the active item submenu.\n this._startOpenTimer();\n }\n\n /**\n * Handle the `'mouseenter'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseEnter(event: MouseEvent): void {\n // Synchronize the active ancestor items.\n for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n menu._cancelOpenTimer();\n menu._cancelCloseTimer();\n menu.activeIndex = menu._childIndex;\n }\n }\n\n /**\n * Handle the `'mouseleave'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseLeave(event: MouseEvent): void {\n // Cancel any pending submenu opening.\n this._cancelOpenTimer();\n\n // If there is no open child menu, just reset the active index.\n if (!this._childMenu) {\n this.activeIndex = -1;\n return;\n }\n\n // If the mouse is over the child menu, cancel the close timer.\n let { clientX, clientY } = event;\n if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n this._cancelCloseTimer();\n return;\n }\n\n // Otherwise, reset the active index and start the close timer.\n this.activeIndex = -1;\n this._startCloseTimer();\n }\n\n /**\n * Handle the `'mousedown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the document node.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the menu is not a root menu.\n if (this._parentMenu) {\n return;\n }\n\n // The mouse button which is pressed is irrelevant. If the press\n // is not on a menu, the entire hierarchy is closed and the event\n // is allowed to propagate. This allows other code to act on the\n // event, such as focusing the clicked element.\n if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n event.preventDefault();\n event.stopPropagation();\n } else {\n this.close();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if the active item is not a valid submenu.\n */\n private _openChildMenu(activateFirst = false): void {\n // If the item is not a valid submenu, close the child menu.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n this._closeChildMenu();\n return;\n }\n\n // Do nothing if the child menu will not change.\n let submenu = item.submenu;\n if (submenu === this._childMenu) {\n return;\n }\n\n // Prior to any DOM modifications save window data\n Menu.saveWindowData();\n\n // Ensure the current child menu is closed.\n this._closeChildMenu();\n\n // Update the private child state.\n this._childMenu = submenu;\n this._childIndex = this._activeIndex;\n\n // Set the parent menu reference for the child.\n submenu._parentMenu = this;\n\n // Ensure the menu is updated and lookup the item node.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n let itemNode = this.contentNode.children[this._activeIndex];\n\n // Open the submenu at the active node.\n Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n // Activate the first item if desired.\n if (activateFirst) {\n submenu.activeIndex = -1;\n submenu.activateNextItem();\n }\n\n // Activate the child menu.\n submenu.activate();\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n if (this._childMenu) {\n this._childMenu.close();\n }\n }\n\n /**\n * Start the open timer, unless it is already pending.\n */\n private _startOpenTimer(): void {\n if (this._openTimerID === 0) {\n this._openTimerID = window.setTimeout(() => {\n this._openTimerID = 0;\n this._openChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Start the close timer, unless it is already pending.\n */\n private _startCloseTimer(): void {\n if (this._closeTimerID === 0) {\n this._closeTimerID = window.setTimeout(() => {\n this._closeTimerID = 0;\n this._closeChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Cancel the open timer, if the timer is pending.\n */\n private _cancelOpenTimer(): void {\n if (this._openTimerID !== 0) {\n clearTimeout(this._openTimerID);\n this._openTimerID = 0;\n }\n }\n\n /**\n * Cancel the close timer, if the timer is pending.\n */\n private _cancelCloseTimer(): void {\n if (this._closeTimerID !== 0) {\n clearTimeout(this._closeTimerID);\n this._closeTimerID = 0;\n }\n }\n\n /**\n * Save window data used for menu positioning in transient cache.\n *\n * In order to avoid layout trashing it is recommended to invoke this\n * method immediately prior to opening the menu and any DOM modifications\n * (like closing previously visible menu, or adding a class to menu widget).\n *\n * The transient cache will be released upon `open()` call.\n */\n static saveWindowData(): void {\n Private.saveWindowData();\n }\n\n private _childIndex = -1;\n private _activeIndex = -1;\n private _openTimerID = 0;\n private _closeTimerID = 0;\n private _items: Menu.IItem[] = [];\n private _childMenu: Menu | null = null;\n private _parentMenu: Menu | null = null;\n private _aboutToClose = new Signal(this);\n private _menuRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n /**\n * An options object for creating a menu.\n */\n export interface IOptions {\n /**\n * The command registry for use with the menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the menu.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for the `open` method on a menu.\n */\n export interface IOpenOptions {\n /**\n * Whether to force the X position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * X coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceX?: boolean;\n\n /**\n * Whether to force the Y position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * Y coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceY?: boolean;\n\n /**\n * The DOM node to use as the menu's host.\n *\n * If not specified then uses `document.body`.\n */\n host?: HTMLElement;\n\n /**\n * The child of `host` to use as the reference element.\n * If this is provided, the menu will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * menu to be added as the last child of the host.\n */\n ref?: HTMLElement;\n }\n\n /**\n * A type alias for a menu item type.\n */\n export type ItemType = 'command' | 'submenu' | 'separator';\n\n /**\n * An options object for creating a menu item.\n */\n export interface IItemOptions {\n /**\n * The type of the menu item.\n *\n * The default value is `'command'`.\n */\n type?: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n *\n * The default value is an empty string.\n */\n command?: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n *\n * The default value is `null`.\n */\n submenu?: Menu | null;\n }\n\n /**\n * An object which represents a menu item.\n *\n * #### Notes\n * Item objects are created automatically by a menu.\n */\n export interface IItem {\n /**\n * The type of the menu item.\n */\n readonly type: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n readonly label: string;\n\n /**\n * The mnemonic index for the menu item.\n */\n readonly mnemonic: number;\n\n /**\n * The icon renderer for the menu item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the menu item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the menu item.\n */\n readonly iconLabel: string;\n\n /**\n * The display caption for the menu item.\n */\n readonly caption: string;\n\n /**\n * The extra class name for the menu item.\n */\n readonly className: string;\n\n /**\n * The dataset for the menu item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the menu item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the menu item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the menu item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the menu item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * An object which holds the data to render a menu item.\n */\n export interface IRenderData {\n /**\n * The item to be rendered.\n */\n readonly item: IItem;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the item should be collapsed.\n */\n readonly collapsed: boolean;\n\n /**\n * Handler for when element is in focus.\n */\n readonly onfocus?: () => void;\n }\n\n /**\n * A renderer for use with a menu.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n tabindex: '0',\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderShortcut(data),\n this.renderSubmenu(data)\n );\n }\n\n /**\n * Render the icon element for a menu item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-Menu-itemLabel' }, content);\n }\n\n /**\n * Render the shortcut element for a menu item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the item shortcut.\n */\n renderShortcut(data: IRenderData): VirtualElement {\n let content = this.formatShortcut(data);\n return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n }\n\n /**\n * Render the submenu icon element for a menu item.\n *\n * @param data - The data to use for rendering the submenu icon.\n *\n * @returns A virtual element representing the submenu icon.\n */\n renderSubmenu(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n }\n\n /**\n * Create the class name for the menu item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n // Setup the initial class name.\n let name = 'lm-Menu-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (!data.item.isVisible) {\n name += ' lm-mod-hidden';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n if (data.collapsed) {\n name += ' lm-mod-collapsed';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the menu item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the menu item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n let result: ElementDataset;\n let { type, command, dataset } = data.item;\n if (type === 'command') {\n result = { ...dataset, type, command };\n } else {\n result = { ...dataset, type };\n }\n return result;\n }\n\n /**\n * Create the class name for the menu item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-Menu-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the aria attributes for menu item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n let aria: { [T in ARIAAttrNames]?: string } = {};\n switch (data.item.type) {\n case 'separator':\n aria.role = 'presentation';\n break;\n case 'submenu':\n aria['aria-haspopup'] = 'true';\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n break;\n default:\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n aria.role = 'menuitem';\n }\n return aria;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.item;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n\n /**\n * Create the render content for the shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatShortcut(data: IRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The ms delay for opening and closing a submenu.\n */\n export const TIMER_DELAY = 300;\n\n /**\n * The horizontal pixel overlap for an open submenu.\n */\n export const SUBMENU_OVERLAP = 3;\n\n let transientWindowDataCache: IWindowData | null = null;\n let transientCacheCounter: number = 0;\n\n function getWindowData(): IWindowData {\n // if transient cache is in use, take one from it\n if (transientCacheCounter > 0) {\n transientCacheCounter--;\n return transientWindowDataCache!;\n }\n return _getWindowData();\n }\n\n /**\n * Store window data in transient cache.\n *\n * The transient cache will be released upon `getWindowData()` call.\n * If this function is called multiple times, the cache will be\n * retained until as many calls to `getWindowData()` were made.\n *\n * Note: should be called before any DOM modifications.\n */\n export function saveWindowData(): void {\n transientWindowDataCache = _getWindowData();\n transientCacheCounter++;\n }\n\n /**\n * Create the DOM node for a menu.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-Menu-content';\n node.appendChild(content);\n content.setAttribute('role', 'menu');\n node.tabIndex = 0;\n return node;\n }\n\n /**\n * Test whether a menu item can be activated.\n */\n export function canActivate(item: Menu.IItem): boolean {\n return item.type !== 'separator' && item.isEnabled && item.isVisible;\n }\n\n /**\n * Create a new menu item for an owner menu.\n */\n export function createItem(\n owner: Menu,\n options: Menu.IItemOptions\n ): Menu.IItem {\n return new MenuItem(owner.commands, options);\n }\n\n /**\n * Hit test a menu hierarchy starting at the given root.\n */\n export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n if (ElementExt.hitTest(temp.node, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Compute which extra separator items should be collapsed.\n */\n export function computeCollapsed(\n items: ReadonlyArray\n ): boolean[] {\n // Allocate the return array and fill it with `false`.\n let result = new Array(items.length);\n ArrayExt.fill(result, false);\n\n // Collapse the leading separators.\n let k1 = 0;\n let n = items.length;\n for (; k1 < n; ++k1) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k1] = true;\n }\n\n // Hide the trailing separators.\n let k2 = n - 1;\n for (; k2 >= 0; --k2) {\n let item = items[k2];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k2] = true;\n }\n\n // Hide the remaining consecutive separators.\n let hide = false;\n while (++k1 < k2) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n hide = false;\n } else if (hide) {\n result[k1] = true;\n } else {\n hide = true;\n }\n }\n\n // Return the resulting flags.\n return result;\n }\n\n function _getWindowData(): IWindowData {\n return {\n pageXOffset: window.pageXOffset,\n pageYOffset: window.pageYOffset,\n clientWidth: document.documentElement.clientWidth,\n clientHeight: document.documentElement.clientHeight\n };\n }\n\n /**\n * Open a menu as a root menu at the target location.\n */\n export function openRootMenu(\n menu: Menu,\n x: number,\n y: number,\n forceX: boolean,\n forceY: boolean,\n host: HTMLElement | null,\n ref: HTMLElement | null\n ): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before attaching and measuring.\n MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch - (forceY ? y : 0);\n\n // Fetch common variables.\n let node = menu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(menu, host || document.body, ref);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Adjust the X position of the menu to fit on-screen.\n if (!forceX && x + width > px + cw) {\n x = px + cw - width;\n }\n\n // Adjust the Y position of the menu to fit on-screen.\n if (!forceY && y + height > py + ch) {\n if (y > py + ch) {\n y = py + ch - height;\n } else {\n y = y - height;\n }\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * Open a menu as a submenu using an item node for positioning.\n */\n export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before opening.\n MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch;\n\n // Fetch common variables.\n let node = submenu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(submenu, document.body);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Compute the box sizing for the menu.\n let box = ElementExt.boxSizing(submenu.node);\n\n // Get the bounding rect for the target item node.\n let itemRect = itemNode.getBoundingClientRect();\n\n // Compute the target X position.\n let x = itemRect.right - SUBMENU_OVERLAP;\n\n // Adjust the X position to fit on the screen.\n if (x + width > px + cw) {\n x = itemRect.left + SUBMENU_OVERLAP - width;\n }\n\n // Compute the target Y position.\n let y = itemRect.top - box.borderTop - box.paddingTop;\n\n // Adjust the Y position to fit on the screen.\n if (y + height > py + ch) {\n y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n items: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Lookup the item\n let item = items[k];\n\n // Ignore items which cannot be activated.\n if (!canActivate(item)) {\n continue;\n }\n\n // Ignore items with an empty label.\n let label = item.label;\n if (label.length === 0) {\n continue;\n }\n\n // Lookup the mnemonic index for the label.\n let mn = item.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < label.length) {\n if (label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n\n /**\n * A concrete implementation of `Menu.IItem`.\n */\n class MenuItem implements Menu.IItem {\n /**\n * Construct a new menu item.\n */\n constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n this._commands = commands;\n this.type = options.type || 'command';\n this.command = options.command || '';\n this.args = options.args || JSONExt.emptyObject;\n this.submenu = options.submenu || null;\n }\n\n /**\n * The type of the menu item.\n */\n readonly type: Menu.ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n get label(): string {\n if (this.type === 'command') {\n return this._commands.label(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.label;\n }\n return '';\n }\n\n /**\n * The mnemonic index for the menu item.\n */\n get mnemonic(): number {\n if (this.type === 'command') {\n return this._commands.mnemonic(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.mnemonic;\n }\n return -1;\n }\n\n /**\n * The icon renderer for the menu item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n if (this.type === 'command') {\n return this._commands.icon(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.icon;\n }\n return undefined;\n }\n\n /**\n * The icon class for the menu item.\n */\n get iconClass(): string {\n if (this.type === 'command') {\n return this._commands.iconClass(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconClass;\n }\n return '';\n }\n\n /**\n * The icon label for the menu item.\n */\n get iconLabel(): string {\n if (this.type === 'command') {\n return this._commands.iconLabel(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconLabel;\n }\n return '';\n }\n\n /**\n * The display caption for the menu item.\n */\n get caption(): string {\n if (this.type === 'command') {\n return this._commands.caption(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.caption;\n }\n return '';\n }\n\n /**\n * The extra class name for the menu item.\n */\n get className(): string {\n if (this.type === 'command') {\n return this._commands.className(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.className;\n }\n return '';\n }\n\n /**\n * The dataset for the menu item.\n */\n get dataset(): CommandRegistry.Dataset {\n if (this.type === 'command') {\n return this._commands.dataset(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.dataset;\n }\n return {};\n }\n\n /**\n * Whether the menu item is enabled.\n */\n get isEnabled(): boolean {\n if (this.type === 'command') {\n return this._commands.isEnabled(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * Whether the menu item is toggled.\n */\n get isToggled(): boolean {\n if (this.type === 'command') {\n return this._commands.isToggled(this.command, this.args);\n }\n return false;\n }\n\n /**\n * Whether the menu item is visible.\n */\n get isVisible(): boolean {\n if (this.type === 'command') {\n return this._commands.isVisible(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * The key binding for the menu item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n if (this.type === 'command') {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n return null;\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n /**\n * Construct a new context menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: ContextMenu.IOptions) {\n const { groupByTarget, sortBySelector, ...others } = options;\n this.menu = new Menu(others);\n this._groupByTarget = groupByTarget !== false;\n this._sortBySelector = sortBySelector !== false;\n }\n\n /**\n * The menu widget which displays the matched context items.\n */\n readonly menu: Menu;\n\n /**\n * Add an item to the context menu.\n *\n * @param options - The options for creating the item.\n *\n * @returns A disposable which will remove the item from the menu.\n */\n addItem(options: ContextMenu.IItemOptions): IDisposable {\n // Create an item from the given options.\n let item = Private.createItem(options, this._idTick++);\n\n // Add the item to the internal array.\n this._items.push(item);\n\n // Return a disposable which will remove the item.\n return new DisposableDelegate(() => {\n ArrayExt.removeFirstOf(this._items, item);\n });\n }\n\n /**\n * Open the context menu in response to a `'contextmenu'` event.\n *\n * @param event - The `'contextmenu'` event of interest.\n *\n * @returns `true` if the menu was opened, or `false` if no items\n * matched the event and the menu was not opened.\n *\n * #### Notes\n * This method will populate the context menu with items which match\n * the propagation path of the event, then open the menu at the mouse\n * position indicated by the event.\n */\n open(event: MouseEvent): boolean {\n // Prior to any DOM modifications update the window data.\n Menu.saveWindowData();\n\n // Clear the current contents of the context menu.\n this.menu.clearItems();\n\n // Bail early if there are no items to match.\n if (this._items.length === 0) {\n return false;\n }\n\n // Find the matching items for the event.\n let items = Private.matchItems(\n this._items,\n event,\n this._groupByTarget,\n this._sortBySelector\n );\n\n // Bail if there are no matching items.\n if (!items || items.length === 0) {\n return false;\n }\n\n // Add the filtered items to the menu.\n for (const item of items) {\n this.menu.addItem(item);\n }\n\n // Open the context menu at the current mouse position.\n this.menu.open(event.clientX, event.clientY);\n\n // Indicate success.\n return true;\n }\n\n private _groupByTarget: boolean = true;\n private _idTick = 0;\n private _items: Private.IItem[] = [];\n private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n /**\n * An options object for initializing a context menu.\n */\n export interface IOptions {\n /**\n * The command registry to use with the context menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the context menu.\n */\n renderer?: Menu.IRenderer;\n\n /**\n * Whether to sort by selector and rank or only rank.\n *\n * Default true.\n */\n sortBySelector?: boolean;\n\n /**\n * Whether to group items following the DOM hierarchy.\n *\n * Default true.\n *\n * #### Note\n * If true, when the mouse event occurs on element `span` within `div.top`,\n * the items matching `div.top` will be shown before the ones matching `body`.\n */\n groupByTarget?: boolean;\n }\n\n /**\n * An options object for creating a context menu item.\n */\n export interface IItemOptions extends Menu.IItemOptions {\n /**\n * The CSS selector for the context menu item.\n *\n * The context menu item will only be displayed in the context menu\n * when the selector matches a node on the propagation path of the\n * contextmenu event. This allows the menu item to be restricted to\n * user-defined contexts.\n *\n * The selector must not contain commas.\n */\n selector: string;\n\n /**\n * The rank for the item.\n *\n * The rank is used as a tie-breaker when ordering context menu\n * items for display. Items are sorted in the following order:\n * 1. Depth in the DOM tree (deeper is better)\n * 2. Selector specificity (higher is better)\n * 3. Rank (lower is better)\n * 4. Insertion order\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A normalized item for a context menu.\n */\n export interface IItem extends Menu.IItemOptions {\n /**\n * The selector for the item.\n */\n selector: string;\n\n /**\n * The rank for the item.\n */\n rank: number;\n\n /**\n * The tie-breaking id for the item.\n */\n id: number;\n }\n\n /**\n * Create a normalized context menu item from an options object.\n */\n export function createItem(\n options: ContextMenu.IItemOptions,\n id: number\n ): IItem {\n let selector = validateSelector(options.selector);\n let rank = options.rank !== undefined ? options.rank : Infinity;\n return { ...options, selector, rank, id };\n }\n\n /**\n * Find the items which match a context menu event.\n *\n * The results are sorted by DOM level, specificity, and rank.\n */\n export function matchItems(\n items: IItem[],\n event: MouseEvent,\n groupByTarget: boolean,\n sortBySelector: boolean\n ): IItem[] | null {\n // Look up the target of the event.\n let target = event.target as Element | null;\n\n // Bail if there is no target.\n if (!target) {\n return null;\n }\n\n // Look up the current target of the event.\n let currentTarget = event.currentTarget as Element | null;\n\n // Bail if there is no current target.\n if (!currentTarget) {\n return null;\n }\n\n // There are some third party libraries that cause the `target` to\n // be detached from the DOM before lumino can process the event.\n // If that happens, search for a new target node by point. If that\n // node is still dangling, bail.\n if (!currentTarget.contains(target)) {\n target = document.elementFromPoint(event.clientX, event.clientY);\n if (!target || !currentTarget.contains(target)) {\n return null;\n }\n }\n\n // Set up the result array.\n let result: IItem[] = [];\n\n // Copy the items array to allow in-place modification.\n let availableItems: Array = items.slice();\n\n // Walk up the DOM hierarchy searching for matches.\n while (target !== null) {\n // Set up the match array for this DOM level.\n let matches: IItem[] = [];\n\n // Search the remaining items for matches.\n for (let i = 0, n = availableItems.length; i < n; ++i) {\n // Fetch the item.\n let item = availableItems[i];\n\n // Skip items which are already consumed.\n if (!item) {\n continue;\n }\n\n // Skip items which do not match the element.\n if (!Selector.matches(target, item.selector)) {\n continue;\n }\n\n // Add the matched item to the result for this DOM level.\n matches.push(item);\n\n // Mark the item as consumed.\n availableItems[i] = null;\n }\n\n // Sort the matches for this level and add them to the results.\n if (matches.length !== 0) {\n if (groupByTarget) {\n matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n result.push(...matches);\n }\n\n // Stop searching at the limits of the DOM range.\n if (target === currentTarget) {\n break;\n }\n\n // Step to the parent DOM level.\n target = target.parentElement;\n }\n\n if (!groupByTarget) {\n result.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n\n // Return the matched and sorted results.\n return result;\n }\n\n /**\n * Validate the selector for a menu item.\n *\n * This returns the validated selector, or throws if the selector is\n * invalid or contains commas.\n */\n function validateSelector(selector: string): string {\n if (selector.indexOf(',') !== -1) {\n throw new Error(`Selector cannot contain commas: ${selector}`);\n }\n if (!Selector.isValid(selector)) {\n throw new Error(`Invalid selector: ${selector}`);\n }\n return selector;\n }\n\n /**\n * A sort comparison function for a context menu item by ranks.\n */\n function itemCmpRank(a: IItem, b: IItem): number {\n // Sort based on rank.\n let r1 = a.rank;\n let r2 = b.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity-safe\n }\n\n // When all else fails, sort by item id.\n return a.id - b.id;\n }\n\n /**\n * A sort comparison function for a context menu item by selectors and ranks.\n */\n function itemCmp(a: IItem, b: IItem): number {\n // Sort first based on selector specificity.\n let s1 = Selector.calculateSpecificity(a.selector);\n let s2 = Selector.calculateSpecificity(b.selector);\n if (s1 !== s2) {\n return s2 - s1;\n }\n\n // If specificities are equal\n return itemCmpRank(a, b);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ElementARIAAttrs,\n ElementBaseAttrs,\n ElementDataset,\n ElementInlineStyle,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n 'ArrowLeft',\n 'ArrowUp',\n 'ArrowRight',\n 'ArrowDown',\n 'Home',\n 'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar extends Widget {\n /**\n * Construct a new tab bar.\n *\n * @param options - The options for initializing the tab bar.\n */\n constructor(options: TabBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-TabBar');\n this.contentNode.setAttribute('role', 'tablist');\n this.setFlag(Widget.Flag.DisallowLayout);\n this._document = options.document || document;\n this.tabsMovable = options.tabsMovable || false;\n this.titlesEditable = options.titlesEditable || false;\n this.allowDeselect = options.allowDeselect || false;\n this.addButtonEnabled = options.addButtonEnabled || false;\n this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n this.name = options.name || '';\n this.orientation = options.orientation || 'horizontal';\n this.removeBehavior = options.removeBehavior || 'select-tab-after';\n this.renderer = options.renderer || TabBar.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._releaseMouse();\n this._titles.length = 0;\n this._previousTitle = null;\n super.dispose();\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when a tab is moved by the user.\n *\n * #### Notes\n * This signal is emitted when a tab is moved by user interaction.\n *\n * This signal is not emitted when a tab is moved programmatically.\n */\n get tabMoved(): ISignal> {\n return this._tabMoved;\n }\n\n /**\n * A signal emitted when a tab is clicked by the user.\n *\n * #### Notes\n * If the clicked tab is not the current tab, the clicked tab will be\n * made current and the `currentChanged` signal will be emitted first.\n *\n * This signal is emitted even if the clicked tab is the current tab.\n */\n get tabActivateRequested(): ISignal<\n this,\n TabBar.ITabActivateRequestedArgs\n > {\n return this._tabActivateRequested;\n }\n\n /**\n * A signal emitted when the tab bar add button is clicked.\n */\n get addRequested(): ISignal {\n return this._addRequested;\n }\n\n /**\n * A signal emitted when a tab close icon is clicked.\n *\n * #### Notes\n * This signal is not emitted unless the tab title is `closable`.\n */\n get tabCloseRequested(): ISignal> {\n return this._tabCloseRequested;\n }\n\n /**\n * A signal emitted when a tab is dragged beyond the detach threshold.\n *\n * #### Notes\n * This signal is emitted when the user drags a tab with the mouse,\n * and mouse is dragged beyond the detach threshold.\n *\n * The consumer of the signal should call `releaseMouse` and remove\n * the tab in order to complete the detach.\n *\n * This signal is only emitted once per drag cycle.\n */\n get tabDetachRequested(): ISignal> {\n return this._tabDetachRequested;\n }\n\n /**\n * The renderer used by the tab bar.\n */\n readonly renderer: TabBar.IRenderer;\n\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n get document(): Document | ShadowRoot {\n return this._document;\n }\n\n /**\n * Whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n tabsMovable: boolean;\n\n /**\n * Whether the titles can be user-edited.\n *\n */\n get titlesEditable(): boolean {\n return this._titlesEditable;\n }\n\n /**\n * Set whether titles can be user edited.\n *\n */\n set titlesEditable(value: boolean) {\n this._titlesEditable = value;\n }\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * #### Notes\n * Tabs can be always be deselected programmatically.\n */\n allowDeselect: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n */\n insertBehavior: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n */\n removeBehavior: TabBar.RemoveBehavior;\n\n /**\n * Get the currently selected title.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get currentTitle(): Title | null {\n return this._titles[this._currentIndex] || null;\n }\n\n /**\n * Set the currently selected title.\n *\n * #### Notes\n * If the title does not exist, the title will be set to `null`.\n */\n set currentTitle(value: Title | null) {\n this.currentIndex = value ? this._titles.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this._currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `-1`.\n */\n set currentIndex(value: number) {\n // Adjust for an out of range index.\n if (value < 0 || value >= this._titles.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._currentIndex === value) {\n return;\n }\n\n // Look up the previous index and title.\n let pi = this._currentIndex;\n let pt = this._titles[pi] || null;\n\n // Look up the current index and title.\n let ci = value;\n let ct = this._titles[ci] || null;\n\n // Update the current index and previous title.\n this._currentIndex = ci;\n this._previousTitle = pt;\n\n // Schedule an update of the tabs.\n this.update();\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: ci,\n currentTitle: ct\n });\n }\n\n /**\n * Get the name of the tab bar.\n */\n get name(): string {\n return this._name;\n }\n\n /**\n * Set the name of the tab bar.\n */\n set name(value: string) {\n this._name = value;\n if (value) {\n this.contentNode.setAttribute('aria-label', value);\n } else {\n this.contentNode.removeAttribute('aria-label');\n }\n }\n\n /**\n * Get the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n get orientation(): TabBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n set orientation(value: TabBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Toggle the orientation values.\n this._orientation = value;\n this.dataset['orientation'] = value;\n this.contentNode.setAttribute('aria-orientation', value);\n }\n\n /**\n * Whether the add button is enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add button is enabled.\n */\n set addButtonEnabled(value: boolean) {\n // Do nothing if the value does not change.\n if (this._addButtonEnabled === value) {\n return;\n }\n\n this._addButtonEnabled = value;\n if (value) {\n this.addButtonNode.classList.remove('lm-mod-hidden');\n } else {\n this.addButtonNode.classList.add('lm-mod-hidden');\n }\n }\n\n /**\n * A read-only array of the titles in the tab bar.\n */\n get titles(): ReadonlyArray> {\n return this._titles;\n }\n\n /**\n * The tab bar content node.\n *\n * #### Notes\n * This is the node which holds the tab nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * The tab bar add button node.\n *\n * #### Notes\n * This is the node which holds the add button.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get addButtonNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-addButton'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Add a tab to the end of the tab bar.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * If the title is already added to the tab bar, it will be moved.\n */\n addTab(value: Title | Title.IOptions): Title {\n return this.insertTab(this._titles.length, value);\n }\n\n /**\n * Insert a tab into the tab bar at the specified index.\n *\n * @param index - The index at which to insert the tab.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the tabs.\n *\n * If the title is already added to the tab bar, it will be moved.\n */\n insertTab(index: number, value: Title | Title.IOptions): Title {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Coerce the value to a title.\n let title = Private.asTitle(value);\n\n // Look up the index of the title.\n let i = this._titles.indexOf(title);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._titles.length));\n\n // If the title is not in the array, insert it.\n if (i === -1) {\n // Insert the title into the array.\n ArrayExt.insert(this._titles, j, title);\n\n // Connect to the title changed signal.\n title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the insert.\n this._adjustCurrentForInsert(j, title);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n // Otherwise, the title exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._titles.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return title;\n }\n\n // Move the title to the new location.\n ArrayExt.move(this._titles, i, j);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n /**\n * Remove a tab from the tab bar.\n *\n * @param title - The title for the tab to remove.\n *\n * #### Notes\n * This is a no-op if the title is not in the tab bar.\n */\n removeTab(title: Title): void {\n this.removeTabAt(this._titles.indexOf(title));\n }\n\n /**\n * Remove the tab at a given index from the tab bar.\n *\n * @param index - The index of the tab to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeTabAt(index: number): void {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Remove the title from the array.\n let title = ArrayExt.removeAt(this._titles, index);\n\n // Bail if the index is out of range.\n if (!title) {\n return;\n }\n\n // Disconnect from the title changed signal.\n title.changed.disconnect(this._onTitleChanged, this);\n\n // Clear the previous title if it's being removed.\n if (title === this._previousTitle) {\n this._previousTitle = null;\n }\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the remove.\n this._adjustCurrentForRemove(index, title);\n }\n\n /**\n * Remove all tabs from the tab bar.\n */\n clearTabs(): void {\n // Bail if there is nothing to remove.\n if (this._titles.length === 0) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Disconnect from the title changed signals.\n for (let title of this._titles) {\n title.changed.disconnect(this._onTitleChanged, this);\n }\n\n // Get the current index and title.\n let pi = this.currentIndex;\n let pt = this.currentTitle;\n\n // Reset the current index and previous title.\n this._currentIndex = -1;\n this._previousTitle = null;\n\n // Clear the title array.\n this._titles.length = 0;\n\n // Schedule an update of the tabs.\n this.update();\n\n // If no tab was selected, there's nothing else to do.\n if (pi === -1) {\n return;\n }\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n *\n * #### Notes\n * This will cause the tab bar to stop handling mouse events and to\n * restore the tabs to their non-dragged positions.\n */\n releaseMouse(): void {\n this._releaseMouse();\n }\n\n /**\n * Handle the DOM events for the tab bar.\n *\n * @param event - The DOM event sent to the tab bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tab bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'dblclick':\n this._evtDblClick(event as MouseEvent);\n break;\n case 'keydown':\n event.eventPhase === Event.CAPTURING_PHASE\n ? this._evtKeyDownCapturing(event as KeyboardEvent)\n : this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n this.node.addEventListener('dblclick', this);\n this.node.addEventListener('keydown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this.node.removeEventListener('dblclick', this);\n this.node.removeEventListener('keydown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let titles = this._titles;\n let renderer = this.renderer;\n let currentTitle = this.currentTitle;\n let content = new Array(titles.length);\n // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n // If the add button handles it, no need to do anything. If no element of the tab\n // bar handles it, set it on the current or the first tab to ensure one element\n // handles it after update.\n const tabHandlingTabindex =\n this._getCurrentTabindex() ??\n (this._currentIndex > -1 ? this._currentIndex : 0);\n\n for (let i = 0, n = titles.length; i < n; ++i) {\n let title = titles[i];\n let current = title === currentTitle;\n let zIndex = current ? n : n - i - 1;\n let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * Get the index of the tab which handles tabindex=\"0\".\n * If the add button handles tabindex=\"0\", -1 is returned.\n * If none of the previous handles tabindex=\"0\", null is returned.\n */\n private _getCurrentTabindex(): number | null {\n let index = null;\n const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n if (elemTabindex) {\n index = [...this.contentNode.children].indexOf(elemTabindex);\n } else if (\n this._addButtonEnabled &&\n this.addButtonNode.getAttribute('tabindex') === '0'\n ) {\n index = -1;\n }\n return index;\n }\n\n /**\n * Handle the `'dblclick'` event for the tab bar.\n */\n private _evtDblClick(event: MouseEvent): void {\n // Do nothing if titles are not editable\n if (!this.titlesEditable) {\n return;\n }\n\n let tabs = this.contentNode.children;\n\n // Find the index of the targeted tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab.\n if (index === -1) {\n return;\n }\n\n let title = this.titles[index];\n let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n if (label && label.contains(event.target as HTMLElement)) {\n let value = title.label || '';\n\n // Clear the label element\n let oldValue = label.innerHTML;\n label.innerHTML = '';\n\n let input = document.createElement('input');\n input.classList.add('lm-TabBar-tabInput');\n input.value = value;\n label.appendChild(input);\n\n let onblur = () => {\n input.removeEventListener('blur', onblur);\n label.innerHTML = oldValue;\n this.node.addEventListener('keydown', this);\n };\n\n input.addEventListener('dblclick', (event: Event) =>\n event.stopPropagation()\n );\n input.addEventListener('blur', onblur);\n input.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n if (input.value !== '') {\n title.label = title.caption = input.value;\n }\n onblur();\n } else if (event.key === 'Escape') {\n onblur();\n }\n });\n this.node.removeEventListener('keydown', this);\n input.select();\n input.focus();\n\n if (label.children.length > 0) {\n (label.children[0] as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at capturing phase.\n */\n private _evtKeyDownCapturing(event: KeyboardEvent): void {\n if (event.eventPhase !== Event.CAPTURING_PHASE) {\n return;\n }\n\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.key === 'Escape') {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at target phase.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Allow for navigation using tab key\n if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n return;\n }\n\n // Check if Enter or Spacebar key has been pressed and open that tab\n if (\n event.key === 'Enter' ||\n event.key === 'Spacebar' ||\n event.key === ' '\n ) {\n // Get focus element that is in focus by the tab key\n const focusedElement = document.activeElement;\n\n // Test first if the focus is on the add button node\n if (\n this.addButtonEnabled &&\n this.addButtonNode.contains(focusedElement)\n ) {\n event.preventDefault();\n event.stopPropagation();\n this._addRequested.emit();\n } else {\n const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n tab.contains(focusedElement)\n );\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this.currentIndex = index;\n }\n }\n // Handle the arrow keys to switch tabs.\n } else if (ARROW_KEYS.includes(event.key)) {\n // Create a list of all focusable elements in the tab bar.\n const focusable: Element[] = [...this.contentNode.children];\n if (this.addButtonEnabled) {\n focusable.push(this.addButtonNode);\n }\n // If the tab bar contains only one element, nothing to do.\n if (focusable.length <= 1) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n\n // Get the current focused element.\n let focusedIndex = focusable.indexOf(document.activeElement as Element);\n if (focusedIndex === -1) {\n focusedIndex = this._currentIndex;\n }\n\n // Find the next element to focus on.\n let nextFocused: Element | null | undefined;\n if (\n (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowDown' && this._orientation === 'vertical')\n ) {\n nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n } else if (\n (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowUp' && this._orientation === 'vertical')\n ) {\n nextFocused =\n focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n } else if (event.key === 'Home') {\n nextFocused = focusable[0];\n } else if (event.key === 'End') {\n nextFocused = focusable[focusable.length - 1];\n }\n\n // Change the focused element and the tabindex value.\n if (nextFocused) {\n focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n nextFocused?.setAttribute('tabindex', '0');\n (nextFocused as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the tab bar.\n */\n private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse press.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if a drag is in progress.\n if (this._dragData) {\n return;\n }\n\n // Do nothing if a title editable input was clicked.\n if (\n (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n ) {\n return;\n }\n\n // Check if the add button was clicked.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the pressed tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab or the add button.\n if (index === -1 && !addButtonClicked) {\n return;\n }\n\n // Pressing on a tab stops the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Initialize the non-measured parts of the drag data.\n this._dragData = {\n tab: tabs[index] as HTMLElement,\n index: index,\n pressX: event.clientX,\n pressY: event.clientY,\n tabPos: -1,\n tabSize: -1,\n tabPressPos: -1,\n targetIndex: -1,\n tabLayout: null,\n contentRect: null,\n override: null,\n dragActive: false,\n dragAborted: false,\n detachRequested: false\n };\n\n // Add the document pointer up listener.\n this.document.addEventListener('pointerup', this, true);\n\n // Do nothing else if the middle button or add button is clicked.\n if (event.button === 1 || addButtonClicked) {\n return;\n }\n\n // Do nothing else if the close icon is clicked.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n return;\n }\n\n // Add the extra listeners if the tabs are movable.\n if (this.tabsMovable) {\n this.document.addEventListener('pointermove', this, true);\n this.document.addEventListener('keydown', this, true);\n this.document.addEventListener('contextmenu', this, true);\n }\n\n // Update the current index as appropriate.\n if (this.allowDeselect && this.currentIndex === index) {\n this.currentIndex = -1;\n } else {\n this.currentIndex = index;\n }\n\n // Do nothing else if there is no current tab.\n if (this.currentIndex === -1) {\n return;\n }\n\n // Emit the tab activate request signal.\n this._tabActivateRequested.emit({\n index: this.currentIndex,\n title: this.currentTitle!\n });\n }\n\n /**\n * Handle the `'pointermove'` event for the tab bar.\n */\n private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Suppress the event during a drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Bail early if the drag threshold has not been met.\n if (!data.dragActive && !Private.dragExceeded(data, event)) {\n return;\n }\n\n // Activate the drag if necessary.\n if (!data.dragActive) {\n // Fill in the rest of the drag data measurements.\n let tabRect = data.tab.getBoundingClientRect();\n if (this._orientation === 'horizontal') {\n data.tabPos = data.tab.offsetLeft;\n data.tabSize = tabRect.width;\n data.tabPressPos = data.pressX - tabRect.left;\n } else {\n data.tabPos = data.tab.offsetTop;\n data.tabSize = tabRect.height;\n data.tabPressPos = data.pressY - tabRect.top;\n }\n data.tabPressOffset = {\n x: data.pressX - tabRect.left,\n y: data.pressY - tabRect.top\n };\n data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n data.contentRect = this.contentNode.getBoundingClientRect();\n data.override = Drag.overrideCursor('default');\n\n // Add the dragging style classes.\n data.tab.classList.add('lm-mod-dragging');\n this.addClass('lm-mod-dragging');\n\n // Mark the drag as active.\n data.dragActive = true;\n }\n\n // Emit the detach requested signal if the threshold is exceeded.\n if (!data.detachRequested && Private.detachExceeded(data, event)) {\n // Only emit the signal once per drag cycle.\n data.detachRequested = true;\n\n // Setup the arguments for the signal.\n let index = data.index;\n let clientX = event.clientX;\n let clientY = event.clientY;\n let tab = tabs[index] as HTMLElement;\n let title = this._titles[index];\n\n // Emit the tab detach requested signal.\n this._tabDetachRequested.emit({\n index,\n title,\n tab,\n clientX,\n clientY,\n offset: data.tabPressOffset\n });\n\n // Bail if the signal handler aborted the drag.\n if (data.dragAborted) {\n return;\n }\n }\n\n // Update the positions of the tabs.\n Private.layoutTabs(tabs, data, event, this._orientation);\n }\n\n /**\n * Handle the `'pointerup'` event for the document.\n */\n private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse release.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if no drag is in progress.\n const data = this._dragData;\n if (!data) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Remove the extra mouse event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Handle a release when the drag is not active.\n if (!data.dragActive) {\n // Clear the drag data.\n this._dragData = null;\n\n // Handle clicking the add button.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n if (addButtonClicked) {\n this._addRequested.emit(undefined);\n return;\n }\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the released tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the release is not on the original pressed tab.\n if (index !== data.index) {\n return;\n }\n\n // Ignore the release if the title is not closable.\n let title = this._titles[index];\n if (!title.closable) {\n return;\n }\n\n // Emit the close requested signal if the middle button is released.\n if (event.button === 1) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Emit the close requested signal if the close icon was released.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Otherwise, there is nothing left to do.\n return;\n }\n\n // Do nothing if the left button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Position the tab at its final resting position.\n Private.finalizeTabPosition(data, this._orientation);\n\n // Remove the dragging class from the tab so it can be transitioned.\n data.tab.classList.remove('lm-mod-dragging');\n\n // Parse the transition duration for releasing the tab.\n let duration = Private.parseTransitionDuration(data.tab);\n\n // Complete the release on a timer to allow the tab to transition.\n setTimeout(() => {\n // Do nothing if the drag has been aborted.\n if (data.dragAborted) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Reset the positions of the tabs.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor grab.\n data.override!.dispose();\n\n // Remove the remaining dragging style.\n this.removeClass('lm-mod-dragging');\n\n // If the tab was not moved, there is nothing else to do.\n let i = data.index;\n let j = data.targetIndex;\n if (j === -1 || i === j) {\n return;\n }\n\n // Move the title to the new locations.\n ArrayExt.move(this._titles, i, j);\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Emit the tab moved signal.\n this._tabMoved.emit({\n fromIndex: i,\n toIndex: j,\n title: this._titles[j]\n });\n\n // Update the tabs immediately to prevent flicker.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n }, duration);\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n */\n private _releaseMouse(): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Remove the extra document event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Indicate the drag has been aborted. This allows the mouse\n // event handlers to return early when the drag is canceled.\n data.dragAborted = true;\n\n // If the drag is not active, there's nothing more to do.\n if (!data.dragActive) {\n return;\n }\n\n // Reset the tabs to their non-dragged positions.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor override.\n data.override!.dispose();\n\n // Clear the dragging style classes.\n data.tab.classList.remove('lm-mod-dragging');\n this.removeClass('lm-mod-dragging');\n }\n\n /**\n * Adjust the current index for a tab insert operation.\n *\n * This method accounts for the tab bar's insertion behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForInsert(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ct = this.currentTitle;\n let ci = this._currentIndex;\n let bh = this.insertBehavior;\n\n // TODO: do we need to do an update to update the aria-selected attribute?\n\n // Handle the behavior where the new tab is always selected,\n // or the behavior where the new tab is selected if needed.\n if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n this._currentIndex = i;\n this._previousTitle = ct;\n this._currentChanged.emit({\n previousIndex: ci,\n previousTitle: ct,\n currentIndex: i,\n currentTitle: title\n });\n return;\n }\n\n // Otherwise, silently adjust the current index if needed.\n if (ci >= i) {\n this._currentIndex++;\n }\n }\n\n /**\n * Adjust the current index for a tab move operation.\n *\n * This method will not cause the actual current tab to change.\n * It silently adjusts the index to account for the given move.\n */\n private _adjustCurrentForMove(i: number, j: number): void {\n if (this._currentIndex === i) {\n this._currentIndex = j;\n } else if (this._currentIndex < i && this._currentIndex >= j) {\n this._currentIndex++;\n } else if (this._currentIndex > i && this._currentIndex <= j) {\n this._currentIndex--;\n }\n }\n\n /**\n * Adjust the current index for a tab remove operation.\n *\n * This method accounts for the tab bar's remove behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForRemove(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ci = this._currentIndex;\n let bh = this.removeBehavior;\n\n // Silently adjust the index if the current tab is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._currentIndex--;\n }\n return;\n }\n\n // TODO: do we need to do an update to adjust the aria-selected value?\n\n // No tab gets selected if the tab bar is empty.\n if (this._titles.length === 0) {\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n return;\n }\n\n // Handle behavior where the next sibling tab is selected.\n if (bh === 'select-tab-after') {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous sibling tab is selected.\n if (bh === 'select-tab-before') {\n this._currentIndex = Math.max(0, i - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous history tab is selected.\n if (bh === 'select-previous-tab') {\n if (this._previousTitle) {\n this._currentIndex = this._titles.indexOf(this._previousTitle);\n this._previousTitle = null;\n } else {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n }\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Otherwise, no tab gets selected.\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n this.update();\n }\n\n private _name: string;\n private _currentIndex = -1;\n private _titles: Title[] = [];\n private _orientation: TabBar.Orientation;\n private _document: Document | ShadowRoot;\n private _titlesEditable: boolean = false;\n private _previousTitle: Title | null = null;\n private _dragData: Private.IDragData | null = null;\n private _addButtonEnabled: boolean = false;\n private _tabMoved = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n private _addRequested = new Signal(this);\n private _tabCloseRequested = new Signal<\n this,\n TabBar.ITabCloseRequestedArgs\n >(this);\n private _tabDetachRequested = new Signal<\n this,\n TabBar.ITabDetachRequestedArgs\n >(this);\n private _tabActivateRequested = new Signal<\n this,\n TabBar.ITabActivateRequestedArgs\n >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n /**\n * A type alias for a tab bar orientation.\n */\n export type Orientation =\n | /**\n * The tabs are arranged in a single row, left-to-right.\n *\n * The tab text orientation is horizontal.\n */\n 'horizontal'\n\n /**\n * The tabs are arranged in a single column, top-to-bottom.\n *\n * The tab text orientation is horizontal.\n */\n | 'vertical';\n\n /**\n * A type alias for the selection behavior on tab insert.\n */\n export type InsertBehavior =\n | /**\n * The selected tab will not be changed.\n */\n 'none'\n\n /**\n * The inserted tab will be selected.\n */\n | 'select-tab'\n\n /**\n * The inserted tab will be selected if the current tab is null.\n */\n | 'select-tab-if-needed';\n\n /**\n * A type alias for the selection behavior on tab remove.\n */\n export type RemoveBehavior =\n | /**\n * No tab will be selected.\n */\n 'none'\n\n /**\n * The tab after the removed tab will be selected if possible.\n */\n | 'select-tab-after'\n\n /**\n * The tab before the removed tab will be selected if possible.\n */\n | 'select-tab-before'\n\n /**\n * The previously selected tab will be selected if possible.\n */\n | 'select-previous-tab';\n\n /**\n * An options object for creating a tab bar.\n */\n export interface IOptions {\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n\n /**\n * Name of the tab bar.\n *\n * This is used for accessibility reasons. The default is the empty string.\n */\n name?: string;\n\n /**\n * The layout orientation of the tab bar.\n *\n * The default is `horizontal`.\n */\n orientation?: TabBar.Orientation;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * The default is `false`.\n */\n allowDeselect?: boolean;\n\n /**\n * Whether the titles can be directly edited by the user.\n *\n * The default is `false`.\n */\n titlesEditable?: boolean;\n\n /**\n * Whether the add button is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n *\n * The default is `'select-tab-if-needed'`.\n */\n insertBehavior?: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n *\n * The default is `'select-tab-after'`.\n */\n removeBehavior?: TabBar.RemoveBehavior;\n\n /**\n * A renderer to use with the tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n readonly previousIndex: number;\n\n /**\n * The previously selected title.\n */\n readonly previousTitle: Title | null;\n\n /**\n * The currently selected index.\n */\n readonly currentIndex: number;\n\n /**\n * The currently selected title.\n */\n readonly currentTitle: Title | null;\n }\n\n /**\n * The arguments object for the `tabMoved` signal.\n */\n export interface ITabMovedArgs {\n /**\n * The previous index of the tab.\n */\n readonly fromIndex: number;\n\n /**\n * The current index of the tab.\n */\n readonly toIndex: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabActivateRequested` signal.\n */\n export interface ITabActivateRequestedArgs {\n /**\n * The index of the tab to activate.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabCloseRequested` signal.\n */\n export interface ITabCloseRequestedArgs {\n /**\n * The index of the tab to close.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabDetachRequested` signal.\n */\n export interface ITabDetachRequestedArgs {\n /**\n * The index of the tab to detach.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n\n /**\n * The node representing the tab.\n */\n readonly tab: HTMLElement;\n\n /**\n * The current client X position of the mouse.\n */\n readonly clientX: number;\n\n /**\n * The current client Y position of the mouse.\n */\n readonly clientY: number;\n\n /**\n * The mouse position in the tab coordinate.\n */\n readonly offset?: { x: number; y: number };\n }\n\n /**\n * An object which holds the data to render a tab.\n */\n export interface IRenderData {\n /**\n * The title associated with the tab.\n */\n readonly title: Title;\n\n /**\n * Whether the tab is the current tab.\n */\n readonly current: boolean;\n\n /**\n * The z-index for the tab.\n */\n readonly zIndex: number;\n\n /**\n * The tabindex value for the tab.\n */\n readonly tabIndex?: number;\n }\n\n /**\n * A renderer for use with a tab bar.\n */\n export interface IRenderer {\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector: string;\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n constructor() {\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement {\n let title = data.title.caption;\n let key = this.createTabKey(data);\n let id = key;\n let style = this.createTabStyle(data);\n let className = this.createTabClass(data);\n let dataset = this.createTabDataset(data);\n let aria = this.createTabARIA(data);\n if (data.title.closable) {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderCloseIcon(data)\n );\n } else {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n }\n\n /**\n * Render the icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n const { title } = data;\n let className = this.createIconClass(data);\n\n // If title.icon is undefined, it will be ignored.\n return h.div({ className }, title.icon!, title.iconLabel);\n }\n\n /**\n * Render the label element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n }\n\n /**\n * Render the close icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab close icon.\n */\n renderCloseIcon(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n }\n\n /**\n * Create a unique render key for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The unique render key for the tab.\n *\n * #### Notes\n * This method caches the key against the tab title the first time\n * the key is generated. This enables efficient rendering of moved\n * tabs and avoids subtle hover style artifacts.\n */\n createTabKey(data: IRenderData): string {\n let key = this._tabKeys.get(data.title);\n if (key === undefined) {\n key = `tab-key-${this._uuid}-${this._tabID++}`;\n this._tabKeys.set(data.title, key);\n }\n return key;\n }\n\n /**\n * Create the inline style object for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The inline style data for the tab.\n */\n createTabStyle(data: IRenderData): ElementInlineStyle {\n return { zIndex: `${data.zIndex}` };\n }\n\n /**\n * Create the class name for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab.\n */\n createTabClass(data: IRenderData): string {\n let name = 'lm-TabBar-tab';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.title.closable) {\n name += ' lm-mod-closable';\n }\n if (data.current) {\n name += ' lm-mod-current';\n }\n return name;\n }\n\n /**\n * Create the dataset for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The dataset for the tab.\n */\n createTabDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the ARIA attributes for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The ARIA attributes for the tab.\n */\n createTabARIA(data: IRenderData): ElementARIAAttrs | ElementBaseAttrs {\n return {\n role: 'tab',\n 'aria-selected': data.current.toString(),\n tabindex: `${data.tabIndex ?? '-1'}`\n };\n }\n\n /**\n * Create the class name for the tab icon.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-TabBar-tabIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _tabID = 0;\n private _tabKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * A selector which matches the add button node in the tab bar.\n */\n export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The start drag distance threshold.\n */\n export const DRAG_THRESHOLD = 5;\n\n /**\n * The detach distance threshold.\n */\n export const DETACH_THRESHOLD = 20;\n\n /**\n * A struct which holds the drag data for a tab bar.\n */\n export interface IDragData {\n /**\n * The tab node being dragged.\n */\n tab: HTMLElement;\n\n /**\n * The index of the tab being dragged.\n */\n index: number;\n\n /**\n * The mouse press client X position.\n */\n pressX: number;\n\n /**\n * The mouse press client Y position.\n */\n pressY: number;\n\n /**\n * The offset left/top of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPos: number;\n\n /**\n * The offset width/height of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabSize: number;\n\n /**\n * The original mouse X/Y position in tab coordinates.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPressPos: number;\n\n /**\n * The original mouse position in tab coordinates.\n *\n * This is undefined if the drag is not active.\n */\n tabPressOffset?: { x: number; y: number };\n\n /**\n * The tab target index upon mouse release.\n *\n * This will be `-1` if the drag is not active.\n */\n targetIndex: number;\n\n /**\n * The array of tab layout objects snapped at drag start.\n *\n * This will be `null` if the drag is not active.\n */\n tabLayout: ITabLayout[] | null;\n\n /**\n * The bounding client rect of the tab bar content node.\n *\n * This will be `null` if the drag is not active.\n */\n contentRect: DOMRect | null;\n\n /**\n * The disposable to clean up the cursor override.\n *\n * This will be `null` if the drag is not active.\n */\n override: IDisposable | null;\n\n /**\n * Whether the drag is currently active.\n */\n dragActive: boolean;\n\n /**\n * Whether the drag has been aborted.\n */\n dragAborted: boolean;\n\n /**\n * Whether a detach request as been made.\n */\n detachRequested: boolean;\n }\n\n /**\n * An object which holds layout data for a tab.\n */\n export interface ITabLayout {\n /**\n * The left/top margin value for the tab.\n */\n margin: number;\n\n /**\n * The offset left/top position of the tab.\n */\n pos: number;\n\n /**\n * The offset width/height of the tab.\n */\n size: number;\n }\n\n /**\n * Create the DOM node for a tab bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.setAttribute('role', 'tablist');\n content.className = 'lm-TabBar-content';\n node.appendChild(content);\n\n let add = document.createElement('div');\n add.className = 'lm-TabBar-addButton lm-mod-hidden';\n add.setAttribute('tabindex', '-1');\n add.setAttribute('role', 'button');\n node.appendChild(add);\n return node;\n }\n\n /**\n * Coerce a title or options into a real title.\n */\n export function asTitle(value: Title | Title.IOptions): Title {\n return value instanceof Title ? value : new Title(value);\n }\n\n /**\n * Parse the transition duration for a tab node.\n */\n export function parseTransitionDuration(tab: HTMLElement): number {\n let style = window.getComputedStyle(tab);\n return 1000 * (parseFloat(style.transitionDuration!) || 0);\n }\n\n /**\n * Get a snapshot of the current tab layout values.\n */\n export function snapTabLayout(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): ITabLayout[] {\n let layout = new Array(tabs.length);\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let node = tabs[i] as HTMLElement;\n let style = window.getComputedStyle(node);\n if (orientation === 'horizontal') {\n layout[i] = {\n pos: node.offsetLeft,\n size: node.offsetWidth,\n margin: parseFloat(style.marginLeft!) || 0\n };\n } else {\n layout[i] = {\n pos: node.offsetTop,\n size: node.offsetHeight,\n margin: parseFloat(style.marginTop!) || 0\n };\n }\n }\n return layout;\n }\n\n /**\n * Test if the event exceeds the drag threshold.\n */\n export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n let dx = Math.abs(event.clientX - data.pressX);\n let dy = Math.abs(event.clientY - data.pressY);\n return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n }\n\n /**\n * Test if the event exceeds the drag detach threshold.\n */\n export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n let rect = data.contentRect!;\n return (\n event.clientX < rect.left - DETACH_THRESHOLD ||\n event.clientX >= rect.right + DETACH_THRESHOLD ||\n event.clientY < rect.top - DETACH_THRESHOLD ||\n event.clientY >= rect.bottom + DETACH_THRESHOLD\n );\n }\n\n /**\n * Update the relative tab positions and computed target index.\n */\n export function layoutTabs(\n tabs: HTMLCollection,\n data: IDragData,\n event: MouseEvent,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive values.\n let pressPos: number;\n let localPos: number;\n let clientPos: number;\n let clientSize: number;\n if (orientation === 'horizontal') {\n pressPos = data.pressX;\n localPos = event.clientX - data.contentRect!.left;\n clientPos = event.clientX;\n clientSize = data.contentRect!.width;\n } else {\n pressPos = data.pressY;\n localPos = event.clientY - data.contentRect!.top;\n clientPos = event.clientY;\n clientSize = data.contentRect!.height;\n }\n\n // Compute the target data.\n let targetIndex = data.index;\n let targetPos = localPos - data.tabPressPos;\n let targetEnd = targetPos + data.tabSize;\n\n // Update the relative tab positions.\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let pxPos: string;\n let layout = data.tabLayout![i];\n let threshold = layout.pos + (layout.size >> 1);\n if (i < data.index && targetPos < threshold) {\n pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n targetIndex = Math.min(targetIndex, i);\n } else if (i > data.index && targetEnd > threshold) {\n pxPos = `${-data.tabSize - layout.margin}px`;\n targetIndex = Math.max(targetIndex, i);\n } else if (i === data.index) {\n let ideal = clientPos - pressPos;\n let limit = clientSize - (data.tabPos + data.tabSize);\n pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n } else {\n pxPos = '';\n }\n if (orientation === 'horizontal') {\n (tabs[i] as HTMLElement).style.left = pxPos;\n } else {\n (tabs[i] as HTMLElement).style.top = pxPos;\n }\n }\n\n // Update the computed target index.\n data.targetIndex = targetIndex;\n }\n\n /**\n * Position the drag tab at its final resting relative position.\n */\n export function finalizeTabPosition(\n data: IDragData,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive client size.\n let clientSize: number;\n if (orientation === 'horizontal') {\n clientSize = data.contentRect!.width;\n } else {\n clientSize = data.contentRect!.height;\n }\n\n // Compute the ideal final tab position.\n let ideal: number;\n if (data.targetIndex === data.index) {\n ideal = 0;\n } else if (data.targetIndex > data.index) {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n } else {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos - data.tabPos;\n }\n\n // Compute the tab position limit.\n let limit = clientSize - (data.tabPos + data.tabSize);\n let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n // Set the final orientation-sensitive position.\n if (orientation === 'horizontal') {\n data.tab.style.left = `${final}px`;\n } else {\n data.tab.style.top = `${final}px`;\n }\n }\n\n /**\n * Reset the relative positions of the given tabs.\n */\n export function resetTabPositions(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): void {\n for (const tab of tabs) {\n if (orientation === 'horizontal') {\n (tab as HTMLElement).style.left = '';\n } else {\n (tab as HTMLElement).style.top = '';\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n /**\n * Construct a new dock layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: DockLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n this._document = options.document || document;\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n */\n dispose(): void {\n // Get an iterator over the widgets in the layout.\n let widgets = this[Symbol.iterator]();\n\n // Dispose of the layout items.\n this._items.forEach(item => {\n item.dispose();\n });\n\n // Clear the layout state before disposing the widgets.\n this._box = null;\n this._root = null;\n this._items.clear();\n\n // Dispose of the widgets contained in the old layout root.\n for (const widget of widgets) {\n widget.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The renderer used by the dock layout.\n */\n readonly renderer: DockLayout.IRenderer;\n\n /**\n * The method for hiding child widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n for (const bar of this.tabBars()) {\n if (bar.titles.length > 1) {\n for (const title of bar.titles) {\n title.owner.hiddenMode = this._hiddenMode;\n }\n }\n }\n }\n\n /**\n * Get the inter-element spacing for the dock layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the dock layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Whether the dock layout is empty.\n */\n get isEmpty(): boolean {\n return this._root === null;\n }\n\n /**\n * Create an iterator over all widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This iterator includes the generated tab bars.\n */\n [Symbol.iterator](): IterableIterator {\n return this._root ? this._root.iterAllWidgets() : empty();\n }\n\n /**\n * Create an iterator over the user widgets in the layout.\n *\n * @returns A new iterator over the user widgets in the layout.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n widgets(): IterableIterator {\n return this._root ? this._root.iterUserWidgets() : empty();\n }\n\n /**\n * Create an iterator over the selected widgets in the layout.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the layout.\n */\n selectedWidgets(): IterableIterator {\n return this._root ? this._root.iterSelectedWidgets() : empty();\n }\n\n /**\n * Create an iterator over the tab bars in the layout.\n *\n * @returns A new iterator over the tab bars in the layout.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n tabBars(): IterableIterator> {\n return this._root ? this._root.iterTabBars() : empty();\n }\n\n /**\n * Create an iterator over the handles in the layout.\n *\n * @returns A new iterator over the handles in the layout.\n */\n handles(): IterableIterator {\n return this._root ? this._root.iterHandles() : empty();\n }\n\n /**\n * Move a handle to the given offset position.\n *\n * @param handle - The handle to move.\n *\n * @param offsetX - The desired offset X position of the handle.\n *\n * @param offsetY - The desired offset Y position of the handle.\n *\n * #### Notes\n * If the given handle is not contained in the layout, this is no-op.\n *\n * The handle will be moved as close as possible to the desired\n * position without violating any of the layout constraints.\n *\n * Only one of the coordinates is used depending on the orientation\n * of the handle. This method accepts both coordinates to make it\n * easy to invoke from a mouse move event without needing to know\n * the handle orientation.\n */\n moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n // Bail early if there is no root or if the handle is hidden.\n let hidden = handle.classList.contains('lm-mod-hidden');\n if (!this._root || hidden) {\n return;\n }\n\n // Lookup the split node for the handle.\n let data = this._root.findSplitNode(handle);\n if (!data) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (data.node.orientation === 'horizontal') {\n delta = offsetX - handle.offsetLeft;\n } else {\n delta = offsetY - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent sibling resizing unless needed.\n data.node.holdSizes();\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Save the current configuration of the dock layout.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockLayout.ILayoutConfig {\n // Bail early if there is no root.\n if (!this._root) {\n return { main: null };\n }\n\n // Hold the current sizes in the layout tree.\n this._root.holdAllSizes();\n\n // Return the layout config.\n return { main: this._root.createConfig() };\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n */\n restoreLayout(config: DockLayout.ILayoutConfig): void {\n // Create the widget set for validating the config.\n let widgetSet = new Set();\n\n // Normalize the main area config and collect the widgets.\n let mainConfig: DockLayout.AreaConfig | null;\n if (config.main) {\n mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n } else {\n mainConfig = null;\n }\n\n // Create iterators over the old content.\n let oldWidgets = this.widgets();\n let oldTabBars = this.tabBars();\n let oldHandles = this.handles();\n\n // Clear the root before removing the old content.\n this._root = null;\n\n // Unparent the old widgets which are not in the new config.\n for (const widget of oldWidgets) {\n if (!widgetSet.has(widget)) {\n widget.parent = null;\n }\n }\n\n // Dispose of the old tab bars.\n for (const tabBar of oldTabBars) {\n tabBar.dispose();\n }\n\n // Remove the old handles.\n for (const handle of oldHandles) {\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n }\n\n // Reparent the new widgets to the current parent.\n for (const widget of widgetSet) {\n widget.parent = this.parent;\n }\n\n // Create the root node for the new config.\n if (mainConfig) {\n this._root = Private.realizeAreaConfig(\n mainConfig,\n {\n // Ignoring optional `document` argument as we must reuse `this._document`\n createTabBar: (document?: Document | ShadowRoot) =>\n this._createTabBar(),\n createHandle: () => this._createHandle()\n },\n this._document\n );\n } else {\n this._root = null;\n }\n\n // If there is no parent, there is nothing more to do.\n if (!this.parent) {\n return;\n }\n\n // Attach the new widgets to the parent.\n widgetSet.forEach(widget => {\n this.attachWidget(widget);\n });\n\n // Post a fit request to the parent.\n this.parent.fit();\n }\n\n /**\n * Add a widget to the dock layout.\n *\n * @param widget - The widget to add to the dock layout.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * The widget will be moved if it is already contained in the layout.\n *\n * An error will be thrown if the reference widget is invalid.\n */\n addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n // Parse the options.\n let ref = options.ref || null;\n let mode = options.mode || 'tab-after';\n\n // Find the tab node which holds the reference widget.\n let refNode: Private.TabLayoutNode | null = null;\n if (this._root && ref) {\n refNode = this._root.findTabNode(ref);\n }\n\n // Throw an error if the reference widget is invalid.\n if (ref && !refNode) {\n throw new Error('Reference widget is not in the layout.');\n }\n\n // Reparent the widget to the current layout parent.\n widget.parent = this.parent;\n\n // Insert the widget according to the insert mode.\n switch (mode) {\n case 'tab-after':\n this._insertTab(widget, ref, refNode, true);\n break;\n case 'tab-before':\n this._insertTab(widget, ref, refNode, false);\n break;\n case 'split-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false);\n break;\n case 'split-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false);\n break;\n case 'split-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true);\n break;\n case 'split-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true);\n break;\n case 'merge-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n break;\n case 'merge-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n break;\n case 'merge-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n break;\n case 'merge-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n break;\n }\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Ensure the widget is attached to the parent widget.\n this.attachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Remove the widget from its current layout location.\n this._removeWidget(widget);\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Detach the widget from the parent widget.\n this.detachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Find the tab area which contains the given client position.\n *\n * @param clientX - The client X position of interest.\n *\n * @param clientY - The client Y position of interest.\n *\n * @returns The geometry of the tab area at the given position, or\n * `null` if there is no tab area at the given position.\n */\n hitTestTabAreas(\n clientX: number,\n clientY: number\n ): DockLayout.ITabAreaGeometry | null {\n // Bail early if hit testing cannot produce valid results.\n if (!this._root || !this.parent || !this.parent.isVisible) {\n return null;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent.node);\n }\n\n // Convert from client to local coordinates.\n let rect = this.parent.node.getBoundingClientRect();\n let x = clientX - rect.left - this._box.borderLeft;\n let y = clientY - rect.top - this._box.borderTop;\n\n // Find the tab layout node at the local position.\n let tabNode = this._root.hitTestTabNodes(x, y);\n\n // Bail if a tab layout node was not found.\n if (!tabNode) {\n return null;\n }\n\n // Extract the data from the tab node.\n let { tabBar, top, left, width, height } = tabNode;\n\n // Compute the right and bottom edges of the tab area.\n let borderWidth = this._box.borderLeft + this._box.borderRight;\n let borderHeight = this._box.borderTop + this._box.borderBottom;\n let right = rect.width - borderWidth - (left + width);\n let bottom = rect.height - borderHeight - (top + height);\n\n // Return the hit test results.\n return { tabBar, x, y, top, left, right, bottom, width, height };\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n // Perform superclass initialization.\n super.init();\n\n // Attach each widget to the parent.\n for (const widget of this) {\n this.attachWidget(widget);\n }\n\n // Attach each handle to the parent.\n for (const handle of this.handles()) {\n this.parent!.node.appendChild(handle);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Attach the widget to the layout parent widget.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a no-op if the widget is already attached.\n */\n protected attachWidget(widget: Widget): void {\n // Do nothing if the widget is already attached.\n if (this.parent!.node === widget.node.parentNode) {\n return;\n }\n\n // Create the layout item for the widget.\n this._items.set(widget, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach the widget from the layout parent widget.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a no-op if the widget is not attached.\n */\n protected detachWidget(widget: Widget): void {\n // Do nothing if the widget is not attached.\n if (this.parent!.node !== widget.node.parentNode) {\n return;\n }\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Delete the layout item for the widget.\n let item = this._items.get(widget);\n if (item) {\n this._items.delete(widget);\n item.dispose();\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Remove the specified widget from the layout structure.\n *\n * #### Notes\n * This is a no-op if the widget is not in the layout tree.\n *\n * This does not detach the widget from the parent node.\n */\n private _removeWidget(widget: Widget): void {\n // Bail early if there is no layout root.\n if (!this._root) {\n return;\n }\n\n // Find the tab node which contains the given widget.\n let tabNode = this._root.findTabNode(widget);\n\n // Bail early if the tab node is not found.\n if (!tabNode) {\n return;\n }\n\n Private.removeAria(widget);\n\n // If there are multiple tabs, just remove the widget's tab.\n if (tabNode.tabBar.titles.length > 1) {\n tabNode.tabBar.removeTab(widget.title);\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n tabNode.tabBar.titles.length == 1\n ) {\n const existingWidget = tabNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Display;\n }\n return;\n }\n\n // Otherwise, the tab node needs to be removed...\n\n // Dispose the tab bar.\n tabNode.tabBar.dispose();\n\n // Handle the case where the tab node is the root.\n if (this._root === tabNode) {\n this._root = null;\n return;\n }\n\n // Otherwise, remove the tab node from its parent...\n\n // Prevent widget resizing unless needed.\n this._root.holdAllSizes();\n\n // Clear the parent reference on the tab node.\n let splitNode = tabNode.parent!;\n tabNode.parent = null;\n\n // Remove the tab node from its parent split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n ArrayExt.removeAt(splitNode.sizers, i);\n\n // Remove the handle from its parent DOM node.\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n\n // If there are multiple children, just update the handles.\n if (splitNode.children.length > 1) {\n splitNode.syncHandles();\n return;\n }\n\n // Otherwise, the split node also needs to be removed...\n\n // Clear the parent reference on the split node.\n let maybeParent = splitNode.parent;\n splitNode.parent = null;\n\n // Lookup the remaining child node and handle.\n let childNode = splitNode.children[0];\n let childHandle = splitNode.handles[0];\n\n // Clear the split node data.\n splitNode.children.length = 0;\n splitNode.handles.length = 0;\n splitNode.sizers.length = 0;\n\n // Remove the child handle from its parent node.\n if (childHandle.parentNode) {\n childHandle.parentNode.removeChild(childHandle);\n }\n\n // Handle the case where the split node is the root.\n if (this._root === splitNode) {\n childNode.parent = null;\n this._root = childNode;\n return;\n }\n\n // Otherwise, move the child node to the parent node...\n let parentNode = maybeParent!;\n\n // Lookup the index of the split node.\n let j = parentNode.children.indexOf(splitNode);\n\n // Handle the case where the child node is a tab node.\n if (childNode instanceof Private.TabLayoutNode) {\n childNode.parent = parentNode;\n parentNode.children[j] = childNode;\n return;\n }\n\n // Remove the split data from the parent.\n let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n ArrayExt.removeAt(parentNode.children, j);\n ArrayExt.removeAt(parentNode.sizers, j);\n\n // Remove the handle from its parent node.\n if (splitHandle.parentNode) {\n splitHandle.parentNode.removeChild(splitHandle);\n }\n\n // The child node and the split parent node will have the same\n // orientation. Merge the grand-children with the parent node.\n for (let i = 0, n = childNode.children.length; i < n; ++i) {\n let gChild = childNode.children[i];\n let gHandle = childNode.handles[i];\n let gSizer = childNode.sizers[i];\n ArrayExt.insert(parentNode.children, j + i, gChild);\n ArrayExt.insert(parentNode.handles, j + i, gHandle);\n ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n gChild.parent = parentNode;\n }\n\n // Clear the child node.\n childNode.children.length = 0;\n childNode.handles.length = 0;\n childNode.sizers.length = 0;\n childNode.parent = null;\n\n // Sync the handles on the parent node.\n parentNode.syncHandles();\n }\n\n /**\n * Create the tab layout node to hold the widget.\n */\n private _createTabNode(widget: Widget): Private.TabLayoutNode {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n Private.addAria(widget, tabNode.tabBar);\n return tabNode;\n }\n\n /**\n * Insert a widget next to an existing tab.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertTab(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n after: boolean\n ): void {\n // Do nothing if the tab is inserted next to itself.\n if (widget === ref) {\n return;\n }\n\n // Create the root if it does not exist.\n if (!this._root) {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n this._root = tabNode;\n Private.addAria(widget, tabNode.tabBar);\n return;\n }\n\n // Use the first tab node as the ref node if needed.\n if (!refNode) {\n refNode = this._root.findFirstTabNode()!;\n }\n\n // If the widget is not contained in the ref node, ensure it is\n // removed from the layout and hidden before being added again.\n if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n this._removeWidget(widget);\n widget.hide();\n }\n\n // Lookup the target index for inserting the tab.\n let index: number;\n if (ref) {\n index = refNode.tabBar.titles.indexOf(ref.title);\n } else {\n index = refNode.tabBar.currentIndex;\n }\n\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n if (refNode.tabBar.titles.length === 0) {\n // Singular tab should use display mode to limit number of layers.\n widget.hiddenMode = Widget.HiddenMode.Display;\n } else if (refNode.tabBar.titles.length == 1) {\n // If we are adding a second tab, switch the existing tab back to scale.\n const existingWidget = refNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n // For the third and subsequent tabs no special action is needed.\n widget.hiddenMode = Widget.HiddenMode.Scale;\n }\n } else {\n // For all other modes just propagate the current mode.\n widget.hiddenMode = this._hiddenMode;\n }\n\n // Insert the widget's tab relative to the target index.\n refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n Private.addAria(widget, refNode.tabBar);\n }\n\n /**\n * Insert a widget as a new split area.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertSplit(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n orientation: Private.Orientation,\n after: boolean,\n merge: boolean = false\n ): void {\n // Do nothing if there is no effective split.\n if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n return;\n }\n\n // Ensure the widget is removed from the current layout.\n this._removeWidget(widget);\n\n // Set the root if it does not exist.\n if (!this._root) {\n this._root = this._createTabNode(widget);\n return;\n }\n\n // If the ref node parent is null, split the root.\n if (!refNode || !refNode.parent) {\n // Ensure the root is split with the correct orientation.\n let root = this._splitRoot(orientation);\n\n // Determine the insert index for the new tab node.\n let i = after ? root.children.length : 0;\n\n // Normalize the split node.\n root.normalizeSizes();\n\n // Create the sizer for new tab node.\n let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n // Insert the tab node sized to the golden ratio.\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(root.children, i, tabNode);\n ArrayExt.insert(root.sizers, i, sizer);\n ArrayExt.insert(root.handles, i, this._createHandle());\n tabNode.parent = root;\n\n // Re-normalize the split node to maintain the ratios.\n root.normalizeSizes();\n\n // Finally, synchronize the visibility of the handles.\n root.syncHandles();\n return;\n }\n\n // Lookup the split node for the ref widget.\n let splitNode = refNode.parent;\n\n // If the split node already had the correct orientation,\n // the widget can be inserted into the split node directly.\n if (splitNode.orientation === orientation) {\n // Find the index of the ref node.\n let i = splitNode.children.indexOf(refNode);\n\n // Conditionally reuse a tab layout found in the wanted position.\n if (merge) {\n let j = i + (after ? 1 : -1);\n let sibling = splitNode.children[j];\n if (sibling instanceof Private.TabLayoutNode) {\n this._insertTab(widget, null, sibling, true);\n ++sibling.tabBar.currentIndex;\n return;\n }\n }\n\n // Normalize the split node.\n splitNode.normalizeSizes();\n\n // Consume half the space for the insert location.\n let s = (splitNode.sizers[i].sizeHint /= 2);\n\n // Insert the tab node sized to the other half.\n let j = i + (after ? 1 : 0);\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(splitNode.children, j, tabNode);\n ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n ArrayExt.insert(splitNode.handles, j, this._createHandle());\n tabNode.parent = splitNode;\n\n // Finally, synchronize the visibility of the handles.\n splitNode.syncHandles();\n return;\n }\n\n // Remove the ref node from the split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n // Create a new normalized split node for the children.\n let childNode = new Private.SplitLayoutNode(orientation);\n childNode.normalized = true;\n\n // Add the ref node sized to half the space.\n childNode.children.push(refNode);\n childNode.sizers.push(Private.createSizer(0.5));\n childNode.handles.push(this._createHandle());\n refNode.parent = childNode;\n\n // Add the tab node sized to the other half.\n let j = after ? 1 : 0;\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(childNode.children, j, tabNode);\n ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n ArrayExt.insert(childNode.handles, j, this._createHandle());\n tabNode.parent = childNode;\n\n // Synchronize the visibility of the handles.\n childNode.syncHandles();\n\n // Finally, add the new child node to the original split node.\n ArrayExt.insert(splitNode.children, i, childNode);\n childNode.parent = splitNode;\n }\n\n /**\n * Ensure the root is a split node with the given orientation.\n */\n private _splitRoot(\n orientation: Private.Orientation\n ): Private.SplitLayoutNode {\n // Bail early if the root already meets the requirements.\n let oldRoot = this._root;\n if (oldRoot instanceof Private.SplitLayoutNode) {\n if (oldRoot.orientation === orientation) {\n return oldRoot;\n }\n }\n\n // Create a new root node with the specified orientation.\n let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n // Add the old root to the new root.\n if (oldRoot) {\n newRoot.children.push(oldRoot);\n newRoot.sizers.push(Private.createSizer(0));\n newRoot.handles.push(this._createHandle());\n oldRoot.parent = newRoot;\n }\n\n // Return the new root as a convenience.\n return newRoot;\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the size limits for the layout tree.\n if (this._root) {\n let limits = this._root.fit(this._spacing, this._items);\n minW = limits.minWidth;\n minH = limits.minHeight;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Bail early if there is no root layout node.\n if (!this._root) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let x = this._box.paddingTop;\n let y = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the geometry of the layout tree.\n this._root.update(x, y, width, height, this._spacing, this._items);\n }\n\n /**\n * Create a new tab bar for use by the dock layout.\n *\n * #### Notes\n * The tab bar will be attached to the parent if it exists.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar using the renderer.\n let tabBar = this.renderer.createTabBar(this._document);\n\n // Enforce necessary tab bar behavior.\n tabBar.orientation = 'horizontal';\n\n // Attach the tab bar to the parent if possible.\n if (this.parent) {\n this.attachWidget(tabBar);\n }\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for the dock layout.\n *\n * #### Notes\n * The handle will be attached to the parent if it exists.\n */\n private _createHandle(): HTMLDivElement {\n // Create the handle using the renderer.\n let handle = this.renderer.createHandle();\n\n // Initialize the handle layout behavior.\n let style = handle.style;\n style.position = 'absolute';\n style.contain = 'strict';\n style.top = '0';\n style.left = '0';\n style.width = '0';\n style.height = '0';\n\n // Attach the handle to the parent if it exists.\n if (this.parent) {\n this.parent.node.appendChild(handle);\n }\n\n // Return the initialized handle.\n return handle;\n }\n\n private _spacing = 4;\n private _dirty = false;\n private _root: Private.LayoutNode | null = null;\n private _box: ElementExt.IBoxSizing | null = null;\n private _document: Document | ShadowRoot;\n private _hiddenMode: Widget.HiddenMode;\n private _items: Private.ItemMap = new Map();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n /**\n * An options object for creating a dock layout.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * The renderer to use for the dock layout.\n */\n renderer: IRenderer;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a dock layout.\n */\n export interface IRenderer {\n /**\n * Create a new tab bar for use with a dock layout.\n *\n * @returns A new tab bar for a dock layout.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar;\n\n /**\n * Create a new handle node for use with a dock layout.\n *\n * @returns A new handle node for a dock layout.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * A type alias for the supported insertion modes.\n *\n * An insert mode is used to specify how a widget should be added\n * to the dock layout relative to a reference widget.\n */\n export type InsertMode =\n | /**\n * The area to the top of the reference widget.\n *\n * The widget will be inserted just above the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the top edge of the dock layout.\n */\n 'split-top'\n\n /**\n * The area to the left of the reference widget.\n *\n * The widget will be inserted just left of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the left edge of the dock layout.\n */\n | 'split-left'\n\n /**\n * The area to the right of the reference widget.\n *\n * The widget will be inserted just right of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the right edge of the dock layout.\n */\n | 'split-right'\n\n /**\n * The area to the bottom of the reference widget.\n *\n * The widget will be inserted just below the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the bottom edge of the dock layout.\n */\n | 'split-bottom'\n\n /**\n * Like `split-top` but if a tab layout exists above the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-top'\n\n /**\n * Like `split-left` but if a tab layout exists left of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-left'\n\n /**\n * Like `split-right` but if a tab layout exists right of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-right'\n\n /**\n * Like `split-bottom` but if a tab layout exists below the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-bottom'\n\n /**\n * The tab position before the reference widget.\n *\n * The widget will be added as a tab before the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-before'\n\n /**\n * The tab position after the reference widget.\n *\n * The widget will be added as a tab after the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-after';\n\n /**\n * An options object for adding a widget to the dock layout.\n */\n export interface IAddOptions {\n /**\n * The insertion mode for adding the widget.\n *\n * The default is `'tab-after'`.\n */\n mode?: InsertMode;\n\n /**\n * The reference widget for the insert location.\n *\n * The default is `null`.\n */\n ref?: Widget | null;\n }\n\n /**\n * A layout config object for a tab area.\n */\n export interface ITabAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'tab-area';\n\n /**\n * The widgets contained in the tab area.\n */\n widgets: Widget[];\n\n /**\n * The index of the selected tab.\n */\n currentIndex: number;\n }\n\n /**\n * A layout config object for a split area.\n */\n export interface ISplitAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'split-area';\n\n /**\n * The orientation of the split area.\n */\n orientation: 'horizontal' | 'vertical';\n\n /**\n * The children in the split area.\n */\n children: AreaConfig[];\n\n /**\n * The relative sizes of the children.\n */\n sizes: number[];\n }\n\n /**\n * A type alias for a general area config.\n */\n export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n /**\n * A dock layout configuration object.\n */\n export interface ILayoutConfig {\n /**\n * The layout config for the main dock area.\n */\n main: AreaConfig | null;\n }\n\n /**\n * An object which represents the geometry of a tab area.\n */\n export interface ITabAreaGeometry {\n /**\n * The tab bar for the tab area.\n */\n tabBar: TabBar;\n\n /**\n * The local X position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the local X coordinate of the hit test query.\n */\n x: number;\n\n /**\n * The local Y position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the local Y coordinate of the hit test query.\n */\n y: number;\n\n /**\n * The local coordinate of the top edge of the tab area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the top edge of the tab area.\n */\n top: number;\n\n /**\n * The local coordinate of the left edge of the tab area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the left edge of the tab area.\n */\n left: number;\n\n /**\n * The local coordinate of the right edge of the tab area.\n *\n * #### Notes\n * This is the distance from the right edge of the layout parent\n * widget, to the right edge of the tab area.\n */\n right: number;\n\n /**\n * The local coordinate of the bottom edge of the tab area.\n *\n * #### Notes\n * This is the distance from the bottom edge of the layout parent\n * widget, to the bottom edge of the tab area.\n */\n bottom: number;\n\n /**\n * The width of the tab area.\n *\n * #### Notes\n * This is total width allocated for the tab area.\n */\n width: number;\n\n /**\n * The height of the tab area.\n *\n * #### Notes\n * This is total height allocated for the tab area.\n */\n height: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * A type alias for a dock layout node.\n */\n export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n /**\n * A type alias for the orientation of a split layout node.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a layout item map.\n */\n export type ItemMap = Map;\n\n /**\n * Create a box sizer with an initial size hint.\n */\n export function createSizer(hint: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = hint;\n sizer.size = hint;\n return sizer;\n }\n\n /**\n * Normalize an area config object and collect the visited widgets.\n */\n export function normalizeAreaConfig(\n config: DockLayout.AreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n let result: DockLayout.AreaConfig | null;\n if (config.type === 'tab-area') {\n result = normalizeTabAreaConfig(config, widgetSet);\n } else {\n result = normalizeSplitAreaConfig(config, widgetSet);\n }\n return result;\n }\n\n /**\n * Convert a normalized area config into a layout tree.\n */\n export function realizeAreaConfig(\n config: DockLayout.AreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): LayoutNode {\n let node: LayoutNode;\n if (config.type === 'tab-area') {\n node = realizeTabAreaConfig(config, renderer, document);\n } else {\n node = realizeSplitAreaConfig(config, renderer, document);\n }\n return node;\n }\n\n /**\n * A layout node which holds the data for a tabbed area.\n */\n export class TabLayoutNode {\n /**\n * Construct a new tab layout node.\n *\n * @param tabBar - The tab bar to use for the layout node.\n */\n constructor(tabBar: TabBar) {\n let tabSizer = new BoxSizer();\n let widgetSizer = new BoxSizer();\n tabSizer.stretch = 0;\n widgetSizer.stretch = 1;\n this.tabBar = tabBar;\n this.sizers = [tabSizer, widgetSizer];\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * The tab bar for the layout node.\n */\n readonly tabBar: TabBar;\n\n /**\n * The sizers for the layout node.\n */\n readonly sizers: [BoxSizer, BoxSizer];\n\n /**\n * The most recent value for the `top` edge of the layout box.\n */\n get top(): number {\n return this._top;\n }\n\n /**\n * The most recent value for the `left` edge of the layout box.\n */\n get left(): number {\n return this._left;\n }\n\n /**\n * The most recent value for the `width` of the layout box.\n */\n get width(): number {\n return this._width;\n }\n\n /**\n * The most recent value for the `height` of the layout box.\n */\n get height(): number {\n return this._height;\n }\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n yield this.tabBar;\n yield* this.iterUserWidgets();\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const title of this.tabBar.titles) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n let title = this.tabBar.currentTitle;\n if (title) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n yield this.tabBar;\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n // eslint-disable-next-line require-yield\n *iterHandles(): IterableIterator {\n return;\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n return this;\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n if (x < this._left || x >= this._left + this._width) {\n return null;\n }\n if (y < this._top || y >= this._top + this._height) {\n return null;\n }\n return this;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ITabAreaConfig {\n let widgets = this.tabBar.titles.map(title => title.owner);\n let currentIndex = this.tabBar.currentIndex;\n return { type: 'tab-area', widgets, currentIndex };\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n return;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Set up the limit variables.\n let minWidth = 0;\n let minHeight = 0;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Lookup the tab bar and widget sizers.\n let [tabBarSizer, widgetSizer] = this.sizers;\n\n // Update the tab bar limits.\n if (tabBarItem) {\n tabBarItem.fit();\n }\n\n // Update the widget limits.\n if (widgetItem) {\n widgetItem.fit();\n }\n\n // Update the results and sizer for the tab bar.\n if (tabBarItem && !tabBarItem.isHidden) {\n minWidth = Math.max(minWidth, tabBarItem.minWidth);\n minHeight += tabBarItem.minHeight;\n tabBarSizer.minSize = tabBarItem.minHeight;\n tabBarSizer.maxSize = tabBarItem.maxHeight;\n } else {\n tabBarSizer.minSize = 0;\n tabBarSizer.maxSize = 0;\n }\n\n // Update the results and sizer for the current widget.\n if (widgetItem && !widgetItem.isHidden) {\n minWidth = Math.max(minWidth, widgetItem.minWidth);\n minHeight += widgetItem.minHeight;\n widgetSizer.minSize = widgetItem.minHeight;\n widgetSizer.maxSize = Infinity;\n } else {\n widgetSizer.minSize = 0;\n widgetSizer.maxSize = Infinity;\n }\n\n // Return the computed size limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Update the layout box values.\n this._top = top;\n this._left = left;\n this._width = width;\n this._height = height;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, height);\n\n // Update the tab bar item using the computed size.\n if (tabBarItem && !tabBarItem.isHidden) {\n let size = this.sizers[0].size;\n tabBarItem.update(left, top, width, size);\n top += size;\n }\n\n // Layout the widget using the computed size.\n if (widgetItem && !widgetItem.isHidden) {\n let size = this.sizers[1].size;\n widgetItem.update(left, top, width, size);\n }\n }\n\n private _top = 0;\n private _left = 0;\n private _width = 0;\n private _height = 0;\n }\n\n /**\n * A layout node which holds the data for a split area.\n */\n export class SplitLayoutNode {\n /**\n * Construct a new split layout node.\n *\n * @param orientation - The orientation of the node.\n */\n constructor(orientation: Orientation) {\n this.orientation = orientation;\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * Whether the sizers have been normalized.\n */\n normalized = false;\n\n /**\n * The orientation of the node.\n */\n readonly orientation: Orientation;\n\n /**\n * The child nodes for the split node.\n */\n readonly children: LayoutNode[] = [];\n\n /**\n * The box sizers for the layout children.\n */\n readonly sizers: BoxSizer[] = [];\n\n /**\n * The handles for the layout children.\n */\n readonly handles: HTMLDivElement[] = [];\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterAllWidgets();\n }\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterUserWidgets();\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterSelectedWidgets();\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n for (const child of this.children) {\n yield* child.iterTabBars();\n }\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n *iterHandles(): IterableIterator {\n yield* this.handles;\n for (const child of this.children) {\n yield* child.iterHandles();\n }\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findTabNode(widget);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n let index = this.handles.indexOf(handle);\n if (index !== -1) {\n return { index, node: this };\n }\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findSplitNode(handle);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n if (this.children.length === 0) {\n return null;\n }\n return this.children[0].findFirstTabNode();\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].hitTestTabNodes(x, y);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ISplitAreaConfig {\n let orientation = this.orientation;\n let sizes = this.createNormalizedSizes();\n let children = this.children.map(child => child.createConfig());\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Sync the visibility and orientation of the handles.\n */\n syncHandles(): void {\n this.handles.forEach((handle, i) => {\n handle.setAttribute('data-orientation', this.orientation);\n if (i === this.handles.length - 1) {\n handle.classList.add('lm-mod-hidden');\n } else {\n handle.classList.remove('lm-mod-hidden');\n }\n });\n }\n\n /**\n * Hold the current sizes of the box sizers.\n *\n * This sets the size hint of each sizer to its current size.\n */\n holdSizes(): void {\n for (const sizer of this.sizers) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n for (const child of this.children) {\n child.holdAllSizes();\n }\n this.holdSizes();\n }\n\n /**\n * Normalize the sizes of the split layout node.\n */\n normalizeSizes(): void {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return;\n }\n\n // Hold the current sizes of the sizers.\n this.holdSizes();\n\n // Compute the sum of the sizes.\n let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint = 1 / n;\n }\n } else {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint /= sum;\n }\n }\n\n // Mark the sizes as normalized.\n this.normalized = true;\n }\n\n /**\n * Snap the normalized sizes of the split layout node.\n */\n createNormalizedSizes(): number[] {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return [];\n }\n\n // Grab the current sizes of the sizers.\n let sizes = this.sizers.map(sizer => sizer.size);\n\n // Compute the sum of the sizes.\n let sum = sizes.reduce((v, size) => v + size, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] = 1 / n;\n }\n } else {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] /= sum;\n }\n }\n\n // Return the normalized sizes.\n return sizes;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Compute the required fixed space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n // Set up the limit variables.\n let minWidth = horizontal ? fixed : 0;\n let minHeight = horizontal ? 0 : fixed;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Fit the children and update the limits.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let limits = this.children[i].fit(spacing, items);\n if (horizontal) {\n minHeight = Math.max(minHeight, limits.minHeight);\n minWidth += limits.minWidth;\n this.sizers[i].minSize = limits.minWidth;\n } else {\n minWidth = Math.max(minWidth, limits.minWidth);\n minHeight += limits.minHeight;\n this.sizers[i].minSize = limits.minHeight;\n }\n }\n\n // Return the computed limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Compute the available layout space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n // De-normalize the sizes if needed.\n if (this.normalized) {\n for (const sizer of this.sizers) {\n sizer.sizeHint *= space;\n }\n this.normalized = false;\n }\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, space);\n\n // Update the geometry of the child nodes and handles.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let child = this.children[i];\n let size = this.sizers[i].size;\n let handleStyle = this.handles[i].style;\n if (horizontal) {\n child.update(left, top, size, height, spacing, items);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${spacing}px`;\n handleStyle.height = `${height}px`;\n left += spacing;\n } else {\n child.update(left, top, width, size, spacing, items);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${spacing}px`;\n top += spacing;\n }\n }\n }\n }\n\n export function addAria(widget: Widget, tabBar: TabBar): void {\n widget.node.setAttribute('role', 'tabpanel');\n let renderer = tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n export function removeAria(widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n }\n\n /**\n * Normalize a tab area config and collect the visited widgets.\n */\n function normalizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n widgetSet: Set\n ): DockLayout.ITabAreaConfig | null {\n // Bail early if there is no content.\n if (config.widgets.length === 0) {\n return null;\n }\n\n // Setup the filtered widgets array.\n let widgets: Widget[] = [];\n\n // Filter the config for unique widgets.\n for (const widget of config.widgets) {\n if (!widgetSet.has(widget)) {\n widgetSet.add(widget);\n widgets.push(widget);\n }\n }\n\n // Bail if there are no effective widgets.\n if (widgets.length === 0) {\n return null;\n }\n\n // Normalize the current index.\n let index = config.currentIndex;\n if (index !== -1 && (index < 0 || index >= widgets.length)) {\n index = 0;\n }\n\n // Return a normalized config object.\n return { type: 'tab-area', widgets, currentIndex: index };\n }\n\n /**\n * Normalize a split area config and collect the visited widgets.\n */\n function normalizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n // Set up the result variables.\n let orientation = config.orientation;\n let children: DockLayout.AreaConfig[] = [];\n let sizes: number[] = [];\n\n // Normalize the config children.\n for (let i = 0, n = config.children.length; i < n; ++i) {\n // Normalize the child config.\n let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n // Ignore an empty child.\n if (!child) {\n continue;\n }\n\n // Add the child or hoist its content as appropriate.\n if (child.type === 'tab-area' || child.orientation !== orientation) {\n children.push(child);\n sizes.push(Math.abs(config.sizes[i] || 0));\n } else {\n children.push(...child.children);\n sizes.push(...child.sizes);\n }\n }\n\n // Bail if there are no effective children.\n if (children.length === 0) {\n return null;\n }\n\n // If there is only one effective child, return that child.\n if (children.length === 1) {\n return children[0];\n }\n\n // Return a normalized config object.\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Convert a normalized tab area config into a layout tree.\n */\n function realizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): TabLayoutNode {\n // Create the tab bar for the layout node.\n let tabBar = renderer.createTabBar(document);\n\n // Hide each widget and add it to the tab bar.\n for (const widget of config.widgets) {\n widget.hide();\n tabBar.addTab(widget.title);\n Private.addAria(widget, tabBar);\n }\n\n // Set the current index of the tab bar.\n tabBar.currentIndex = config.currentIndex;\n\n // Return the new tab layout node.\n return new TabLayoutNode(tabBar);\n }\n\n /**\n * Convert a normalized split area config into a layout tree.\n */\n function realizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): SplitLayoutNode {\n // Create the split layout node.\n let node = new SplitLayoutNode(config.orientation);\n\n // Add each child to the layout node.\n config.children.forEach((child, i) => {\n // Create the child data for the layout node.\n let childNode = realizeAreaConfig(child, renderer, document);\n let sizer = createSizer(config.sizes[i]);\n let handle = renderer.createHandle();\n\n // Add the child data to the layout node.\n node.children.push(childNode);\n node.handles.push(handle);\n node.sizers.push(sizer);\n\n // Update the parent for the child node.\n childNode.parent = node;\n });\n\n // Synchronize the handle state for the layout node.\n node.syncHandles();\n\n // Normalize the sizes for the layout node.\n node.normalizeSizes();\n\n // Return the new layout node.\n return node;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n */\nexport class DockPanel extends Widget {\n /**\n * Construct a new dock panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: DockPanel.IOptions = {}) {\n super();\n this.addClass('lm-DockPanel');\n this._document = options.document || document;\n this._mode = options.mode || 'multiple-document';\n this._renderer = options.renderer || DockPanel.defaultRenderer;\n this._edges = options.edges || Private.DEFAULT_EDGES;\n if (options.tabsMovable !== undefined) {\n this._tabsMovable = options.tabsMovable;\n }\n if (options.tabsConstrained !== undefined) {\n this._tabsConstrained = options.tabsConstrained;\n }\n if (options.addButtonEnabled !== undefined) {\n this._addButtonEnabled = options.addButtonEnabled;\n }\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = this._mode;\n\n // Create the delegate renderer for the layout.\n let renderer: DockPanel.IRenderer = {\n createTabBar: () => this._createTabBar(),\n createHandle: () => this._createHandle()\n };\n\n // Set up the dock layout for the panel.\n this.layout = new DockLayout({\n document: this._document,\n renderer,\n spacing: options.spacing,\n hiddenMode: options.hiddenMode\n });\n\n // Set up the overlay drop indicator.\n this.overlay = options.overlay || new DockPanel.Overlay();\n this.node.appendChild(this.overlay.node);\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n // Ensure the mouse is released.\n this._releaseMouse();\n\n // Hide the overlay.\n this.overlay.hide(0);\n\n // Cancel a drag if one is in progress.\n if (this._drag) {\n this._drag.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The method for hiding widgets.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as DockLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as DockLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when the layout configuration is modified.\n *\n * #### Notes\n * This signal is emitted whenever the current layout configuration\n * may have changed.\n *\n * This signal is emitted asynchronously in a collapsed fashion, so\n * that multiple synchronous modifications results in only a single\n * emit of the signal.\n */\n get layoutModified(): ISignal {\n return this._layoutModified;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The overlay used by the dock panel.\n */\n readonly overlay: DockPanel.IOverlay;\n\n /**\n * The renderer used by the dock panel.\n */\n get renderer(): DockPanel.IRenderer {\n return (this.layout as DockLayout).renderer;\n }\n\n /**\n * Get the spacing between the widgets.\n */\n get spacing(): number {\n return (this.layout as DockLayout).spacing;\n }\n\n /**\n * Set the spacing between the widgets.\n */\n set spacing(value: number) {\n (this.layout as DockLayout).spacing = value;\n }\n\n /**\n * Get the mode for the dock panel.\n */\n get mode(): DockPanel.Mode {\n return this._mode;\n }\n\n /**\n * Set the mode for the dock panel.\n *\n * #### Notes\n * Changing the mode is a destructive operation with respect to the\n * panel's layout configuration. If layout state must be preserved,\n * save the current layout config before changing the mode.\n */\n set mode(value: DockPanel.Mode) {\n // Bail early if the mode does not change.\n if (this._mode === value) {\n return;\n }\n\n // Update the internal mode.\n this._mode = value;\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = value;\n\n // Get the layout for the panel.\n let layout = this.layout as DockLayout;\n\n // Configure the layout for the specified mode.\n switch (value) {\n case 'multiple-document':\n for (const tabBar of layout.tabBars()) {\n tabBar.show();\n }\n break;\n case 'single-document':\n layout.restoreLayout(Private.createSingleDocumentConfig(this));\n break;\n default:\n throw 'unreachable';\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Whether the tabs can be dragged / moved at runtime.\n */\n get tabsMovable(): boolean {\n return this._tabsMovable;\n }\n\n /**\n * Enable / Disable draggable / movable tabs.\n */\n set tabsMovable(value: boolean) {\n this._tabsMovable = value;\n for (const tabBar of this.tabBars()) {\n tabBar.tabsMovable = value;\n }\n }\n\n /**\n * Whether the tabs are constrained to their source dock panel\n */\n get tabsConstrained(): boolean {\n return this._tabsConstrained;\n }\n\n /**\n * Constrain/Allow tabs to be dragged outside of this dock panel\n */\n set tabsConstrained(value: boolean) {\n this._tabsConstrained = value;\n }\n\n /**\n * Whether the add buttons for each tab bar are enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add buttons for each tab bar are enabled.\n */\n set addButtonEnabled(value: boolean) {\n this._addButtonEnabled = value;\n for (const tabBar of this.tabBars()) {\n tabBar.addButtonEnabled = value;\n }\n }\n\n /**\n * Whether the dock panel is empty.\n */\n get isEmpty(): boolean {\n return (this.layout as DockLayout).isEmpty;\n }\n\n /**\n * Create an iterator over the user widgets in the panel.\n *\n * @returns A new iterator over the user widgets in the panel.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n *widgets(): IterableIterator {\n yield* (this.layout as DockLayout).widgets();\n }\n\n /**\n * Create an iterator over the selected widgets in the panel.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the panel.\n */\n *selectedWidgets(): IterableIterator {\n yield* (this.layout as DockLayout).selectedWidgets();\n }\n\n /**\n * Create an iterator over the tab bars in the panel.\n *\n * @returns A new iterator over the tab bars in the panel.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n *tabBars(): IterableIterator> {\n yield* (this.layout as DockLayout).tabBars();\n }\n\n /**\n * Create an iterator over the handles in the panel.\n *\n * @returns A new iterator over the handles in the panel.\n */\n *handles(): IterableIterator {\n yield* (this.layout as DockLayout).handles();\n }\n\n /**\n * Select a specific widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will make the widget the current widget in its tab area.\n */\n selectWidget(widget: Widget): void {\n // Find the tab bar which contains the widget.\n let tabBar = find(this.tabBars(), bar => {\n return bar.titles.indexOf(widget.title) !== -1;\n });\n\n // Throw an error if no tab bar is found.\n if (!tabBar) {\n throw new Error('Widget is not contained in the dock panel.');\n }\n\n // Ensure the widget is the current widget.\n tabBar.currentTitle = widget.title;\n }\n\n /**\n * Activate a specified widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will select and activate the given widget.\n */\n activateWidget(widget: Widget): void {\n this.selectWidget(widget);\n widget.activate();\n }\n\n /**\n * Save the current layout configuration of the dock panel.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockPanel.ILayoutConfig {\n return (this.layout as DockLayout).saveLayout();\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n *\n * The dock panel automatically reverts to `'multiple-document'`\n * mode when a layout config is restored.\n */\n restoreLayout(config: DockPanel.ILayoutConfig): void {\n // Reset the mode.\n this._mode = 'multiple-document';\n\n // Restore the layout.\n (this.layout as DockLayout).restoreLayout(config);\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Add a widget to the dock panel.\n *\n * @param widget - The widget to add to the dock panel.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * If the panel is in single document mode, the options are ignored\n * and the widget is always added as tab in the hidden tab bar.\n */\n addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n // Add the widget to the layout.\n if (this._mode === 'single-document') {\n (this.layout as DockLayout).addWidget(widget);\n } else {\n (this.layout as DockLayout).addWidget(widget, options);\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n */\n processMessage(msg: Message): void {\n if (msg.type === 'layout-modified') {\n this._layoutModified.emit(undefined);\n } else {\n super.processMessage(msg);\n }\n }\n\n /**\n * Handle the DOM events for the dock panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'lm-dragenter':\n this._evtDragEnter(event as Drag.Event);\n break;\n case 'lm-dragleave':\n this._evtDragLeave(event as Drag.Event);\n break;\n case 'lm-dragover':\n this._evtDragOver(event as Drag.Event);\n break;\n case 'lm-drop':\n this._evtDrop(event as Drag.Event);\n break;\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('lm-dragenter', this);\n this.node.addEventListener('lm-dragleave', this);\n this.node.addEventListener('lm-dragover', this);\n this.node.addEventListener('lm-drop', this);\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('lm-dragenter', this);\n this.node.removeEventListener('lm-dragleave', this);\n this.node.removeEventListener('lm-dragover', this);\n this.node.removeEventListener('lm-drop', this);\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Add the widget class to the child.\n msg.child.addClass('lm-DockPanel-widget');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Remove the widget class from the child.\n msg.child.removeClass('lm-DockPanel-widget');\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `'lm-dragenter'` event for the dock panel.\n */\n private _evtDragEnter(event: Drag.Event): void {\n // If the factory mime type is present, mark the event as\n // handled in order to get the rest of the drag events.\n if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handle the `'lm-dragleave'` event for the dock panel.\n */\n private _evtDragLeave(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n if (this._tabsConstrained && event.source !== this) return;\n\n event.stopPropagation();\n\n // The new target might be a descendant, so we might still handle the drop.\n // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n // hide is cancelled by the lm-dragover handler's show overlay logic.\n this.overlay.hide(1);\n }\n\n /**\n * Handle the `'lm-dragover'` event for the dock panel.\n */\n private _evtDragOver(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Show the drop indicator overlay and update the drop\n // action based on the drop target zone under the mouse.\n if (\n (this._tabsConstrained && event.source !== this) ||\n this._showOverlay(event.clientX, event.clientY) === 'invalid'\n ) {\n event.dropAction = 'none';\n } else {\n event.stopPropagation();\n event.dropAction = event.proposedAction;\n }\n }\n\n /**\n * Handle the `'lm-drop'` event for the dock panel.\n */\n private _evtDrop(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Hide the drop indicator overlay.\n this.overlay.hide(0);\n\n // Bail if the proposed action is to do nothing.\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n\n // Find the drop target under the mouse.\n let { clientX, clientY } = event;\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // Bail if the drop zone is invalid.\n if (\n (this._tabsConstrained && event.source !== this) ||\n zone === 'invalid'\n ) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory mime type has invalid data.\n let mimeData = event.mimeData;\n let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n if (typeof factory !== 'function') {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory does not produce a widget.\n let widget = factory();\n if (!(widget instanceof Widget)) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the widget is an ancestor of the dock panel.\n if (widget.contains(this)) {\n event.dropAction = 'none';\n return;\n }\n\n // Find the reference widget for the drop target.\n let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n // Add the widget according to the indicated drop zone.\n switch (zone) {\n case 'root-all':\n this.addWidget(widget);\n break;\n case 'root-top':\n this.addWidget(widget, { mode: 'split-top' });\n break;\n case 'root-left':\n this.addWidget(widget, { mode: 'split-left' });\n break;\n case 'root-right':\n this.addWidget(widget, { mode: 'split-right' });\n break;\n case 'root-bottom':\n this.addWidget(widget, { mode: 'split-bottom' });\n break;\n case 'widget-all':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n case 'widget-top':\n this.addWidget(widget, { mode: 'split-top', ref });\n break;\n case 'widget-left':\n this.addWidget(widget, { mode: 'split-left', ref });\n break;\n case 'widget-right':\n this.addWidget(widget, { mode: 'split-right', ref });\n break;\n case 'widget-bottom':\n this.addWidget(widget, { mode: 'split-bottom', ref });\n break;\n case 'widget-tab':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n default:\n throw 'unreachable';\n }\n\n // Accept the proposed drop action.\n event.dropAction = event.proposedAction;\n\n // Stop propagation if we have not bailed so far.\n event.stopPropagation();\n\n // Activate the dropped widget.\n this.activateWidget(widget);\n }\n\n /**\n * Handle the `'keydown'` event for the dock panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the dock panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the left mouse button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the mouse target, if any.\n let layout = this.layout as DockLayout;\n let target = event.target as HTMLElement;\n let handle = find(layout.handles(), handle => handle.contains(target));\n if (!handle) {\n return;\n }\n\n // Stop the event when a handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n this._document.addEventListener('keydown', this, true);\n this._document.addEventListener('pointerup', this, true);\n this._document.addEventListener('pointermove', this, true);\n this._document.addEventListener('contextmenu', this, true);\n\n // Compute the offset deltas for the handle press.\n let rect = handle.getBoundingClientRect();\n let deltaX = event.clientX - rect.left;\n let deltaY = event.clientY - rect.top;\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!, this._document);\n this._pressData = { handle, deltaX, deltaY, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the dock panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event when dragging a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let rect = this.node.getBoundingClientRect();\n let xPos = event.clientX - rect.left - this._pressData.deltaX;\n let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n // Set the handle as close to the desired position as possible.\n let layout = this.layout as DockLayout;\n layout.moveHandle(this._pressData.handle, xPos, yPos);\n }\n\n /**\n * Handle the `'pointerup'` event for the dock panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the left mouse button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Release the mouse grab for the dock panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra document listeners.\n this._document.removeEventListener('keydown', this, true);\n this._document.removeEventListener('pointerup', this, true);\n this._document.removeEventListener('pointermove', this, true);\n this._document.removeEventListener('contextmenu', this, true);\n }\n\n /**\n * Show the overlay indicator at the given client position.\n *\n * Returns the drop zone at the specified client position.\n *\n * #### Notes\n * If the position is not over a valid zone, the overlay is hidden.\n */\n private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n // Find the dock target for the given client position.\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // If the drop zone is invalid, hide the overlay and bail.\n if (zone === 'invalid') {\n this.overlay.hide(100);\n return zone;\n }\n\n // Setup the variables needed to compute the overlay geometry.\n let top: number;\n let left: number;\n let right: number;\n let bottom: number;\n let box = ElementExt.boxSizing(this.node); // TODO cache this?\n let rect = this.node.getBoundingClientRect();\n\n // Compute the overlay geometry based on the dock zone.\n switch (zone) {\n case 'root-all':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-top':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = rect.height * Private.GOLDEN_RATIO;\n break;\n case 'root-left':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = rect.width * Private.GOLDEN_RATIO;\n bottom = box.paddingBottom;\n break;\n case 'root-right':\n top = box.paddingTop;\n left = rect.width * Private.GOLDEN_RATIO;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-bottom':\n top = rect.height * Private.GOLDEN_RATIO;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'widget-all':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-top':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height / 2;\n break;\n case 'widget-left':\n top = target!.top;\n left = target!.left;\n right = target!.right + target!.width / 2;\n bottom = target!.bottom;\n break;\n case 'widget-right':\n top = target!.top;\n left = target!.left + target!.width / 2;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-bottom':\n top = target!.top + target!.height / 2;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-tab': {\n const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height - tabHeight;\n break;\n }\n default:\n throw 'unreachable';\n }\n\n // Show the overlay with the computed geometry.\n this.overlay.show({ top, left, right, bottom });\n\n // Finally, return the computed drop zone.\n return zone;\n }\n\n /**\n * Create a new tab bar for use by the panel.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar.\n let tabBar = this._renderer.createTabBar(this._document);\n\n // Set the generated tab bar property for the tab bar.\n Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n // Hide the tab bar when in single document mode.\n if (this._mode === 'single-document') {\n tabBar.hide();\n }\n\n // Enforce necessary tab bar behavior.\n // TODO do we really want to enforce *all* of these?\n tabBar.tabsMovable = this._tabsMovable;\n tabBar.allowDeselect = false;\n tabBar.addButtonEnabled = this._addButtonEnabled;\n tabBar.removeBehavior = 'select-previous-tab';\n tabBar.insertBehavior = 'select-tab-if-needed';\n\n // Connect the signal handlers for the tab bar.\n tabBar.tabMoved.connect(this._onTabMoved, this);\n tabBar.currentChanged.connect(this._onCurrentChanged, this);\n tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for use by the panel.\n */\n private _createHandle(): HTMLDivElement {\n return this._renderer.createHandle();\n }\n\n /**\n * Handle the `tabMoved` signal from a tab bar.\n */\n private _onTabMoved(): void {\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `currentChanged` signal from a tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousTitle, currentTitle } = args;\n\n // Hide the previous widget.\n if (previousTitle) {\n previousTitle.owner.hide();\n }\n\n // Show the current widget.\n if (currentTitle) {\n currentTitle.owner.show();\n }\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `addRequested` signal from a tab bar.\n */\n private _onTabAddRequested(sender: TabBar): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from a tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from a tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabDetachRequested` signal from a tab bar.\n */\n private _onTabDetachRequested(\n sender: TabBar,\n args: TabBar.ITabDetachRequestedArgs\n ): void {\n // Do nothing if a drag is already in progress.\n if (this._drag) {\n return;\n }\n\n // Release the tab bar's hold on the mouse.\n sender.releaseMouse();\n\n // Extract the data from the args.\n let { title, tab, clientX, clientY, offset } = args;\n\n // Setup the mime data for the drag operation.\n let mimeData = new MimeData();\n let factory = () => title.owner;\n mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n // Create the drag image for the drag operation.\n let dragImage = tab.cloneNode(true) as HTMLElement;\n if (offset) {\n dragImage.style.top = `-${offset.y}px`;\n dragImage.style.left = `-${offset.x}px`;\n }\n\n // Create the drag object to manage the drag-drop operation.\n this._drag = new Drag({\n document: this._document,\n mimeData,\n dragImage,\n proposedAction: 'move',\n supportedActions: 'move',\n source: this\n });\n\n // Hide the tab node in the original tab.\n tab.classList.add('lm-mod-hidden');\n let cleanup = () => {\n this._drag = null;\n tab.classList.remove('lm-mod-hidden');\n };\n\n // Start the drag operation and cleanup when done.\n this._drag.start(clientX, clientY).then(cleanup);\n }\n\n private _edges: DockPanel.IEdges;\n private _document: Document | ShadowRoot;\n private _mode: DockPanel.Mode;\n private _drag: Drag | null = null;\n private _renderer: DockPanel.IRenderer;\n private _tabsMovable: boolean = true;\n private _tabsConstrained: boolean = false;\n private _addButtonEnabled: boolean = false;\n private _pressData: Private.IPressData | null = null;\n private _layoutModified = new Signal(this);\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n /**\n * An options object for creating a dock panel.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n /**\n * The overlay to use with the dock panel.\n *\n * The default is a new `Overlay` instance.\n */\n overlay?: IOverlay;\n\n /**\n * The renderer to use for the dock panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The spacing between the items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The mode for the dock panel.\n *\n * The default is `'multiple-document'`.\n */\n mode?: DockPanel.Mode;\n\n /**\n * The sizes of the edge drop zones, in pixels.\n * If not given, default values will be used.\n */\n edges?: IEdges;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * Allow tabs to be draggable / movable by user.\n *\n * The default is `'true'`.\n */\n tabsMovable?: boolean;\n\n /**\n * Constrain tabs to this dock panel\n *\n * The default is `'false'`.\n */\n tabsConstrained?: boolean;\n\n /**\n * Enable add buttons in each of the dock panel's tab bars.\n *\n * The default is `'false'`.\n */\n addButtonEnabled?: boolean;\n }\n\n /**\n * The sizes of the edge drop zones, in pixels.\n */\n export interface IEdges {\n /**\n * The size of the top edge drop zone.\n */\n top: number;\n\n /**\n * The size of the right edge drop zone.\n */\n right: number;\n\n /**\n * The size of the bottom edge drop zone.\n */\n bottom: number;\n\n /**\n * The size of the left edge drop zone.\n */\n left: number;\n }\n\n /**\n * A type alias for the supported dock panel modes.\n */\n export type Mode =\n | /**\n * The single document mode.\n *\n * In this mode, only a single widget is visible at a time, and that\n * widget fills the available layout space. No tab bars are visible.\n */\n 'single-document'\n\n /**\n * The multiple document mode.\n *\n * In this mode, multiple documents are displayed in separate tab\n * areas, and those areas can be individually resized by the user.\n */\n | 'multiple-document';\n\n /**\n * A type alias for a layout configuration object.\n */\n export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n /**\n * A type alias for the supported insertion modes.\n */\n export type InsertMode = DockLayout.InsertMode;\n\n /**\n * A type alias for the add widget options.\n */\n export type IAddOptions = DockLayout.IAddOptions;\n\n /**\n * An object which holds the geometry for overlay positioning.\n */\n export interface IOverlayGeometry {\n /**\n * The distance between the overlay and parent top edges.\n */\n top: number;\n\n /**\n * The distance between the overlay and parent left edges.\n */\n left: number;\n\n /**\n * The distance between the overlay and parent right edges.\n */\n right: number;\n\n /**\n * The distance between the overlay and parent bottom edges.\n */\n bottom: number;\n }\n\n /**\n * An object which manages the overlay node for a dock panel.\n */\n export interface IOverlay {\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n *\n * #### Notes\n * The given geometry values assume the node will use absolute\n * positioning.\n *\n * This is called on every mouse move event during a drag in order\n * to update the position of the overlay. It should be efficient.\n */\n show(geo: IOverlayGeometry): void;\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 should hide the overlay immediately.\n *\n * #### Notes\n * This is called whenever the overlay node should been hidden.\n */\n hide(delay: number): void;\n }\n\n /**\n * A concrete implementation of `IOverlay`.\n *\n * This is the default overlay implementation for a dock panel.\n */\n export class Overlay implements IOverlay {\n /**\n * Construct a new overlay.\n */\n constructor() {\n this.node = document.createElement('div');\n this.node.classList.add('lm-DockPanel-overlay');\n this.node.classList.add('lm-mod-hidden');\n this.node.style.position = 'absolute';\n this.node.style.contain = 'strict';\n }\n\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n */\n show(geo: IOverlayGeometry): void {\n // Update the position of the overlay.\n let style = this.node.style;\n style.top = `${geo.top}px`;\n style.left = `${geo.left}px`;\n style.right = `${geo.right}px`;\n style.bottom = `${geo.bottom}px`;\n\n // Clear any pending hide timer.\n clearTimeout(this._timer);\n this._timer = -1;\n\n // If the overlay is already visible, we're done.\n if (!this._hidden) {\n return;\n }\n\n // Clear the hidden flag.\n this._hidden = false;\n\n // Finally, show the overlay.\n this.node.classList.remove('lm-mod-hidden');\n }\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 will hide the overlay immediately.\n */\n hide(delay: number): void {\n // Do nothing if the overlay is already hidden.\n if (this._hidden) {\n return;\n }\n\n // Hide immediately if the delay is <= 0.\n if (delay <= 0) {\n clearTimeout(this._timer);\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n return;\n }\n\n // Do nothing if a hide is already pending.\n if (this._timer !== -1) {\n return;\n }\n\n // Otherwise setup the hide timer.\n this._timer = window.setTimeout(() => {\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n }, delay);\n }\n\n private _timer = -1;\n private _hidden = true;\n }\n\n /**\n * A type alias for a dock panel renderer;\n */\n export type IRenderer = DockLayout.IRenderer;\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new tab bar for use with a dock panel.\n *\n * @returns A new tab bar for a dock panel.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar {\n let bar = new TabBar({ document });\n bar.addClass('lm-DockPanel-tabBar');\n return bar;\n }\n\n /**\n * Create a new handle node for use with a dock panel.\n *\n * @returns A new handle node for a dock panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-DockPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * The default sizes for the edge drop zones, in pixels.\n */\n export const DEFAULT_EDGES = {\n /**\n * The size of the top edge dock zone for the root panel, in pixels.\n * This is different from the others to distinguish between the top\n * tab bar and the top root zone.\n */\n top: 12,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n right: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n bottom: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n left: 40\n };\n\n /**\n * A singleton `'layout-modified'` conflatable message.\n */\n export const LayoutModified = new ConflatableMessage('layout-modified');\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The handle which was pressed.\n */\n handle: HTMLDivElement;\n\n /**\n * The X offset of the press in handle coordinates.\n */\n deltaX: number;\n\n /**\n * The Y offset of the press in handle coordinates.\n */\n deltaY: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * A type alias for a drop zone.\n */\n export type DropZone =\n | /**\n * An invalid drop zone.\n */\n 'invalid'\n\n /**\n * The entirety of the root dock area.\n */\n | 'root-all'\n\n /**\n * The top portion of the root dock area.\n */\n | 'root-top'\n\n /**\n * The left portion of the root dock area.\n */\n | 'root-left'\n\n /**\n * The right portion of the root dock area.\n */\n | 'root-right'\n\n /**\n * The bottom portion of the root dock area.\n */\n | 'root-bottom'\n\n /**\n * The entirety of a tabbed widget area.\n */\n | 'widget-all'\n\n /**\n * The top portion of tabbed widget area.\n */\n | 'widget-top'\n\n /**\n * The left portion of tabbed widget area.\n */\n | 'widget-left'\n\n /**\n * The right portion of tabbed widget area.\n */\n | 'widget-right'\n\n /**\n * The bottom portion of tabbed widget area.\n */\n | 'widget-bottom'\n\n /**\n * The the bar of a tabbed widget area.\n */\n | 'widget-tab';\n\n /**\n * An object which holds the drop target zone and widget.\n */\n export interface IDropTarget {\n /**\n * The semantic zone for the mouse position.\n */\n zone: DropZone;\n\n /**\n * The tab area geometry for the drop zone, or `null`.\n */\n target: DockLayout.ITabAreaGeometry | null;\n }\n\n /**\n * An attached property used to track generated tab bars.\n */\n export const isGeneratedTabBarProperty = new AttachedProperty<\n Widget,\n boolean\n >({\n name: 'isGeneratedTabBar',\n create: () => false\n });\n\n /**\n * Create a single document config for the widgets in a dock panel.\n */\n export function createSingleDocumentConfig(\n panel: DockPanel\n ): DockPanel.ILayoutConfig {\n // Return an empty config if the panel is empty.\n if (panel.isEmpty) {\n return { main: null };\n }\n\n // Get a flat array of the widgets in the panel.\n let widgets = Array.from(panel.widgets());\n\n // Get the first selected widget in the panel.\n let selected = panel.selectedWidgets().next().value;\n\n // Compute the current index for the new config.\n let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n // Return the single document config.\n return { main: { type: 'tab-area', widgets, currentIndex } };\n }\n\n /**\n * Find the drop target at the given client position.\n */\n export function findDropTarget(\n panel: DockPanel,\n clientX: number,\n clientY: number,\n edges: DockPanel.IEdges\n ): IDropTarget {\n // Bail if the mouse is not over the dock panel.\n if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n return { zone: 'invalid', target: null };\n }\n\n // Look up the layout for the panel.\n let layout = panel.layout as DockLayout;\n\n // If the layout is empty, indicate the entire root drop zone.\n if (layout.isEmpty) {\n return { zone: 'root-all', target: null };\n }\n\n // Test the edge zones when in multiple document mode.\n if (panel.mode === 'multiple-document') {\n // Get the client rect for the dock panel.\n let panelRect = panel.node.getBoundingClientRect();\n\n // Compute the distance to each edge of the panel.\n let pl = clientX - panelRect.left + 1;\n let pt = clientY - panelRect.top + 1;\n let pr = panelRect.right - clientX;\n let pb = panelRect.bottom - clientY;\n\n // Find the minimum distance to an edge.\n let pd = Math.min(pt, pr, pb, pl);\n\n // Return a root zone if the mouse is within an edge.\n switch (pd) {\n case pt:\n if (pt < edges.top) {\n return { zone: 'root-top', target: null };\n }\n break;\n case pr:\n if (pr < edges.right) {\n return { zone: 'root-right', target: null };\n }\n break;\n case pb:\n if (pb < edges.bottom) {\n return { zone: 'root-bottom', target: null };\n }\n break;\n case pl:\n if (pl < edges.left) {\n return { zone: 'root-left', target: null };\n }\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Hit test the dock layout at the given client position.\n let target = layout.hitTestTabAreas(clientX, clientY);\n\n // Bail if no target area was found.\n if (!target) {\n return { zone: 'invalid', target: null };\n }\n\n // Return the whole tab area when in single document mode.\n if (panel.mode === 'single-document') {\n return { zone: 'widget-all', target };\n }\n\n // Compute the distance to each edge of the tab area.\n let al = target.x - target.left + 1;\n let at = target.y - target.top + 1;\n let ar = target.left + target.width - target.x;\n let ab = target.top + target.height - target.y;\n\n const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n if (at < tabHeight) {\n return { zone: 'widget-tab', target };\n }\n\n // Get the X and Y edge sizes for the area.\n let rx = Math.round(target.width / 3);\n let ry = Math.round(target.height / 3);\n\n // If the mouse is not within an edge, indicate the entire area.\n if (al > rx && ar > rx && at > ry && ab > ry) {\n return { zone: 'widget-all', target };\n }\n\n // Scale the distances by the slenderness ratio.\n al /= rx;\n at /= ry;\n ar /= rx;\n ab /= ry;\n\n // Find the minimum distance to the area edge.\n let ad = Math.min(al, at, ar, ab);\n\n // Find the widget zone for the area edge.\n let zone: DropZone;\n switch (ad) {\n case al:\n zone = 'widget-left';\n break;\n case at:\n zone = 'widget-top';\n break;\n case ar:\n zone = 'widget-right';\n break;\n case ab:\n zone = 'widget-bottom';\n break;\n default:\n throw 'unreachable';\n }\n\n // Return the final drop target.\n return { zone, target };\n }\n\n /**\n * Get the drop reference widget for a tab bar.\n */\n export function getDropRef(tabBar: TabBar): Widget | null {\n if (tabBar.titles.length === 0) {\n return null;\n }\n if (tabBar.currentTitle) {\n return tabBar.currentTitle.owner;\n }\n return tabBar.titles[tabBar.titles.length - 1].owner;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker implements IDisposable {\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose(): void {\n // Do nothing if the tracker is already disposed.\n if (this._counter < 0) {\n return;\n }\n\n // Mark the tracker as disposed.\n this._counter = -1;\n\n // Clear the connections for the tracker.\n Signal.clearData(this);\n\n // Remove all event listeners.\n for (const widget of this._widgets) {\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n }\n\n // Clear the internal data structures.\n this._activeWidget = null;\n this._currentWidget = null;\n this._nodes.clear();\n this._numbers.clear();\n this._widgets.length = 0;\n }\n\n /**\n * A signal emitted when the current widget has changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when the active widget has changed.\n */\n get activeChanged(): ISignal> {\n return this._activeChanged;\n }\n\n /**\n * A flag indicating whether the tracker is disposed.\n */\n get isDisposed(): boolean {\n return this._counter < 0;\n }\n\n /**\n * The current widget in the tracker.\n *\n * #### Notes\n * The current widget is the widget among the tracked widgets which\n * has the *descendant node* which has most recently been focused.\n *\n * The current widget will not be updated if the node loses focus. It\n * will only be updated when a different tracked widget gains focus.\n *\n * If the current widget is removed from the tracker, the previous\n * current widget will be restored.\n *\n * This behavior is intended to follow a user's conceptual model of\n * a semantically \"current\" widget, where the \"last thing of type X\"\n * to be interacted with is the \"current instance of X\", regardless\n * of whether that instance still has focus.\n */\n get currentWidget(): T | null {\n return this._currentWidget;\n }\n\n /**\n * The active widget in the tracker.\n *\n * #### Notes\n * The active widget is the widget among the tracked widgets which\n * has the *descendant node* which is currently focused.\n */\n get activeWidget(): T | null {\n return this._activeWidget;\n }\n\n /**\n * A read only array of the widgets being tracked.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Get the focus number for a particular widget in the tracker.\n *\n * @param widget - The widget of interest.\n *\n * @returns The focus number for the given widget, or `-1` if the\n * widget has not had focus since being added to the tracker, or\n * is not contained by the tracker.\n *\n * #### Notes\n * The focus number indicates the relative order in which the widgets\n * have gained focus. A widget with a larger number has gained focus\n * more recently than a widget with a smaller number.\n *\n * The `currentWidget` will always have the largest focus number.\n *\n * All widgets start with a focus number of `-1`, which indicates that\n * the widget has not been focused since being added to the tracker.\n */\n focusNumber(widget: T): number {\n let n = this._numbers.get(widget);\n return n === undefined ? -1 : n;\n }\n\n /**\n * Test whether the focus tracker contains a given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns `true` if the widget is tracked, `false` otherwise.\n */\n has(widget: T): boolean {\n return this._numbers.has(widget);\n }\n\n /**\n * Add a widget to the focus tracker.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is already tracked, this is a no-op.\n */\n add(widget: T): void {\n // Do nothing if the widget is already tracked.\n if (this._numbers.has(widget)) {\n return;\n }\n\n // Test whether the widget has focus.\n let focused = widget.node.contains(document.activeElement);\n\n // Set up the initial focus number.\n let n = focused ? this._counter++ : -1;\n\n // Add the widget to the internal data structures.\n this._widgets.push(widget);\n this._numbers.set(widget, n);\n this._nodes.set(widget.node, widget);\n\n // Set up the event listeners. The capturing phase must be used\n // since the 'focus' and 'blur' events don't bubble and Firefox\n // doesn't support the 'focusin' or 'focusout' events.\n widget.node.addEventListener('focus', this, true);\n widget.node.addEventListener('blur', this, true);\n\n // Connect the disposed signal handler.\n widget.disposed.connect(this._onWidgetDisposed, this);\n\n // Set the current and active widgets if needed.\n if (focused) {\n this._setWidgets(widget, widget);\n }\n }\n\n /**\n * Remove a widget from the focus tracker.\n *\n * #### Notes\n * If the widget is the `currentWidget`, the previous current widget\n * will become the new `currentWidget`.\n *\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is not tracked, this is a no-op.\n */\n remove(widget: T): void {\n // Bail early if the widget is not tracked.\n if (!this._numbers.has(widget)) {\n return;\n }\n\n // Disconnect the disposed signal handler.\n widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n // Remove the event listeners.\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n\n // Remove the widget from the internal data structures.\n ArrayExt.removeFirstOf(this._widgets, widget);\n this._nodes.delete(widget.node);\n this._numbers.delete(widget);\n\n // Bail early if the widget is not the current widget.\n if (this._currentWidget !== widget) {\n return;\n }\n\n // Filter the widgets for those which have had focus.\n let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n // Get the valid widget with the max focus number.\n let previous =\n max(valid, (first, second) => {\n let a = this._numbers.get(first)!;\n let b = this._numbers.get(second)!;\n return a - b;\n }) || null;\n\n // Set the current and active widgets.\n this._setWidgets(previous, null);\n }\n\n /**\n * Handle the DOM events for the focus tracker.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tracked nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n }\n }\n\n /**\n * Set the current and active widgets for the tracker.\n */\n private _setWidgets(current: T | null, active: T | null): void {\n // Swap the current widget.\n let oldCurrent = this._currentWidget;\n this._currentWidget = current;\n\n // Swap the active widget.\n let oldActive = this._activeWidget;\n this._activeWidget = active;\n\n // Emit the `currentChanged` signal if needed.\n if (oldCurrent !== current) {\n this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n }\n\n // Emit the `activeChanged` signal if needed.\n if (oldActive !== active) {\n this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n }\n }\n\n /**\n * Handle the `'focus'` event for a tracked widget.\n */\n private _evtFocus(event: FocusEvent): void {\n // Find the widget which gained focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Update the focus number if necessary.\n if (widget !== this._currentWidget) {\n this._numbers.set(widget, this._counter++);\n }\n\n // Set the current and active widgets.\n this._setWidgets(widget, widget);\n }\n\n /**\n * Handle the `'blur'` event for a tracked widget.\n */\n private _evtBlur(event: FocusEvent): void {\n // Find the widget which lost focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Get the node which being focused after this blur.\n let focusTarget = event.relatedTarget as HTMLElement;\n\n // If no other node is being focused, clear the active widget.\n if (!focusTarget) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n\n // Bail if the focus widget is not changing.\n if (widget.node.contains(focusTarget)) {\n return;\n }\n\n // If no tracked widget is being focused, clear the active widget.\n if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n }\n\n /**\n * Handle the `disposed` signal for a tracked widget.\n */\n private _onWidgetDisposed(sender: T): void {\n this.remove(sender);\n }\n\n private _counter = 0;\n private _widgets: T[] = [];\n private _activeWidget: T | null = null;\n private _currentWidget: T | null = null;\n private _numbers = new Map();\n private _nodes = new Map();\n private _activeChanged = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n /**\n * An arguments object for the changed signals.\n */\n export interface IChangedArgs {\n /**\n * The old value for the widget.\n */\n oldValue: T | null;\n\n /**\n * The new value for the widget.\n */\n newValue: T | null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n /**\n * Construct a new grid layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: GridLayout.IOptions = {}) {\n super(options);\n if (options.rowCount !== undefined) {\n Private.reallocSizers(this._rowSizers, options.rowCount);\n }\n if (options.columnCount !== undefined) {\n Private.reallocSizers(this._columnSizers, options.columnCount);\n }\n if (options.rowSpacing !== undefined) {\n this._rowSpacing = Private.clampValue(options.rowSpacing);\n }\n if (options.columnSpacing !== undefined) {\n this._columnSpacing = Private.clampValue(options.columnSpacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the widgets and layout items.\n for (const item of this._items) {\n let widget = item.widget;\n item.dispose();\n widget.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._rowStarts.length = 0;\n this._rowSizers.length = 0;\n this._columnStarts.length = 0;\n this._columnSizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the number of rows in the layout.\n */\n get rowCount(): number {\n return this._rowSizers.length;\n }\n\n /**\n * Set the number of rows in the layout.\n *\n * #### Notes\n * The minimum row count is `1`.\n */\n set rowCount(value: number) {\n // Do nothing if the row count does not change.\n if (value === this.rowCount) {\n return;\n }\n\n // Reallocate the row sizers.\n Private.reallocSizers(this._rowSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the number of columns in the layout.\n */\n get columnCount(): number {\n return this._columnSizers.length;\n }\n\n /**\n * Set the number of columns in the layout.\n *\n * #### Notes\n * The minimum column count is `1`.\n */\n set columnCount(value: number) {\n // Do nothing if the column count does not change.\n if (value === this.columnCount) {\n return;\n }\n\n // Reallocate the column sizers.\n Private.reallocSizers(this._columnSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the row spacing for the layout.\n */\n get rowSpacing(): number {\n return this._rowSpacing;\n }\n\n /**\n * Set the row spacing for the layout.\n */\n set rowSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._rowSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._rowSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the column spacing for the layout.\n */\n get columnSpacing(): number {\n return this._columnSpacing;\n }\n\n /**\n * Set the col spacing for the layout.\n */\n set columnSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._columnSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._columnSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @returns The stretch factor for the row.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n rowStretch(index: number): number {\n let sizer = this._rowSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @param value - The stretch factor for the row.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setRowStretch(index: number, value: number): void {\n // Look up the row sizer.\n let sizer = this._rowSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Get the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @returns The stretch factor for the column.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n columnStretch(index: number): number {\n let sizer = this._columnSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @param value - The stretch factor for the column.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setColumnStretch(index: number, value: number): void {\n // Look up the column sizer.\n let sizer = this._columnSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n for (const item of this._items) {\n yield item.widget;\n }\n }\n\n /**\n * Add a widget to the grid layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, this is no-op.\n */\n addWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is already in the layout.\n if (i !== -1) {\n return;\n }\n\n // Add the widget to the layout.\n this._items.push(new LayoutItem(widget));\n\n // Attach the widget to the parent.\n if (this.parent) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Remove a widget from the grid layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is not in the layout.\n if (i === -1) {\n return;\n }\n\n // Remove the widget from the layout.\n let item = ArrayExt.removeAt(this._items, i)!;\n\n // Detach the widget from the parent.\n if (this.parent) {\n this.detachWidget(widget);\n }\n\n // Dispose the layout item.\n item.dispose();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Reset the min sizes of the sizers.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n this._rowSizers[i].minSize = 0;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n this._columnSizers[i].minSize = 0;\n }\n\n // Filter for the visible layout items.\n let items = this._items.filter(it => !it.isHidden);\n\n // Fit the layout items.\n for (let i = 0, n = items.length; i < n; ++i) {\n items[i].fit();\n }\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Sort the items by row span.\n items.sort(Private.rowSpanCmp);\n\n // Update the min sizes of the row sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the row bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n // Distribute the minimum height to the sizers as needed.\n Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n }\n\n // Sort the items by column span.\n items.sort(Private.columnSpanCmp);\n\n // Update the min sizes of the column sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the column bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let c1 = Math.min(config.column, maxCol);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Distribute the minimum width to the sizers as needed.\n Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n }\n\n // If no size constraint is needed, just update the parent.\n if (this.fitPolicy === 'set-no-constraint') {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n return;\n }\n\n // Set up the computed min size.\n let minH = maxRow * this._rowSpacing;\n let minW = maxCol * this._columnSpacing;\n\n // Add the sizer minimums to the computed min size.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n minH += this._rowSizers[i].minSize;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n minW += this._columnSizers[i].minSize;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Compute the total fixed row and column space.\n let fixedRowSpace = maxRow * this._rowSpacing;\n let fixedColSpace = maxCol * this._columnSpacing;\n\n // Distribute the available space to the box sizers.\n BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n // Update the row start positions.\n for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n this._rowStarts[i] = pos;\n pos += this._rowSizers[i].size + this._rowSpacing;\n }\n\n // Update the column start positions.\n for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n this._columnStarts[i] = pos;\n pos += this._columnSizers[i].size + this._columnSpacing;\n }\n\n // Update the geometry of the layout items.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the cell bounds for the widget.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let c1 = Math.min(config.column, maxCol);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Compute the cell geometry.\n let x = this._columnStarts[c1];\n let y = this._rowStarts[r1];\n let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n // Update the geometry of the layout item.\n item.update(x, y, w, h);\n }\n }\n\n private _dirty = false;\n private _rowSpacing = 4;\n private _columnSpacing = 4;\n private _items: LayoutItem[] = [];\n private _rowStarts: number[] = [];\n private _columnStarts: number[] = [];\n private _rowSizers: BoxSizer[] = [new BoxSizer()];\n private _columnSizers: BoxSizer[] = [new BoxSizer()];\n private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n /**\n * An options object for initializing a grid layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The initial row count for the layout.\n *\n * The default is `1`.\n */\n rowCount?: number;\n\n /**\n * The initial column count for the layout.\n *\n * The default is `1`.\n */\n columnCount?: number;\n\n /**\n * The spacing between rows in the layout.\n *\n * The default is `4`.\n */\n rowSpacing?: number;\n\n /**\n * The spacing between columns in the layout.\n *\n * The default is `4`.\n */\n columnSpacing?: number;\n }\n\n /**\n * An object which holds the cell configuration for a widget.\n */\n export interface ICellConfig {\n /**\n * The row index for the widget.\n */\n readonly row: number;\n\n /**\n * The column index for the widget.\n */\n readonly column: number;\n\n /**\n * The row span for the widget.\n */\n readonly rowSpan: number;\n\n /**\n * The column span for the widget.\n */\n readonly columnSpan: number;\n }\n\n /**\n * Get the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The cell config for the widget.\n */\n export function getCellConfig(widget: Widget): ICellConfig {\n return Private.cellConfigProperty.get(widget);\n }\n\n /**\n * Set the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the cell config.\n */\n export function setCellConfig(\n widget: Widget,\n value: Partial\n ): void {\n Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for the widget cell config.\n */\n export const cellConfigProperty = new AttachedProperty<\n Widget,\n GridLayout.ICellConfig\n >({\n name: 'cellConfig',\n create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n changed: onChildCellConfigChanged\n });\n\n /**\n * Normalize a partial cell config object.\n */\n export function normalizeConfig(\n config: Partial\n ): GridLayout.ICellConfig {\n let row = Math.max(0, Math.floor(config.row || 0));\n let column = Math.max(0, Math.floor(config.column || 0));\n let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n return { row, column, rowSpan, columnSpan };\n }\n\n /**\n * Clamp a value to an integer >= 0.\n */\n export function clampValue(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * A sort comparison function for row spans.\n */\n export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.rowSpan - c2.rowSpan;\n }\n\n /**\n * A sort comparison function for column spans.\n */\n export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.columnSpan - c2.columnSpan;\n }\n\n /**\n * Reallocate the box sizers for the given grid dimensions.\n */\n export function reallocSizers(sizers: BoxSizer[], count: number): void {\n // Coerce the count to the valid range.\n count = Math.max(1, Math.floor(count));\n\n // Add the missing sizers.\n while (sizers.length < count) {\n sizers.push(new BoxSizer());\n }\n\n // Remove the extra sizers.\n if (sizers.length > count) {\n sizers.length = count;\n }\n }\n\n /**\n * Distribute a min size constraint across a range of sizers.\n */\n export function distributeMin(\n sizers: BoxSizer[],\n i1: number,\n i2: number,\n minSize: number\n ): void {\n // Sanity check the indices.\n if (i2 < i1) {\n return;\n }\n\n // Handle the simple case of no cell span.\n if (i1 === i2) {\n let sizer = sizers[i1];\n sizer.minSize = Math.max(sizer.minSize, minSize);\n return;\n }\n\n // Compute the total current min size of the span.\n let totalMin = 0;\n for (let i = i1; i <= i2; ++i) {\n totalMin += sizers[i].minSize;\n }\n\n // Do nothing if the total is greater than the required.\n if (totalMin >= minSize) {\n return;\n }\n\n // Compute the portion of the space to allocate to each sizer.\n let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n // Add the portion to each sizer.\n for (let i = i1; i <= i2; ++i) {\n sizers[i].minSize += portion;\n }\n }\n\n /**\n * The change handler for the child cell config property.\n */\n function onChildCellConfigChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof GridLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n */\nexport class MenuBar extends Widget {\n /**\n * Construct a new menu bar.\n *\n * @param options - The options for initializing the menu bar.\n */\n constructor(options: MenuBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-MenuBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.renderer = options.renderer || MenuBar.defaultRenderer;\n this._forceItemsPosition = options.forceItemsPosition || {\n forceX: true,\n forceY: true\n };\n this._overflowMenuOptions = options.overflowMenuOptions || {\n isVisible: true\n };\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._closeChildMenu();\n this._menus.length = 0;\n super.dispose();\n }\n\n /**\n * The renderer used by the menu bar.\n */\n readonly renderer: MenuBar.IRenderer;\n\n /**\n * The child menu of the menu bar.\n *\n * #### Notes\n * This will be `null` if the menu bar does not have an open menu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The overflow index of the menu bar.\n */\n get overflowIndex(): number {\n return this._overflowIndex;\n }\n\n /**\n * The overflow menu of the menu bar.\n */\n get overflowMenu(): Menu | null {\n return this._overflowMenu;\n }\n\n /**\n * Get the menu bar content node.\n *\n * #### Notes\n * This is the node which holds the menu title nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-MenuBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu.\n */\n get activeMenu(): Menu | null {\n return this._menus[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu.\n *\n * #### Notes\n * If the menu does not exist, the menu will be set to `null`.\n */\n set activeMenu(value: Menu | null) {\n this.activeIndex = value ? this._menus.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu.\n *\n * #### Notes\n * This will be `-1` if no menu is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu.\n *\n * #### Notes\n * If the menu cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._menus.length) {\n value = -1;\n }\n\n // An empty menu cannot be active\n if (value > -1 && this._menus[value].items.length === 0) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menus in the menu bar.\n */\n get menus(): ReadonlyArray {\n return this._menus;\n }\n\n /**\n * Open the active menu and activate its first menu item.\n *\n * #### Notes\n * If there is no active menu, this is a no-op.\n */\n openActiveMenu(): void {\n // Bail early if there is no active item.\n if (this._activeIndex === -1) {\n return;\n }\n\n // Open the child menu.\n this._openChildMenu();\n\n // Activate the first item in the child menu.\n if (this._childMenu) {\n this._childMenu.activeIndex = -1;\n this._childMenu.activateNextItem();\n }\n }\n\n /**\n * Add a menu to the end of the menu bar.\n *\n * @param menu - The menu to add to the menu bar.\n *\n * #### Notes\n * If the menu is already added to the menu bar, it will be moved.\n */\n addMenu(menu: Menu, update: boolean = true): void {\n this.insertMenu(this._menus.length, menu, update);\n }\n\n /**\n * Insert a menu into the menu bar at the specified index.\n *\n * @param index - The index at which to insert the menu.\n *\n * @param menu - The menu to insert into the menu bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the menus.\n *\n * If the menu is already added to the menu bar, it will be moved.\n */\n insertMenu(index: number, menu: Menu, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Look up the index of the menu.\n let i = this._menus.indexOf(menu);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._menus.length));\n\n // If the menu is not in the array, insert it.\n if (i === -1) {\n // Insert the menu into the array.\n ArrayExt.insert(this._menus, j, menu);\n\n // Add the styling class to the menu.\n menu.addClass('lm-MenuBar-menu');\n\n // Connect to the menu signals.\n menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n menu.menuRequested.connect(this._onMenuMenuRequested, this);\n menu.title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the menu exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._menus.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the menu to the new locations.\n ArrayExt.move(this._menus, i, j);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove a menu from the menu bar.\n *\n * @param menu - The menu to remove from the menu bar.\n *\n * #### Notes\n * This is a no-op if the menu is not in the menu bar.\n */\n removeMenu(menu: Menu, update: boolean = true): void {\n this.removeMenuAt(this._menus.indexOf(menu), update);\n }\n\n /**\n * Remove the menu at a given index from the menu bar.\n *\n * @param index - The index of the menu to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeMenuAt(index: number, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Remove the menu from the array.\n let menu = ArrayExt.removeAt(this._menus, index);\n\n // Bail if the index is out of range.\n if (!menu) {\n return;\n }\n\n // Disconnect from the menu signals.\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n\n // Remove the styling class from the menu.\n menu.removeClass('lm-MenuBar-menu');\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove all menus from the menu bar.\n */\n clearMenus(): void {\n // Bail if there is nothing to remove.\n if (this._menus.length === 0) {\n return;\n }\n\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Disconnect from the menu signals and remove the styling class.\n for (let menu of this._menus) {\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n menu.removeClass('lm-MenuBar-menu');\n }\n\n // Clear the menus array.\n this._menus.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Handle the DOM events for the menu bar.\n *\n * @param event - The DOM event sent to the menu bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu bar's DOM nodes. It\n * should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'focusout':\n this._evtFocusOut(event as FocusEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mousedown', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('focusout', this);\n this.node.addEventListener('contextmenu', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mousedown', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('focusout', this);\n this.node.removeEventListener('contextmenu', this);\n this._closeChildMenu();\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this._focusItemAt(0);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n this.update();\n super.onResize(msg);\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let menus = this._menus;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let tabFocusIndex =\n this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n ? this._tabFocusIndex\n : 0;\n let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n let totalMenuSize = 0;\n let isVisible = false;\n\n // Check that the overflow menu doesn't count\n length = this._overflowMenu !== null ? length - 1 : length;\n let content = new Array(length);\n\n // Render visible menus\n for (let i = 0; i < length; ++i) {\n content[i] = renderer.renderItem({\n title: menus[i].title,\n active: i === activeIndex,\n tabbable: i === tabFocusIndex,\n disabled: menus[i].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = i;\n this.activeIndex = i;\n }\n });\n // Calculate size of current menu\n totalMenuSize += this._menuItemSizes[i];\n // Check if overflow menu is already rendered\n if (menus[i].title.label === this._overflowMenuOptions.title) {\n isVisible = true;\n length--;\n }\n }\n // Render overflow menu if needed and active\n if (this._overflowMenuOptions.isVisible) {\n if (this._overflowIndex > -1 && !isVisible) {\n // Create overflow menu\n if (this._overflowMenu === null) {\n const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n this._overflowMenu.title.label = overflowMenuTitle;\n this._overflowMenu.title.mnemonic = 0;\n this.addMenu(this._overflowMenu, false);\n }\n // Move menus to overflow menu\n for (let i = menus.length - 2; i >= length; i--) {\n const submenu = this.menus[i];\n submenu.title.mnemonic = 0;\n this._overflowMenu.insertItem(0, {\n type: 'submenu',\n submenu: submenu\n });\n this.removeMenu(submenu, false);\n }\n content[length] = renderer.renderItem({\n title: this._overflowMenu.title,\n active: length === activeIndex && menus[length].items.length !== 0,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n } else if (this._overflowMenu !== null) {\n // Remove submenus from overflow menu\n let overflowMenuItems = this._overflowMenu.items;\n let screenSize = this.node.offsetWidth;\n let n = this._overflowMenu.items.length;\n for (let i = 0; i < n; ++i) {\n let index = menus.length - 1 - i;\n if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n let menu = overflowMenuItems[0].submenu as Menu;\n this._overflowMenu.removeItemAt(0);\n this.insertMenu(length, menu, false);\n content[length] = renderer.renderItem({\n title: menu.title,\n active: false,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n }\n }\n if (this._overflowMenu.items.length === 0) {\n this.removeMenu(this._overflowMenu, false);\n content.pop();\n this._overflowMenu = null;\n this._overflowIndex = -1;\n }\n }\n }\n VirtualDOM.render(content, this.contentNode);\n this._updateOverflowIndex();\n }\n\n /**\n * Calculate and update the current overflow index.\n */\n private _updateOverflowIndex(): void {\n if (!this._overflowMenuOptions.isVisible) {\n return;\n }\n\n // Get elements visible in the main menu bar\n const itemMenus = this.contentNode.childNodes;\n let screenSize = this.node.offsetWidth;\n let totalMenuSize = 0;\n let index = -1;\n let n = itemMenus.length;\n\n if (this._menuItemSizes.length == 0) {\n // Check if it is the first resize and get info about menu items sizes\n for (let i = 0; i < n; i++) {\n let item = itemMenus[i] as HTMLLIElement;\n // Add sizes to array\n totalMenuSize += item.offsetWidth;\n this._menuItemSizes.push(item.offsetWidth);\n if (totalMenuSize > screenSize && index === -1) {\n index = i;\n }\n }\n } else {\n // Calculate current menu size\n for (let i = 0; i < this._menuItemSizes.length; i++) {\n totalMenuSize += this._menuItemSizes[i];\n if (totalMenuSize > screenSize) {\n index = i;\n break;\n }\n }\n }\n this._overflowIndex = index;\n }\n\n /**\n * Handle the `'keydown'` event for the menu bar.\n *\n * #### Notes\n * All keys are trapped except the tab key that is ignored.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Reset the active index on tab, but do not trap the tab key.\n if (kc === 9) {\n this.activeIndex = -1;\n return;\n }\n\n // A menu bar handles all other keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Enter, Space, Up Arrow, Down Arrow\n if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n // The active index may have changed (for example, user hovers over an\n // item with the mouse), so be sure to use the focus index.\n this.activeIndex = this._tabFocusIndex;\n if (this.activeIndex !== this._tabFocusIndex) {\n // Bail if the setter refused to set activeIndex to tabFocusIndex\n // because it means that the item at tabFocusIndex cannot be opened (for\n // example, it has an empty menu)\n return;\n }\n this.openActiveMenu();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this._closeChildMenu();\n this._focusItemAt(this.activeIndex);\n return;\n }\n\n // Left or Right Arrow\n if (kc === 37 || kc === 39) {\n let direction = kc === 37 ? -1 : 1;\n let start = this._tabFocusIndex + direction;\n let n = this._menus.length;\n for (let i = 0; i < n; i++) {\n let index = (n + start + direction * i) % n;\n if (this._menus[index].items.length) {\n this._focusItemAt(index);\n return;\n }\n }\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._menus, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that menu is opened.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.openActiveMenu();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n this._focusItemAt(this.activeIndex);\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n this._focusItemAt(this.activeIndex);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the menu bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the mouse press was not on the menu bar. This can occur\n // when the document listener is installed for an active menu bar.\n if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n return;\n }\n\n // Stop the propagation of the event. Immediate propagation is\n // also stopped so that an open menu does not handle the event.\n event.stopPropagation();\n event.stopImmediatePropagation();\n\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // If the press was not on an item, close the child menu.\n if (index === -1) {\n this._closeChildMenu();\n return;\n }\n\n // If the press was not the left mouse button, do nothing further.\n if (event.button !== 0) {\n return;\n }\n\n // Otherwise, toggle the open state of the child menu.\n if (this._childMenu) {\n this._closeChildMenu();\n this.activeIndex = index;\n } else {\n // If we don't call preventDefault() here, then the item in the menu\n // bar will take focus over the menu that is being opened.\n event.preventDefault();\n const position = this._positionForMenu(index);\n Menu.saveWindowData();\n // Begin DOM modifications.\n this.activeIndex = index;\n this._openChildMenu(position);\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the menu bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the active index will not change.\n if (index === this._activeIndex) {\n return;\n }\n\n // Bail early if a child menu is open and the mouse is not over\n // an item. This allows the child menu to be kept open when the\n // mouse is over the empty part of the menu bar.\n if (index === -1 && this._childMenu) {\n return;\n }\n\n // Get position for the new menu >before< updating active index.\n const position =\n index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n // Before any modification, update window data.\n Menu.saveWindowData();\n\n // Begin DOM modifications.\n\n // Update the active index to the hovered item.\n this.activeIndex = index;\n\n // Open the new menu if a menu is already open.\n if (position) {\n this._openChildMenu(position);\n }\n }\n\n /**\n * Find initial position for the menu based on menubar item position.\n *\n * NOTE: this should be called before updating active index to avoid\n * an additional layout and style invalidation as changing active\n * index modifies DOM.\n */\n private _positionForMenu(index: number): Private.IPosition {\n let itemNode = this.contentNode.children[index];\n let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n return {\n top: bottom,\n left\n };\n }\n\n /**\n * Handle the `'focusout'` event for the menu bar.\n */\n private _evtFocusOut(event: FocusEvent): void {\n // Reset the active index if there is no open menu and the menubar is losing focus.\n if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n this.activeIndex = -1;\n }\n }\n\n /**\n * Focus an item in the menu bar.\n *\n * #### Notes\n * Does not open the associated menu.\n */\n private _focusItemAt(index: number): void {\n const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n if (itemNode) {\n itemNode.focus();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if there is no active menu.\n */\n private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n // If there is no active menu, close the current menu.\n let newMenu = this.activeMenu;\n if (!newMenu) {\n this._closeChildMenu();\n return;\n }\n\n // Bail if there is no effective menu change.\n let oldMenu = this._childMenu;\n if (oldMenu === newMenu) {\n return;\n }\n\n // Swap the internal menu reference.\n this._childMenu = newMenu;\n\n // Close the current menu, or setup for the new menu.\n if (oldMenu) {\n oldMenu.close();\n } else {\n document.addEventListener('mousedown', this, true);\n }\n\n // Update the tab focus index and ensure the menu bar is updated.\n this._tabFocusIndex = this.activeIndex;\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n // Get the positioning data for the new menu.\n let { left, top } = options;\n if (typeof left === 'undefined' || typeof top === 'undefined') {\n ({ left, top } = this._positionForMenu(this._activeIndex));\n }\n // Begin DOM modifications\n\n if (!oldMenu) {\n // Continue setup for new menu\n this.addClass('lm-mod-active');\n }\n\n // Open the new menu at the computed location.\n if (newMenu.items.length > 0) {\n newMenu.open(left, top, this._forceItemsPosition);\n }\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n // Bail if no child menu is open.\n if (!this._childMenu) {\n return;\n }\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n let menu = this._childMenu;\n this._childMenu = null;\n\n // Close the menu.\n menu.close();\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `aboutToClose` signal of a menu.\n */\n private _onMenuAboutToClose(sender: Menu): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n this._childMenu = null;\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `menuRequested` signal of a child menu.\n */\n private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Look up the active index and menu count.\n let i = this._activeIndex;\n let n = this._menus.length;\n\n // Active the next requested index.\n switch (args) {\n case 'next':\n this.activeIndex = i === n - 1 ? 0 : i + 1;\n break;\n case 'previous':\n this.activeIndex = i === 0 ? n - 1 : i - 1;\n break;\n }\n\n // Open the active menu.\n this.openActiveMenu();\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(): void {\n this.update();\n }\n\n // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n private _activeIndex = -1;\n // Track which item can be focused using the TAB key. Unlike _activeIndex will\n // always point to a menuitem. Whenever you update this value, it's important\n // to follow it with an \"update-request\" message so that the `tabindex`\n // attribute on each menubar item gets properly updated.\n private _tabFocusIndex = 0;\n private _forceItemsPosition: Menu.IOpenOptions;\n private _overflowMenuOptions: IOverflowMenuOptions;\n private _menus: Menu[] = [];\n private _childMenu: Menu | null = null;\n private _overflowMenu: Menu | null = null;\n private _menuItemSizes: number[] = [];\n private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n /**\n * An options object for creating a menu bar.\n */\n export interface IOptions {\n /**\n * A custom renderer for creating menu bar content.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n /**\n * Whether to force the position of the menu. The MenuBar forces the\n * coordinates of its menus by default. With this option you can disable it.\n *\n * Setting to `false` will enable the logic which repositions the\n * coordinates of the menu if it will not fit entirely on screen.\n *\n * The default is `true`.\n */\n forceItemsPosition?: Menu.IOpenOptions;\n /**\n * Whether to add a overflow menu if there's overflow.\n *\n * Setting to `true` will enable the logic that creates an overflow menu\n * to show the menu items that don't fit entirely on the screen.\n *\n * The default is `true`.\n */\n overflowMenuOptions?: IOverflowMenuOptions;\n }\n\n /**\n * An object which holds the data to render a menu bar item.\n */\n export interface IRenderData {\n /**\n * The title to be rendered.\n */\n readonly title: Title;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the user can tab to the item.\n */\n readonly tabbable: boolean;\n\n /**\n * Whether the item is disabled.\n *\n * #### Notes\n * A disabled item cannot be active.\n * A disabled item cannot be focussed.\n */\n readonly disabled?: boolean;\n\n readonly onfocus?: (event: FocusEvent) => void;\n }\n\n /**\n * A renderer for use with a menu bar.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n\n /**\n * Render the icon element for a menu bar item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.title.icon is undefined, it will be ignored.\n return h.div({ className }, data.title.icon!, data.title.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n }\n\n /**\n * Create the class name for the menu bar item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n let name = 'lm-MenuBar-item';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.active && !data.disabled) {\n name += ' lm-mod-active';\n }\n return name;\n }\n\n /**\n * Create the dataset for a menu bar item.\n *\n * @param data - The data to use for the item.\n *\n * @returns The dataset for the menu bar item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the aria attributes for menu bar item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n return {\n role: 'menuitem',\n 'aria-haspopup': 'true',\n 'aria-disabled': data.disabled ? 'true' : 'false'\n };\n }\n\n /**\n * Create the class name for the menu bar item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-MenuBar-itemIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.title;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n /**\n * Determines if a overflow menu appears when the menu items overflow.\n *\n * Defaults to `true`.\n */\n isVisible: boolean;\n /**\n * Determines the title of the overflow menu.\n *\n * Default: `...`.\n */\n title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a menu bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-MenuBar-content';\n node.appendChild(content);\n content.setAttribute('role', 'menubar');\n return node;\n }\n\n /**\n * Position for the menu relative to top-left screen corner.\n */\n export interface IPosition {\n /**\n * Pixels right from screen origin.\n */\n left: number;\n /**\n * Pixels down from screen origin.\n */\n top: number;\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n menus: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = menus.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Look up the menu title.\n let title = menus[k].title;\n\n // Ignore titles with an empty label.\n if (title.label.length === 0) {\n continue;\n }\n\n // Look up the mnemonic index for the label.\n let mn = title.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < title.label.length) {\n if (title.label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n /**\n * Construct a new scroll bar.\n *\n * @param options - The options for initializing the scroll bar.\n */\n constructor(options: ScrollBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-ScrollBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n\n // Set the orientation.\n this._orientation = options.orientation || 'vertical';\n this.dataset['orientation'] = this._orientation;\n\n // Parse the rest of the options.\n if (options.maximum !== undefined) {\n this._maximum = Math.max(0, options.maximum);\n }\n if (options.page !== undefined) {\n this._page = Math.max(0, options.page);\n }\n if (options.value !== undefined) {\n this._value = Math.max(0, Math.min(options.value, this._maximum));\n }\n }\n\n /**\n * A signal emitted when the user moves the scroll thumb.\n *\n * #### Notes\n * The payload is the current value of the scroll bar.\n */\n get thumbMoved(): ISignal {\n return this._thumbMoved;\n }\n\n /**\n * A signal emitted when the user clicks a step button.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get stepRequested(): ISignal {\n return this._stepRequested;\n }\n\n /**\n * A signal emitted when the user clicks the scroll track.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get pageRequested(): ISignal {\n return this._pageRequested;\n }\n\n /**\n * Get the orientation of the scroll bar.\n */\n get orientation(): ScrollBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the scroll bar.\n */\n set orientation(value: ScrollBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making changes.\n this._releaseMouse();\n\n // Update the internal orientation.\n this._orientation = value;\n this.dataset['orientation'] = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the current value of the scroll bar.\n */\n get value(): number {\n return this._value;\n }\n\n /**\n * Set the current value of the scroll bar.\n *\n * #### Notes\n * The value will be clamped to the range `[0, maximum]`.\n */\n set value(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Do nothing if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the page size of the scroll bar.\n *\n * #### Notes\n * The page size is the amount of visible content in the scrolled\n * region, expressed in data units. It determines the size of the\n * scroll bar thumb.\n */\n get page(): number {\n return this._page;\n }\n\n /**\n * Set the page size of the scroll bar.\n *\n * #### Notes\n * The page size will be clamped to the range `[0, Infinity]`.\n */\n set page(value: number) {\n // Clamp the page size to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._page === value) {\n return;\n }\n\n // Update the internal page size.\n this._page = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the maximum value of the scroll bar.\n */\n get maximum(): number {\n return this._maximum;\n }\n\n /**\n * Set the maximum value of the scroll bar.\n *\n * #### Notes\n * The max size will be clamped to the range `[0, Infinity]`.\n */\n set maximum(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._maximum === value) {\n return;\n }\n\n // Update the internal values.\n this._maximum = value;\n\n // Clamp the current value to the new range.\n this._value = Math.min(this._value, value);\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * The scroll bar decrement button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get decrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar increment button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get incrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[1] as HTMLDivElement;\n }\n\n /**\n * The scroll bar track node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get trackNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-track'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar thumb node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get thumbNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-thumb'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Handle the DOM events for the scroll bar.\n *\n * @param event - The DOM event sent to the scroll bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the scroll bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A method invoked on a 'before-attach' message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('mousedown', this);\n this.update();\n }\n\n /**\n * A method invoked on an 'after-detach' message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n }\n\n /**\n * A method invoked on an 'update-request' message.\n */\n protected onUpdateRequest(msg: Message): void {\n // Convert the value and page into percentages.\n let value = (this._value * 100) / this._maximum;\n let page = (this._page * 100) / (this._page + this._maximum);\n\n // Clamp the value and page to the relevant range.\n value = Math.max(0, Math.min(value, 100));\n page = Math.max(0, Math.min(page, 100));\n\n // Fetch the thumb style.\n let thumbStyle = this.thumbNode.style;\n\n // Update the thumb style for the current orientation.\n if (this._orientation === 'horizontal') {\n thumbStyle.top = '';\n thumbStyle.height = '';\n thumbStyle.left = `${value}%`;\n thumbStyle.width = `${page}%`;\n thumbStyle.transform = `translate(${-value}%, 0%)`;\n } else {\n thumbStyle.left = '';\n thumbStyle.width = '';\n thumbStyle.top = `${value}%`;\n thumbStyle.height = `${page}%`;\n thumbStyle.transform = `translate(0%, ${-value}%)`;\n }\n }\n\n /**\n * Handle the `'keydown'` event for the scroll bar.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Ignore anything except the `Escape` key.\n if (event.keyCode !== 27) {\n return;\n }\n\n // Fetch the previous scroll value.\n let value = this._pressData ? this._pressData.value : -1;\n\n // Release the mouse.\n this._releaseMouse();\n\n // Restore the old scroll value if possible.\n if (value !== -1) {\n this._moveThumb(value);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the scroll bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Do nothing if it's not a left mouse press.\n if (event.button !== 0) {\n return;\n }\n\n // Send an activate request to the scroll bar. This can be\n // used by message hooks to activate something relevant.\n this.activate();\n\n // Do nothing if the mouse is already captured.\n if (this._pressData) {\n return;\n }\n\n // Find the pressed scroll bar part.\n let part = Private.findPart(this, event.target as HTMLElement);\n\n // Do nothing if the part is not of interest.\n if (!part) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Override the mouse cursor.\n let override = Drag.overrideCursor('default');\n\n // Set up the press data.\n this._pressData = {\n part,\n override,\n delta: -1,\n value: -1,\n mouseX: event.clientX,\n mouseY: event.clientY\n };\n\n // Add the extra event listeners.\n document.addEventListener('mousemove', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Handle a thumb press.\n if (part === 'thumb') {\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Update the press data delta for the current orientation.\n if (this._orientation === 'horizontal') {\n this._pressData.delta = event.clientX - thumbRect.left;\n } else {\n this._pressData.delta = event.clientY - thumbRect.top;\n }\n\n // Add the active class to the thumb node.\n thumbNode.classList.add('lm-mod-active');\n\n // Store the current value in the press data.\n this._pressData.value = this._value;\n\n // Finished.\n return;\n }\n\n // Handle a track press.\n if (part === 'track') {\n // Fetch the client rect for the thumb.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n\n // Handle a decrement button press.\n if (part === 'decrement') {\n // Add the active class to the decrement node.\n this.decrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button press.\n if (part === 'increment') {\n // Add the active class to the increment node.\n this.incrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the scroll bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Do nothing if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Update the mouse position.\n this._pressData.mouseX = event.clientX;\n this._pressData.mouseY = event.clientY;\n\n // Bail if the thumb is not being dragged.\n if (this._pressData.part !== 'thumb') {\n return;\n }\n\n // Get the client rect for the thumb and track.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n let trackRect = this.trackNode.getBoundingClientRect();\n\n // Fetch the scroll geometry based on the orientation.\n let trackPos: number;\n let trackSpan: number;\n if (this._orientation === 'horizontal') {\n trackPos = event.clientX - trackRect.left - this._pressData.delta;\n trackSpan = trackRect.width - thumbRect.width;\n } else {\n trackPos = event.clientY - trackRect.top - this._pressData.delta;\n trackSpan = trackRect.height - thumbRect.height;\n }\n\n // Compute the desired value from the scroll geometry.\n let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n // Move the thumb to the computed value.\n this._moveThumb(value);\n }\n\n /**\n * Handle the `'mouseup'` event for the scroll bar.\n */\n private _evtMouseUp(event: MouseEvent): void {\n // Do nothing if it's not a left mouse release.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse and restore the node states.\n */\n private _releaseMouse(): void {\n // Bail if there is no press data.\n if (!this._pressData) {\n return;\n }\n\n // Clear the repeat timer.\n clearTimeout(this._repeatTimer);\n this._repeatTimer = -1;\n\n // Clear the press data.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra event listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n\n // Remove the active classes from the nodes.\n this.thumbNode.classList.remove('lm-mod-active');\n this.decrementNode.classList.remove('lm-mod-active');\n this.incrementNode.classList.remove('lm-mod-active');\n }\n\n /**\n * Move the thumb to the specified position.\n */\n private _moveThumb(value: number): void {\n // Clamp the value to the allowed range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Bail if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update of the scroll bar.\n this.update();\n\n // Emit the thumb moved signal.\n this._thumbMoved.emit(value);\n }\n\n /**\n * A timeout callback for repeating the mouse press.\n */\n private _onRepeat = () => {\n // Clear the repeat timer id.\n this._repeatTimer = -1;\n\n // Bail if the mouse has been released.\n if (!this._pressData) {\n return;\n }\n\n // Look up the part that was pressed.\n let part = this._pressData.part;\n\n // Bail if the thumb was pressed.\n if (part === 'thumb') {\n return;\n }\n\n // Schedule the timer for another repeat.\n this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n // Get the current mouse position.\n let mouseX = this._pressData.mouseX;\n let mouseY = this._pressData.mouseY;\n\n // Handle a decrement button repeat.\n if (part === 'decrement') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button repeat.\n if (part === 'increment') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n\n // Handle a track repeat.\n if (part === 'track') {\n // Bail if the mouse is not over the track.\n if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Bail if the mouse is over the thumb.\n if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n };\n\n private _value = 0;\n private _page = 10;\n private _maximum = 100;\n private _repeatTimer = -1;\n private _orientation: ScrollBar.Orientation;\n private _pressData: Private.IPressData | null = null;\n private _thumbMoved = new Signal(this);\n private _stepRequested = new Signal(this);\n private _pageRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n /**\n * A type alias for a scroll bar orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * An options object for creating a scroll bar.\n */\n export interface IOptions {\n /**\n * The orientation of the scroll bar.\n *\n * The default is `'vertical'`.\n */\n orientation?: Orientation;\n\n /**\n * The value for the scroll bar.\n *\n * The default is `0`.\n */\n value?: number;\n\n /**\n * The page size for the scroll bar.\n *\n * The default is `10`.\n */\n page?: number;\n\n /**\n * The maximum value for the scroll bar.\n *\n * The default is `100`.\n */\n maximum?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A type alias for the parts of a scroll bar.\n */\n export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The scroll bar part which was pressed.\n */\n part: ScrollBarPart;\n\n /**\n * The offset of the press in thumb coordinates, or -1.\n */\n delta: number;\n\n /**\n * The scroll value at the time the thumb was pressed, or -1.\n */\n value: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n\n /**\n * The current X position of the mouse.\n */\n mouseX: number;\n\n /**\n * The current Y position of the mouse.\n */\n mouseY: number;\n }\n\n /**\n * Create the DOM node for a scroll bar.\n */\n export function createNode(): HTMLElement {\n let node = document.createElement('div');\n let decrement = document.createElement('div');\n let increment = document.createElement('div');\n let track = document.createElement('div');\n let thumb = document.createElement('div');\n decrement.className = 'lm-ScrollBar-button';\n increment.className = 'lm-ScrollBar-button';\n decrement.dataset['action'] = 'decrement';\n increment.dataset['action'] = 'increment';\n track.className = 'lm-ScrollBar-track';\n thumb.className = 'lm-ScrollBar-thumb';\n track.appendChild(thumb);\n node.appendChild(decrement);\n node.appendChild(track);\n node.appendChild(increment);\n return node;\n }\n\n /**\n * Find the scroll bar part which contains the given target.\n */\n export function findPart(\n scrollBar: ScrollBar,\n target: HTMLElement\n ): ScrollBarPart | null {\n // Test the thumb.\n if (scrollBar.thumbNode.contains(target)) {\n return 'thumb';\n }\n\n // Test the track.\n if (scrollBar.trackNode.contains(target)) {\n return 'track';\n }\n\n // Test the decrement button.\n if (scrollBar.decrementNode.contains(target)) {\n return 'decrement';\n }\n\n // Test the increment button.\n if (scrollBar.incrementNode.contains(target)) {\n return 'increment';\n }\n\n // Indicate no match.\n return null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this._widget) {\n let widget = this._widget;\n this._widget = null;\n widget.dispose();\n }\n super.dispose();\n }\n\n /**\n * Get the child widget for the layout.\n */\n get widget(): Widget | null {\n return this._widget;\n }\n\n /**\n * Set the child widget for the layout.\n *\n * #### Notes\n * Setting the child widget will cause the old child widget to be\n * automatically disposed. If that is not desired, set the parent\n * of the old child to `null` before assigning a new child.\n */\n set widget(widget: Widget | null) {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n if (widget) {\n widget.parent = this.parent;\n }\n\n // Bail early if the widget does not change.\n if (this._widget === widget) {\n return;\n }\n\n // Dispose of the old child widget.\n if (this._widget) {\n this._widget.dispose();\n }\n\n // Update the internal widget.\n this._widget = widget;\n\n // Attach the new child widget if needed.\n if (this.parent && widget) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n if (this._widget) {\n yield this._widget;\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Bail early if the widget does not exist in the layout.\n if (this._widget !== widget) {\n return;\n }\n\n // Clear the internal widget.\n this._widget = null;\n\n // If the layout is parented, detach the widget from the DOM.\n if (this.parent) {\n this.detachWidget(widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n constructor(options: StackedLayout.IOptions = {}) {\n super(options);\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n if (this.widgets.length > 1) {\n this.widgets.forEach(w => {\n w.hiddenMode = this._hiddenMode;\n });\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n this._items.length > 0\n ) {\n if (this._items.length === 1) {\n this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n }\n widget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n widget.hiddenMode = Widget.HiddenMode.Display;\n }\n\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Reset the z-index for the widget.\n item!.widget.node.style.zIndex = '';\n\n // Reset the hidden mode for the widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n widget.hiddenMode = Widget.HiddenMode.Display;\n\n // Reset the hidden mode for the first widget if necessary.\n if (this._items.length === 1) {\n this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n }\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the computed minimum size.\n minW = Math.max(minW, item.minWidth);\n minH = Math.max(minH, item.minHeight);\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the widget stacking order and layout geometry.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Set the z-index for the widget.\n item.widget.node.style.zIndex = `${i}`;\n\n // Update the item geometry.\n item.update(left, top, width, height);\n }\n }\n\n private _dirty = false;\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n /**\n * An options object for initializing a stacked layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n /**\n * Construct a new stacked panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: StackedPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-StackedPanel');\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as StackedLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as StackedLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when a widget is removed from a stacked panel.\n */\n get widgetRemoved(): ISignal {\n return this._widgetRemoved;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-StackedPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-StackedPanel-child');\n this._widgetRemoved.emit(msg.child);\n }\n\n private _widgetRemoved = new Signal(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n /**\n * An options object for creating a stacked panel.\n */\n export interface IOptions {\n /**\n * The stacked layout to use for the stacked panel.\n *\n * The default is a new `StackedLayout`.\n */\n layout?: StackedLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a stacked layout for the given panel options.\n */\n export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n return options.layout || new StackedLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n constructor(options: TabPanel.IOptions = {}) {\n super();\n this.addClass('lm-TabPanel');\n\n // Create the tab bar and stacked panel.\n this.tabBar = new TabBar(options);\n this.tabBar.addClass('lm-TabPanel-tabBar');\n this.stackedPanel = new StackedPanel();\n this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n // Connect the tab bar signal handlers.\n this.tabBar.tabMoved.connect(this._onTabMoved, this);\n this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n this.tabBar.tabActivateRequested.connect(\n this._onTabActivateRequested,\n this\n );\n this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Connect the stacked panel signal handlers.\n this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n // Get the data related to the placement.\n this._tabPlacement = options.tabPlacement || 'top';\n let direction = Private.directionFromPlacement(this._tabPlacement);\n let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = this._tabPlacement;\n\n // Create the box layout.\n let layout = new BoxLayout({ direction, spacing: 0 });\n\n // Set the stretch factors for the child widgets.\n BoxLayout.setStretch(this.tabBar, 0);\n BoxLayout.setStretch(this.stackedPanel, 1);\n\n // Add the child widgets to the layout.\n layout.addWidget(this.tabBar);\n layout.addWidget(this.stackedPanel);\n\n // Install the layout on the tab panel.\n this.layout = layout;\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal {\n return this._currentChanged;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this.tabBar.currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `-1`.\n */\n set currentIndex(value: number) {\n this.tabBar.currentIndex = value;\n }\n\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get currentWidget(): Widget | null {\n let title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n }\n\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set currentWidget(value: Widget | null) {\n this.tabBar.currentTitle = value ? value.title : null;\n }\n\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get tabsMovable(): boolean {\n return this.tabBar.tabsMovable;\n }\n\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set tabsMovable(value: boolean) {\n this.tabBar.tabsMovable = value;\n }\n\n /**\n * Get the whether the add button is enabled.\n *\n */\n get addButtonEnabled(): boolean {\n return this.tabBar.addButtonEnabled;\n }\n\n /**\n * Set the whether the add button is enabled.\n *\n */\n set addButtonEnabled(value: boolean) {\n this.tabBar.addButtonEnabled = value;\n }\n\n /**\n * Get the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n get tabPlacement(): TabPanel.TabPlacement {\n return this._tabPlacement;\n }\n\n /**\n * Set the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n set tabPlacement(value: TabPanel.TabPlacement) {\n // Bail if the placement does not change.\n if (this._tabPlacement === value) {\n return;\n }\n\n // Update the internal value.\n this._tabPlacement = value;\n\n // Get the values related to the placement.\n let direction = Private.directionFromPlacement(value);\n let orientation = Private.orientationFromPlacement(value);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = value;\n\n // Update the layout direction.\n (this.layout as BoxLayout).direction = direction;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The tab bar used by the tab panel.\n *\n * #### Notes\n * Modifying the tab bar directly can lead to undefined behavior.\n */\n readonly tabBar: TabBar;\n\n /**\n * The stacked panel used by the tab panel.\n *\n * #### Notes\n * Modifying the panel directly can lead to undefined behavior.\n */\n readonly stackedPanel: StackedPanel;\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return this.stackedPanel.widgets;\n }\n\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this.widgets.length, widget);\n }\n\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n insertWidget(index: number, widget: Widget): void {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.stackedPanel.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n\n widget.node.setAttribute('role', 'tabpanel');\n\n let renderer = this.tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n // Extract the widgets from the titles.\n let previousWidget = previousTitle ? previousTitle.owner : null;\n let currentWidget = currentTitle ? currentTitle.owner : null;\n\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex,\n previousWidget,\n currentIndex,\n currentWidget\n });\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n }\n\n /**\n * Handle the `tabAddRequested` signal from the tab bar.\n */\n private _onTabAddRequested(sender: TabBar, args: void): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n private _onTabMoved(\n sender: TabBar,\n args: TabBar.ITabMovedArgs\n ): void {\n this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n }\n\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n this.tabBar.removeTab(widget.title);\n }\n\n private _tabPlacement: TabPanel.TabPlacement;\n private _currentChanged = new Signal(\n this\n );\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n /**\n * A type alias for tab placement in a tab bar.\n */\n export type TabPlacement =\n | /**\n * The tabs are placed as a row above the content.\n */\n 'top'\n\n /**\n * The tabs are placed as a column to the left of the content.\n */\n | 'left'\n\n /**\n * The tabs are placed as a column to the right of the content.\n */\n | 'right'\n\n /**\n * The tabs are placed as a row below the content.\n */\n | 'bottom';\n\n /**\n * An options object for initializing a tab panel.\n */\n export interface IOptions {\n /**\n * The document to use with the tab panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether the button to add new tabs is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The placement of the tab bar relative to the content.\n *\n * The default is `'top'`.\n */\n tabPlacement?: TabPlacement;\n\n /**\n * The renderer for the panel's tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: TabBar.IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n previousIndex: number;\n\n /**\n * The previously selected widget.\n */\n previousWidget: Widget | null;\n\n /**\n * The currently selected index.\n */\n currentIndex: number;\n\n /**\n * The currently selected widget.\n */\n currentWidget: Widget | null;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Convert a tab placement to tab bar orientation.\n */\n export function orientationFromPlacement(\n plc: TabPanel.TabPlacement\n ): TabBar.Orientation {\n return placementToOrientationMap[plc];\n }\n\n /**\n * Convert a tab placement to a box layout direction.\n */\n export function directionFromPlacement(\n plc: TabPanel.TabPlacement\n ): BoxLayout.Direction {\n return placementToDirectionMap[plc];\n }\n\n /**\n * A mapping of tab placement to tab bar orientation.\n */\n const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n top: 'horizontal',\n left: 'vertical',\n right: 'vertical',\n bottom: 'horizontal'\n };\n\n /**\n * A mapping of tab placement to box layout direction.\n */\n const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n top: 'top-to-bottom',\n left: 'left-to-right',\n right: 'right-to-left',\n bottom: 'bottom-to-top'\n };\n}\n"],"names":["Private","Utils"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;;;;;;AAM+E;AAE/E;;;;;;;;;AASG;MACU,QAAQ,CAAA;AAArB,IAAA,WAAA,GAAA;AACE;;;;;;;;;;;;AAYG;QACH,IAAQ,CAAA,QAAA,GAAG,CAAC,CAAC;AAEb;;;;;;;;;;;;AAYG;QACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;AAEZ;;;;;;;;;;;;AAYG;QACH,IAAO,CAAA,OAAA,GAAG,QAAQ,CAAC;AAEnB;;;;;;;;;;;;;;;AAeG;QACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;AAEZ;;;;;;;;;;;AAWG;QACH,IAAI,CAAA,IAAA,GAAG,CAAC,CAAC;AAET;;;;;;;AAOG;QACH,IAAI,CAAA,IAAA,GAAG,KAAK,CAAC;KACd;AAAA,CAAA;AAED;;AAEG;AACG,IAAW,UA0XhB;AA1XD,CAAA,UAAiB,SAAS,EAAA;AACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DG;AACH,IAAA,SAAgB,IAAI,CAAC,MAA2B,EAAE,KAAa,EAAA;;AAE7D,QAAA,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;QAC1B,IAAI,KAAK,KAAK,CAAC,EAAE;AACf,YAAA,OAAO,KAAK,CAAC;AACd,SAAA;;QAGD,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,SAAS,GAAG,CAAC,CAAC;QAClB,IAAI,YAAY,GAAG,CAAC,CAAC;QACrB,IAAI,YAAY,GAAG,CAAC,CAAC;;QAGrB,KAAK,IAAI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BAAuB,CAAC,GAAG,CAAC,CAAC;KACrC;AAJe,IAAA,OAAA,CAAA,sBAAsB,yBAIrC,CAAA;AAED;;AAEG;AACH,IAAA,MAAM,yBAAyB,GAA0C;AACvE,QAAA,GAAG,EAAE,YAAY;AACjB,QAAA,IAAI,EAAE,UAAU;AAChB,QAAA,KAAK,EAAE,UAAU;AACjB,QAAA,MAAM,EAAE,YAAY;KACrB,CAAC;AAEF;;AAEG;AACH,IAAA,MAAM,uBAAuB,GAA2C;AACtE,QAAA,GAAG,EAAE,eAAe;AACpB,QAAA,IAAI,EAAE,eAAe;AACrB,QAAA,KAAK,EAAE,eAAe;AACtB,QAAA,MAAM,EAAE,eAAe;KACxB,CAAC;AACJ,CAAC,EAtCS,OAAO,KAAP,OAAO,GAsChB,EAAA,CAAA,CAAA;;;;"} +\ No newline at end of file ++{"version":3,"file":"index.es6.js","sources":["../src/boxengine.ts","../src/title.ts","../src/widget.ts","../src/layout.ts","../src/panellayout.ts","../src/utils.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/focustracker.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/stackedpanel.ts","../src/tabpanel.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n /**\n * The preferred size for the sizer.\n *\n * #### Notes\n * The sizer will be given this initial size subject to its size\n * bounds. The sizer will not deviate from this size unless such\n * deviation is required to fit into the available layout space.\n *\n * There is no limit to this value, but it will be clamped to the\n * bounds defined by {@link minSize} and {@link maxSize}.\n *\n * The default value is `0`.\n */\n sizeHint = 0;\n\n /**\n * The minimum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized less than this value, even if\n * it means the sizer will overflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity)`\n * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `0`.\n */\n minSize = 0;\n\n /**\n * The maximum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized greater than this value, even if\n * it means the sizer will underflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity]`\n * and that it is `>=` to {@link minSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `Infinity`.\n */\n maxSize = Infinity;\n\n /**\n * The stretch factor for the sizer.\n *\n * #### Notes\n * This controls how much the sizer stretches relative to its sibling\n * sizers when layout space is distributed. A stretch factor of zero\n * is special and will cause the sizer to only be resized after all\n * other sizers with a stretch factor greater than zero have been\n * resized to their limits.\n *\n * It is assumed that this value is an integer that lies in the range\n * `[0, Infinity)`. Failure to adhere to this constraint will yield\n * undefined results.\n *\n * The default value is `1`.\n */\n stretch = 1;\n\n /**\n * The computed size of the sizer.\n *\n * #### Notes\n * This value is the output of a call to {@link BoxEngine.calc}. It represents\n * the computed size for the object along the layout orientation,\n * and will always lie in the range `[minSize, maxSize]`.\n *\n * This value is output only.\n *\n * Changing this value will have no effect.\n */\n size = 0;\n\n /**\n * An internal storage property for the layout algorithm.\n *\n * #### Notes\n * This value is used as temporary storage by the layout algorithm.\n *\n * Changing this value will have no effect.\n */\n done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n /**\n * Calculate the optimal layout sizes for a sequence of box sizers.\n *\n * This distributes the available layout space among the box sizers\n * according to the following algorithm:\n *\n * 1. Initialize the sizers's size to its size hint and compute the\n * sums for each of size hint, min size, and max size.\n *\n * 2. If the total size hint equals the available space, return.\n *\n * 3. If the available space is less than the total min size, set all\n * sizers to their min size and return.\n *\n * 4. If the available space is greater than the total max size, set\n * all sizers to their max size and return.\n *\n * 5. If the layout space is less than the total size hint, distribute\n * the negative delta as follows:\n *\n * a. Shrink each sizer with a stretch factor greater than zero by\n * an amount proportional to the negative space and the sum of\n * stretch factors. If the sizer reaches its min size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains negative\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its min size,\n * remove it from the computation.\n *\n * 6. If the layout space is greater than the total size hint,\n * distribute the positive delta as follows:\n *\n * a. Expand each sizer with a stretch factor greater than zero by\n * an amount proportional to the postive space and the sum of\n * stretch factors. If the sizer reaches its max size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains positive\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its max size,\n * remove it from the computation.\n *\n * 7. return\n *\n * @param sizers - The sizers for a particular layout line.\n *\n * @param space - The available layout space for the sizers.\n *\n * @returns The delta between the provided available space and the\n * actual consumed space. This value will be zero if the sizers\n * can be adjusted to fit, negative if the available space is too\n * small, and positive if the available space is too large.\n *\n * #### Notes\n * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n *\n * This function can be called at any time to recompute the layout for\n * an existing sequence of sizers. The previously computed results will\n * have no effect on the new output. It is therefore not necessary to\n * create new sizer objects on each resize event.\n */\n export function calc(sizers: ArrayLike, space: number): number {\n // Bail early if there is nothing to do.\n let count = sizers.length;\n if (count === 0) {\n return space;\n }\n\n // Setup the size and stretch counters.\n let totalMin = 0;\n let totalMax = 0;\n let totalSize = 0;\n let totalStretch = 0;\n let stretchCount = 0;\n\n // Setup the sizers and compute the totals.\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n let min = sizer.minSize;\n let max = sizer.maxSize;\n let hint = sizer.sizeHint;\n sizer.done = false;\n sizer.size = Math.max(min, Math.min(hint, max));\n totalSize += sizer.size;\n totalMin += min;\n totalMax += max;\n if (sizer.stretch > 0) {\n totalStretch += sizer.stretch;\n stretchCount++;\n }\n }\n\n // If the space is equal to the total size, return early.\n if (space === totalSize) {\n return 0;\n }\n\n // If the space is less than the total min, minimize each sizer.\n if (space <= totalMin) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.minSize;\n }\n return space - totalMin;\n }\n\n // If the space is greater than the total max, maximize each sizer.\n if (space >= totalMax) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.maxSize;\n }\n return space - totalMax;\n }\n\n // The loops below perform sub-pixel precision sizing. A near zero\n // value is used for compares instead of zero to ensure that the\n // loop terminates when the subdivided space is reasonably small.\n let nearZero = 0.01;\n\n // A counter which is decremented each time a sizer is resized to\n // its limit. This ensures the loops terminate even if there is\n // space remaining to distribute.\n let notDoneCount = count;\n\n // Distribute negative delta space.\n if (space < totalSize) {\n // Shrink each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its min size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = totalSize - space;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n }\n // Distribute positive delta space.\n else {\n // Expand each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its max size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = space - totalSize;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n }\n\n // Indicate that the consumed space equals the available space.\n return 0;\n }\n\n /**\n * Adjust a sizer by a delta and update its neighbors accordingly.\n *\n * @param sizers - The sizers which should be adjusted.\n *\n * @param index - The index of the sizer to grow.\n *\n * @param delta - The amount to adjust the sizer, positive or negative.\n *\n * #### Notes\n * This will adjust the indicated sizer by the specified amount, along\n * with the sizes of the appropriate neighbors, subject to the limits\n * specified by each of the sizers.\n *\n * This is useful when implementing box layouts where the boundaries\n * between the sizers are interactively adjustable by the user.\n */\n export function adjust(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Bail early when there is nothing to do.\n if (sizers.length === 0 || delta === 0) {\n return;\n }\n\n // Dispatch to the proper implementation.\n if (delta > 0) {\n growSizer(sizers, index, delta);\n } else {\n shrinkSizer(sizers, index, -delta);\n }\n }\n\n /**\n * Grow a sizer by a positive delta and adjust neighbors.\n */\n function growSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the left can expand.\n let growLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the right can shrink.\n let shrinkLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the left by the delta.\n let grow = delta;\n for (let i = index; i >= 0 && grow > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the right by the delta.\n let shrink = delta;\n for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n\n /**\n * Shrink a sizer by a positive delta and adjust neighbors.\n */\n function shrinkSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the right can expand.\n let growLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the left can shrink.\n let shrinkLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the right by the delta.\n let grow = delta;\n for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the left by the delta.\n let shrink = delta;\n for (let i = index; i >= 0 && shrink > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title implements IDisposable {\n /**\n * Construct a new title.\n *\n * @param options - The options for initializing the title.\n */\n constructor(options: Title.IOptions) {\n this.owner = options.owner;\n if (options.label !== undefined) {\n this._label = options.label;\n }\n if (options.mnemonic !== undefined) {\n this._mnemonic = options.mnemonic;\n }\n if (options.icon !== undefined) {\n this._icon = options.icon;\n }\n\n if (options.iconClass !== undefined) {\n this._iconClass = options.iconClass;\n }\n if (options.iconLabel !== undefined) {\n this._iconLabel = options.iconLabel;\n }\n if (options.caption !== undefined) {\n this._caption = options.caption;\n }\n if (options.className !== undefined) {\n this._className = options.className;\n }\n if (options.closable !== undefined) {\n this._closable = options.closable;\n }\n this._dataset = options.dataset || {};\n }\n\n /**\n * A signal emitted when the state of the title changes.\n */\n get changed(): ISignal {\n return this._changed;\n }\n\n /**\n * The object which owns the title.\n */\n readonly owner: T;\n\n /**\n * Get the label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get label(): string {\n return this._label;\n }\n\n /**\n * Set the label for the title.\n */\n set label(value: string) {\n if (this._label === value) {\n return;\n }\n this._label = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the mnemonic index for the title.\n *\n * #### Notes\n * The default value is `-1`.\n */\n get mnemonic(): number {\n return this._mnemonic;\n }\n\n /**\n * Set the mnemonic index for the title.\n */\n set mnemonic(value: number) {\n if (this._mnemonic === value) {\n return;\n }\n this._mnemonic = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon renderer for the title.\n *\n * #### Notes\n * The default value is undefined.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._icon;\n }\n\n /**\n * Set the icon renderer for the title.\n *\n * #### Notes\n * A renderer is an object that supplies a render and unrender function.\n */\n set icon(value: VirtualElement.IRenderer | undefined) {\n if (this._icon === value) {\n return;\n }\n this._icon = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconClass(): string {\n return this._iconClass;\n }\n\n /**\n * Set the icon class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconClass(value: string) {\n if (this._iconClass === value) {\n return;\n }\n this._iconClass = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconLabel(): string {\n return this._iconLabel;\n }\n\n /**\n * Set the icon label for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconLabel(value: string) {\n if (this._iconLabel === value) {\n return;\n }\n this._iconLabel = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the caption for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get caption(): string {\n return this._caption;\n }\n\n /**\n * Set the caption for the title.\n */\n set caption(value: string) {\n if (this._caption === value) {\n return;\n }\n this._caption = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the extra class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get className(): string {\n return this._className;\n }\n\n /**\n * Set the extra class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set className(value: string) {\n if (this._className === value) {\n return;\n }\n this._className = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the closable state for the title.\n *\n * #### Notes\n * The default value is `false`.\n */\n get closable(): boolean {\n return this._closable;\n }\n\n /**\n * Set the closable state for the title.\n *\n * #### Notes\n * This controls the presence of a close icon when applicable.\n */\n set closable(value: boolean) {\n if (this._closable === value) {\n return;\n }\n this._closable = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the dataset for the title.\n *\n * #### Notes\n * The default value is an empty dataset.\n */\n get dataset(): Title.Dataset {\n return this._dataset;\n }\n\n /**\n * Set the dataset for the title.\n *\n * #### Notes\n * This controls the data attributes when applicable.\n */\n set dataset(value: Title.Dataset) {\n if (this._dataset === value) {\n return;\n }\n this._dataset = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Test whether the title has been disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the title.\n *\n * #### Notes\n * It is the responsibility of the owner to call the title disposal.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n\n Signal.clearData(this);\n }\n\n private _label = '';\n private _caption = '';\n private _mnemonic = -1;\n private _icon: VirtualElement.IRenderer | undefined = undefined;\n private _iconClass = '';\n private _iconLabel = '';\n private _className = '';\n private _closable = false;\n private _dataset: Title.Dataset;\n private _changed = new Signal(this);\n private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n /**\n * A type alias for a simple immutable string dataset.\n */\n export type Dataset = { readonly [key: string]: string };\n\n /**\n * An options object for initializing a title.\n */\n export interface IOptions {\n /**\n * The object which owns the title.\n */\n owner: T;\n\n /**\n * The label for the title.\n */\n label?: string;\n\n /**\n * The mnemonic index for the title.\n */\n mnemonic?: number;\n\n /**\n * The icon renderer for the title.\n */\n icon?: VirtualElement.IRenderer;\n\n /**\n * The icon class name for the title.\n */\n iconClass?: string;\n\n /**\n * The icon label for the title.\n */\n iconLabel?: string;\n\n /**\n * The caption for the title.\n */\n caption?: string;\n\n /**\n * The extra class name for the title.\n */\n className?: string;\n\n /**\n * The closable state for the title.\n */\n closable?: boolean;\n\n /**\n * The dataset for the title.\n */\n dataset?: Dataset;\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n ConflatableMessage,\n IMessageHandler,\n Message,\n MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n /**\n * Construct a new widget.\n *\n * @param options - The options for initializing the widget.\n */\n constructor(options: Widget.IOptions = {}) {\n this.node = Private.createNode(options);\n this.addClass('lm-Widget');\n }\n\n /**\n * Dispose of the widget and its descendant widgets.\n *\n * #### Notes\n * It is unsafe to use the widget after it has been disposed.\n *\n * All calls made to this method after the first are a no-op.\n */\n dispose(): void {\n // Do nothing if the widget is already disposed.\n if (this.isDisposed) {\n return;\n }\n\n // Set the disposed flag and emit the disposed signal.\n this.setFlag(Widget.Flag.IsDisposed);\n this._disposed.emit(undefined);\n\n // Remove or detach the widget if necessary.\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n\n // Dispose of the widget layout.\n if (this._layout) {\n this._layout.dispose();\n this._layout = null;\n }\n\n // Dispose the title\n this.title.dispose();\n\n // Clear the extra data associated with the widget.\n Signal.clearData(this);\n MessageLoop.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * A signal emitted when the widget is disposed.\n */\n get disposed(): ISignal {\n return this._disposed;\n }\n\n /**\n * Get the DOM node owned by the widget.\n */\n readonly node: HTMLElement;\n\n /**\n * Test whether the widget has been disposed.\n */\n get isDisposed(): boolean {\n return this.testFlag(Widget.Flag.IsDisposed);\n }\n\n /**\n * Test whether the widget's node is attached to the DOM.\n */\n get isAttached(): boolean {\n return this.testFlag(Widget.Flag.IsAttached);\n }\n\n /**\n * Test whether the widget is explicitly hidden.\n */\n get isHidden(): boolean {\n return this.testFlag(Widget.Flag.IsHidden);\n }\n\n /**\n * Test whether the widget is visible.\n *\n * #### Notes\n * A widget is visible when it is attached to the DOM, is not\n * explicitly hidden, and has no explicitly hidden ancestors.\n */\n get isVisible(): boolean {\n return this.testFlag(Widget.Flag.IsVisible);\n }\n\n /**\n * The title object for the widget.\n *\n * #### Notes\n * The title object is used by some container widgets when displaying\n * the widget alongside some title, such as a tab panel or side bar.\n *\n * Since not all widgets will use the title, it is created on demand.\n *\n * The `owner` property of the title is set to this widget.\n */\n get title(): Title {\n return Private.titleProperty.get(this);\n }\n\n /**\n * Get the id of the widget's DOM node.\n */\n get id(): string {\n return this.node.id;\n }\n\n /**\n * Set the id of the widget's DOM node.\n */\n set id(value: string) {\n this.node.id = value;\n }\n\n /**\n * The dataset for the widget's DOM node.\n */\n get dataset(): DOMStringMap {\n return this.node.dataset;\n }\n\n /**\n * Get the method for hiding the widget.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding the widget.\n */\n set hiddenMode(value: Widget.HiddenMode) {\n if (this._hiddenMode === value) {\n return;\n }\n\n if (this.isHidden) {\n // Reset styles set by previous mode.\n this._toggleHidden(false);\n }\n\n if (value == Widget.HiddenMode.Scale) {\n this.node.style.willChange = 'transform';\n } else {\n this.node.style.willChange = 'auto';\n }\n\n this._hiddenMode = value;\n\n if (this.isHidden) {\n // Set styles for new mode.\n this._toggleHidden(true);\n }\n }\n\n /**\n * Get the parent of the widget.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent of the widget.\n *\n * #### Notes\n * Children are typically added to a widget by using a layout, which\n * means user code will not normally set the parent widget directly.\n *\n * The widget will be automatically removed from its old parent.\n *\n * This is a no-op if there is no effective parent change.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (value && this.contains(value)) {\n throw new Error('Invalid parent widget.');\n }\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-removed', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n this._parent = value;\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-added', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n if (!this.isDisposed) {\n MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n }\n }\n\n /**\n * Get the layout for the widget.\n */\n get layout(): Layout | null {\n return this._layout;\n }\n\n /**\n * Set the layout for the widget.\n *\n * #### Notes\n * The layout is single-use only. It cannot be changed after the\n * first assignment.\n *\n * The layout is disposed automatically when the widget is disposed.\n */\n set layout(value: Layout | null) {\n if (this._layout === value) {\n return;\n }\n if (this.testFlag(Widget.Flag.DisallowLayout)) {\n throw new Error('Cannot set widget layout.');\n }\n if (this._layout) {\n throw new Error('Cannot change widget layout.');\n }\n if (value!.parent) {\n throw new Error('Cannot change layout parent.');\n }\n this._layout = value;\n value!.parent = this;\n }\n\n /**\n * Create an iterator over the widget's children.\n *\n * @returns A new iterator over the children of the widget.\n *\n * #### Notes\n * The widget must have a populated layout in order to have children.\n *\n * If a layout is not installed, the returned iterator will be empty.\n */\n *children(): IterableIterator {\n if (this._layout) {\n yield* this._layout;\n }\n }\n\n /**\n * Test whether a widget is a descendant of this widget.\n *\n * @param widget - The descendant widget of interest.\n *\n * @returns `true` if the widget is a descendant, `false` otherwise.\n */\n contains(widget: Widget): boolean {\n for (let value: Widget | null = widget; value; value = value._parent) {\n if (value === this) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Test whether the widget's DOM node has the given class name.\n *\n * @param name - The class name of interest.\n *\n * @returns `true` if the node has the class, `false` otherwise.\n */\n hasClass(name: string): boolean {\n return this.node.classList.contains(name);\n }\n\n /**\n * Add a class name to the widget's DOM node.\n *\n * @param name - The class name to add to the node.\n *\n * #### Notes\n * If the class name is already added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n addClass(name: string): void {\n this.node.classList.add(name);\n }\n\n /**\n * Remove a class name from the widget's DOM node.\n *\n * @param name - The class name to remove from the node.\n *\n * #### Notes\n * If the class name is not yet added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n removeClass(name: string): void {\n this.node.classList.remove(name);\n }\n\n /**\n * Toggle a class name on the widget's DOM node.\n *\n * @param name - The class name to toggle on the node.\n *\n * @param force - Whether to force add the class (`true`) or force\n * remove the class (`false`). If not provided, the presence of\n * the class will be toggled from its current state.\n *\n * @returns `true` if the class is now present, `false` otherwise.\n *\n * #### Notes\n * The class name must not contain whitespace.\n */\n toggleClass(name: string, force?: boolean): boolean {\n if (force === true) {\n this.node.classList.add(name);\n return true;\n }\n if (force === false) {\n this.node.classList.remove(name);\n return false;\n }\n return this.node.classList.toggle(name);\n }\n\n /**\n * Post an `'update-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n update(): void {\n MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n }\n\n /**\n * Post a `'fit-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n fit(): void {\n MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n }\n\n /**\n * Post an `'activate-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n activate(): void {\n MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n }\n\n /**\n * Send a `'close-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for sending the message.\n */\n close(): void {\n MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n }\n\n /**\n * Show the widget and make it visible to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `false`.\n *\n * If the widget is not explicitly hidden, this is a no-op.\n */\n show(): void {\n if (!this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n }\n this.clearFlag(Widget.Flag.IsHidden);\n this._toggleHidden(false);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-shown', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Hide the widget and make it hidden to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `true`.\n *\n * If the widget is explicitly hidden, this is a no-op.\n */\n hide(): void {\n if (this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n }\n this.setFlag(Widget.Flag.IsHidden);\n this._toggleHidden(true);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-hidden', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Show or hide the widget according to a boolean value.\n *\n * @param hidden - `true` to hide the widget, or `false` to show it.\n *\n * #### Notes\n * This is a convenience method for `hide()` and `show()`.\n */\n setHidden(hidden: boolean): void {\n if (hidden) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Test whether the given widget flag is set.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n testFlag(flag: Widget.Flag): boolean {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * Set the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n setFlag(flag: Widget.Flag): void {\n this._flags |= flag;\n }\n\n /**\n * Clear the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n clearFlag(flag: Widget.Flag): void {\n this._flags &= ~flag;\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n *\n * #### Notes\n * Subclasses may reimplement this method as needed.\n */\n processMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.notifyLayout(msg);\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.notifyLayout(msg);\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.notifyLayout(msg);\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.notifyLayout(msg);\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.setFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.notifyLayout(msg);\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.clearFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.notifyLayout(msg);\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n this.setFlag(Widget.Flag.IsVisible);\n }\n this.setFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.notifyLayout(msg);\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.clearFlag(Widget.Flag.IsVisible);\n this.clearFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterDetach(msg);\n break;\n case 'activate-request':\n this.notifyLayout(msg);\n this.onActivateRequest(msg);\n break;\n case 'close-request':\n this.notifyLayout(msg);\n this.onCloseRequest(msg);\n break;\n case 'child-added':\n this.notifyLayout(msg);\n this.onChildAdded(msg as Widget.ChildMessage);\n break;\n case 'child-removed':\n this.notifyLayout(msg);\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n default:\n this.notifyLayout(msg);\n break;\n }\n }\n\n /**\n * Invoke the message processing routine of the widget's layout.\n *\n * @param msg - The message to dispatch to the layout.\n *\n * #### Notes\n * This is a no-op if the widget does not have a layout.\n *\n * This will not typically be called directly by user code.\n */\n protected notifyLayout(msg: Message): void {\n if (this._layout) {\n this._layout.processParentMessage(msg);\n }\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n *\n * #### Notes\n * The default implementation unparents or detaches the widget.\n */\n protected onCloseRequest(msg: Message): void {\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onResize(msg: Widget.ResizeMessage): void {}\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onUpdateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onActivateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeShow(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterShow(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeHide(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterHide(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-added'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n private _toggleHidden(hidden: boolean) {\n if (hidden) {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.addClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = 'scale(0)';\n this.node.setAttribute('aria-hidden', 'true');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = 'hidden';\n this.node.style.zIndex = '-1';\n break;\n }\n } else {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.removeClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = '';\n this.node.removeAttribute('aria-hidden');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = '';\n this.node.style.zIndex = '';\n break;\n }\n }\n }\n\n private _flags = 0;\n private _layout: Layout | null = null;\n private _parent: Widget | null = null;\n private _disposed = new Signal(this);\n private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n /**\n * An options object for initializing a widget.\n */\n export interface IOptions {\n /**\n * The optional node to use for the widget.\n *\n * If a node is provided, the widget will assume full ownership\n * and control of the node, as if it had created the node itself.\n *\n * The default is a new `
`.\n */\n node?: HTMLElement;\n\n /**\n * The optional element tag, used for constructing the widget's node.\n *\n * If a pre-constructed node is provided via the `node` arg, this\n * value is ignored.\n */\n tag?: keyof HTMLElementTagNameMap;\n }\n\n /**\n * The method for hiding the widget.\n *\n * The default is Display.\n *\n * Using `Scale` will often increase performance as most browsers will not\n * trigger style computation for the `transform` action. This should be used\n * sparingly and tested, since increasing the number of composition layers\n * may slow things down.\n *\n * To ensure the transformation does not trigger style recomputation, you\n * may need to set the widget CSS style `will-change: transform`. This\n * should be used only when needed as it may overwhelm the browser with a\n * high number of layers. See\n * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n */\n export enum HiddenMode {\n /**\n * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n * CSS from the standard Lumino CSS.\n */\n Display = 0,\n\n /**\n * Hide the widget by setting the `transform` to `'scale(0)'`.\n */\n Scale,\n\n /**\n *Hide the widget by setting the `content-visibility` to `'hidden'`.\n */\n ContentVisibility\n }\n\n /**\n * An enum of widget bit flags.\n */\n export enum Flag {\n /**\n * The widget has been disposed.\n */\n IsDisposed = 0x1,\n\n /**\n * The widget is attached to the DOM.\n */\n IsAttached = 0x2,\n\n /**\n * The widget is hidden.\n */\n IsHidden = 0x4,\n\n /**\n * The widget is visible.\n */\n IsVisible = 0x8,\n\n /**\n * A layout cannot be set on the widget.\n */\n DisallowLayout = 0x10\n }\n\n /**\n * A collection of stateless messages related to widgets.\n */\n export namespace Msg {\n /**\n * A singleton `'before-show'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const BeforeShow = new Message('before-show');\n\n /**\n * A singleton `'after-show'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const AfterShow = new Message('after-show');\n\n /**\n * A singleton `'before-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const BeforeHide = new Message('before-hide');\n\n /**\n * A singleton `'after-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const AfterHide = new Message('after-hide');\n\n /**\n * A singleton `'before-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is attached.\n */\n export const BeforeAttach = new Message('before-attach');\n\n /**\n * A singleton `'after-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is attached.\n */\n export const AfterAttach = new Message('after-attach');\n\n /**\n * A singleton `'before-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is detached.\n */\n export const BeforeDetach = new Message('before-detach');\n\n /**\n * A singleton `'after-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is detached.\n */\n export const AfterDetach = new Message('after-detach');\n\n /**\n * A singleton `'parent-changed'` message.\n *\n * #### Notes\n * This message is sent to a widget when its parent has changed.\n */\n export const ParentChanged = new Message('parent-changed');\n\n /**\n * A singleton conflatable `'update-request'` message.\n *\n * #### Notes\n * This message can be dispatched to supporting widgets in order to\n * update their content based on the current widget state. Not all\n * widgets will respond to messages of this type.\n *\n * For widgets with a layout, this message will inform the layout to\n * update the position and size of its child widgets.\n */\n export const UpdateRequest = new ConflatableMessage('update-request');\n\n /**\n * A singleton conflatable `'fit-request'` message.\n *\n * #### Notes\n * For widgets with a layout, this message will inform the layout to\n * recalculate its size constraints to fit the space requirements of\n * its child widgets, and to update their position and size. Not all\n * layouts will respond to messages of this type.\n */\n export const FitRequest = new ConflatableMessage('fit-request');\n\n /**\n * A singleton conflatable `'activate-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should\n * perform the actions necessary to activate the widget, which\n * may include focusing its node or descendant node.\n */\n export const ActivateRequest = new ConflatableMessage('activate-request');\n\n /**\n * A singleton conflatable `'close-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should close\n * and remove itself from the widget hierarchy.\n */\n export const CloseRequest = new ConflatableMessage('close-request');\n }\n\n /**\n * A message class for child related messages.\n */\n export class ChildMessage extends Message {\n /**\n * Construct a new child message.\n *\n * @param type - The message type.\n *\n * @param child - The child widget for the message.\n */\n constructor(type: string, child: Widget) {\n super(type);\n this.child = child;\n }\n\n /**\n * The child widget for the message.\n */\n readonly child: Widget;\n }\n\n /**\n * A message class for `'resize'` messages.\n */\n export class ResizeMessage extends Message {\n /**\n * Construct a new resize message.\n *\n * @param width - The **offset width** of the widget, or `-1` if\n * the width is not known.\n *\n * @param height - The **offset height** of the widget, or `-1` if\n * the height is not known.\n */\n constructor(width: number, height: number) {\n super('resize');\n this.width = width;\n this.height = height;\n }\n\n /**\n * The offset width of the widget.\n *\n * #### Notes\n * This will be `-1` if the width is unknown.\n */\n readonly width: number;\n\n /**\n * The offset height of the widget.\n *\n * #### Notes\n * This will be `-1` if the height is unknown.\n */\n readonly height: number;\n }\n\n /**\n * The namespace for the `ResizeMessage` class statics.\n */\n export namespace ResizeMessage {\n /**\n * A singleton `'resize'` message with an unknown size.\n */\n export const UnknownSize = new ResizeMessage(-1, -1);\n }\n\n /**\n * Attach a widget to a host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * @param host - The DOM node to use as the widget's host.\n *\n * @param ref - The child of `host` to use as the reference element.\n * If this is provided, the widget will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * widget to be added as the last child of the host.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget, if\n * the widget is already attached, or if the host is not attached\n * to the DOM.\n */\n export function attach(\n widget: Widget,\n host: HTMLElement,\n ref: HTMLElement | null = null\n ): void {\n if (widget.parent) {\n throw new Error('Cannot attach a child widget.');\n }\n if (widget.isAttached || widget.node.isConnected) {\n throw new Error('Widget is already attached.');\n }\n if (!host.isConnected) {\n throw new Error('Host is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n host.insertBefore(widget.node, ref);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n /**\n * Detach the widget from its host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget,\n * or if the widget is not attached to the DOM.\n */\n export function detach(widget: Widget): void {\n if (widget.parent) {\n throw new Error('Cannot detach a child widget.');\n }\n if (!widget.isAttached || !widget.node.isConnected) {\n throw new Error('Widget is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n widget.node.parentNode!.removeChild(widget.node);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An attached property for the widget title object.\n */\n export const titleProperty = new AttachedProperty>({\n name: 'title',\n create: owner => new Title({ owner })\n });\n\n /**\n * Create a DOM node for the given widget options.\n */\n export function createNode(options: Widget.IOptions): HTMLElement {\n return options.node || document.createElement(options.tag || 'div');\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable, IDisposable {\n /**\n * Construct a new layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: Layout.IOptions = {}) {\n this._fitPolicy = options.fitPolicy || 'set-min-size';\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This should be reimplemented to clear and dispose of the widgets.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n this._parent = null;\n this._disposed = true;\n Signal.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * Test whether the layout is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Get the parent widget of the layout.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent widget of the layout.\n *\n * #### Notes\n * This is set automatically when installing the layout on the parent\n * widget. The parent widget should not be set directly by user code.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (this._parent) {\n throw new Error('Cannot change parent widget.');\n }\n if (value!.layout !== this) {\n throw new Error('Invalid parent widget.');\n }\n this._parent = value;\n this.init();\n }\n\n /**\n * Get the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n get fitPolicy(): Layout.FitPolicy {\n return this._fitPolicy;\n }\n\n /**\n * Set the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n *\n * Changing the fit policy will clear the current size constraint\n * for the parent widget and then re-fit the parent.\n */\n set fitPolicy(value: Layout.FitPolicy) {\n // Bail if the policy does not change\n if (this._fitPolicy === value) {\n return;\n }\n\n // Update the internal policy.\n this._fitPolicy = value;\n\n // Clear the size constraints and schedule a fit of the parent.\n if (this._parent) {\n let style = this._parent.node.style;\n style.minWidth = '';\n style.minHeight = '';\n style.maxWidth = '';\n style.maxHeight = '';\n this._parent.fit();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This abstract method must be implemented by a subclass.\n */\n abstract [Symbol.iterator](): IterableIterator;\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method should *not* modify the widget's `parent`.\n */\n abstract removeWidget(widget: Widget): void;\n\n /**\n * Process a message sent to the parent widget.\n *\n * @param msg - The message sent to the parent widget.\n *\n * #### Notes\n * This method is called by the parent widget to process a message.\n *\n * Subclasses may reimplement this method as needed.\n */\n processParentMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.onAfterDetach(msg);\n break;\n case 'child-removed':\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n case 'child-shown':\n this.onChildShown(msg as Widget.ChildMessage);\n break;\n case 'child-hidden':\n this.onChildHidden(msg as Widget.ChildMessage);\n break;\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n *\n * #### Notes\n * This method is invoked immediately after the layout is installed\n * on the parent widget.\n *\n * The default implementation reparents all of the widgets to the\n * layout parent widget.\n *\n * Subclasses should reimplement this method and attach the child\n * widget nodes to the parent widget's node.\n */\n protected init(): void {\n for (const widget of this) {\n widget.parent = this.parent;\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the specified layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the available layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onUpdateRequest(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * This will remove the child widget from the layout.\n *\n * Subclasses should **not** typically reimplement this method.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n this.removeWidget(msg.child);\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n private _disposed = false;\n private _fitPolicy: Layout.FitPolicy;\n private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n /**\n * A type alias for the layout fit policy.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n export type FitPolicy =\n | /**\n * No size constraint will be applied to the parent widget.\n */\n 'set-no-constraint'\n\n /**\n * The computed min size will be applied to the parent widget.\n */\n | 'set-min-size';\n\n /**\n * An options object for initializing a layout.\n */\n export interface IOptions {\n /**\n * The fit policy for the layout.\n *\n * The default is `'set-min-size'`.\n */\n fitPolicy?: FitPolicy;\n }\n\n /**\n * A type alias for the horizontal alignment of a widget.\n */\n export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n /**\n * A type alias for the vertical alignment of a widget.\n */\n export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n /**\n * Get the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The horizontal alignment for the widget.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n */\n export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n return Private.horizontalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the horizontal alignment.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setHorizontalAlignment(\n widget: Widget,\n value: HorizontalAlignment\n ): void {\n Private.horizontalAlignmentProperty.set(widget, value);\n }\n\n /**\n * Get the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The vertical alignment for the widget.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n */\n export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n return Private.verticalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the vertical alignment.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setVerticalAlignment(\n widget: Widget,\n value: VerticalAlignment\n ): void {\n Private.verticalAlignmentProperty.set(widget, value);\n }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n /**\n * Construct a new layout item.\n *\n * @param widget - The widget to be managed by the item.\n *\n * #### Notes\n * The widget will be set to absolute positioning.\n * The widget will use strict CSS containment.\n */\n constructor(widget: Widget) {\n this.widget = widget;\n this.widget.node.style.position = 'absolute';\n this.widget.node.style.contain = 'strict';\n }\n\n /**\n * Dispose of the the layout item.\n *\n * #### Notes\n * This will reset the positioning of the widget.\n */\n dispose(): void {\n // Do nothing if the item is already disposed.\n if (this._disposed) {\n return;\n }\n\n // Mark the item as disposed.\n this._disposed = true;\n\n // Reset the widget style.\n let style = this.widget.node.style;\n style.position = '';\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n style.contain = '';\n }\n\n /**\n * The widget managed by the layout item.\n */\n readonly widget: Widget;\n\n /**\n * The computed minimum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minWidth(): number {\n return this._minWidth;\n }\n\n /**\n * The computed minimum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minHeight(): number {\n return this._minHeight;\n }\n\n /**\n * The computed maximum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxWidth(): number {\n return this._maxWidth;\n }\n\n /**\n * The computed maximum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxHeight(): number {\n return this._maxHeight;\n }\n\n /**\n * Whether the layout item is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Whether the managed widget is hidden.\n */\n get isHidden(): boolean {\n return this.widget.isHidden;\n }\n\n /**\n * Whether the managed widget is visible.\n */\n get isVisible(): boolean {\n return this.widget.isVisible;\n }\n\n /**\n * Whether the managed widget is attached.\n */\n get isAttached(): boolean {\n return this.widget.isAttached;\n }\n\n /**\n * Update the computed size limits of the managed widget.\n */\n fit(): void {\n let limits = ElementExt.sizeLimits(this.widget.node);\n this._minWidth = limits.minWidth;\n this._minHeight = limits.minHeight;\n this._maxWidth = limits.maxWidth;\n this._maxHeight = limits.maxHeight;\n }\n\n /**\n * Update the position and size of the managed widget.\n *\n * @param left - The left edge position of the layout box.\n *\n * @param top - The top edge position of the layout box.\n *\n * @param width - The width of the layout box.\n *\n * @param height - The height of the layout box.\n */\n update(left: number, top: number, width: number, height: number): void {\n // Clamp the size to the computed size limits.\n let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n // Adjust the left edge for the horizontal alignment, if needed.\n if (clampW < width) {\n switch (Layout.getHorizontalAlignment(this.widget)) {\n case 'left':\n break;\n case 'center':\n left += (width - clampW) / 2;\n break;\n case 'right':\n left += width - clampW;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Adjust the top edge for the vertical alignment, if needed.\n if (clampH < height) {\n switch (Layout.getVerticalAlignment(this.widget)) {\n case 'top':\n break;\n case 'center':\n top += (height - clampH) / 2;\n break;\n case 'bottom':\n top += height - clampH;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Set up the resize variables.\n let resized = false;\n let style = this.widget.node.style;\n\n // Update the top edge of the widget if needed.\n if (this._top !== top) {\n this._top = top;\n style.top = `${top}px`;\n }\n\n // Update the left edge of the widget if needed.\n if (this._left !== left) {\n this._left = left;\n style.left = `${left}px`;\n }\n\n // Update the width of the widget if needed.\n if (this._width !== clampW) {\n resized = true;\n this._width = clampW;\n style.width = `${clampW}px`;\n }\n\n // Update the height of the widget if needed.\n if (this._height !== clampH) {\n resized = true;\n this._height = clampH;\n style.height = `${clampH}px`;\n }\n\n // Send a resize message to the widget if needed.\n if (resized) {\n let msg = new Widget.ResizeMessage(clampW, clampH);\n MessageLoop.sendMessage(this.widget, msg);\n }\n }\n\n private _top = NaN;\n private _left = NaN;\n private _width = NaN;\n private _height = NaN;\n private _minWidth = 0;\n private _minHeight = 0;\n private _maxWidth = Infinity;\n private _maxHeight = Infinity;\n private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The attached property for a widget horizontal alignment.\n */\n export const horizontalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.HorizontalAlignment\n >({\n name: 'horizontalAlignment',\n create: () => 'center',\n changed: onAlignmentChanged\n });\n\n /**\n * The attached property for a widget vertical alignment.\n */\n export const verticalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.VerticalAlignment\n >({\n name: 'verticalAlignment',\n create: () => 'top',\n changed: onAlignmentChanged\n });\n\n /**\n * The change handler for the attached alignment properties.\n */\n function onAlignmentChanged(child: Widget): void {\n if (child.parent && child.parent.layout) {\n child.parent.update();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n while (this._widgets.length > 0) {\n this._widgets.pop()!.dispose();\n }\n super.dispose();\n }\n\n /**\n * A read-only array of the widgets in the layout.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n yield* this._widgets;\n }\n\n /**\n * Add a widget to the end of the layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, it will be moved.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this._widgets.length, widget);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n widget.parent = this.parent;\n\n // Look up the current index of the widget.\n let i = this._widgets.indexOf(widget);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._widgets.length));\n\n // If the widget is not in the array, insert it.\n if (i === -1) {\n // Insert the widget into the array.\n ArrayExt.insert(this._widgets, j, widget);\n\n // If the layout is parented, attach the widget to the DOM.\n if (this.parent) {\n this.attachWidget(j, widget);\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the widget exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._widgets.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the widget to the new location.\n ArrayExt.move(this._widgets, i, j);\n\n // If the layout is parented, move the widget in the DOM.\n if (this.parent) {\n this.moveWidget(i, j, widget);\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n this.removeWidgetAt(this._widgets.indexOf(widget));\n }\n\n /**\n * Remove the widget at a given index from the layout.\n *\n * @param index - The index of the widget to remove.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n removeWidgetAt(index: number): void {\n // Remove the widget from the array.\n let widget = ArrayExt.removeAt(this._widgets, index);\n\n // If the layout is parented, detach the widget from the DOM.\n if (widget && this.parent) {\n this.detachWidget(index, widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n let index = 0;\n for (const widget of this) {\n this.attachWidget(index++, widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[index];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation moves the widget's node to the proper\n * location in the parent's node and sends the appropriate attach and\n * detach messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is moved in the parent's node.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` and message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[toIndex];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widgets: Widget[] = [];\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n /**\n * Clamp a dimension value to an integer >= 0.\n */\n export function clampDimension(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n /**\n * Construct a new split layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: SplitLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.orientation !== undefined) {\n this._orientation = options.orientation;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n this._handles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the split layout.\n */\n readonly renderer: SplitLayout.IRenderer;\n\n /**\n * Get the layout orientation for the split layout.\n */\n get orientation(): SplitLayout.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the layout orientation for the split layout.\n */\n set orientation(value: SplitLayout.Orientation) {\n if (this._orientation === value) {\n return;\n }\n this._orientation = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['orientation'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n get alignment(): SplitLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n set alignment(value: SplitLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the split layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the split layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the split handles in the layout.\n */\n get handles(): ReadonlyArray {\n return this._handles;\n }\n\n /**\n * Get the absolute sizes of the widgets in the layout.\n *\n * @returns A new array of the absolute sizes of the widgets.\n *\n * This method **does not** measure the DOM nodes.\n */\n absoluteSizes(): number[] {\n return this._sizers.map(sizer => sizer.size);\n }\n\n /**\n * Get the relative sizes of the widgets in the layout.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return Private.normalize(this._sizers.map(sizer => sizer.size));\n }\n\n /**\n * Set the relative sizes for the widgets in the layout.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n // Copy the sizes and pad with zeros as needed.\n let n = this._sizers.length;\n let temp = sizes.slice(0, n);\n while (temp.length < n) {\n temp.push(0);\n }\n\n // Normalize the padded sizes.\n let normed = Private.normalize(temp);\n\n // Apply the normalized sizes to the sizers.\n for (let i = 0; i < n; ++i) {\n let sizer = this._sizers[i];\n sizer.sizeHint = normed[i];\n sizer.size = normed[i];\n }\n\n // Set the flag indicating the sizes are normalized.\n this._hasNormedSizes = true;\n\n // Trigger an update of the parent widget.\n if (update && this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Move the offset position of a split handle.\n *\n * @param index - The index of the handle of the interest.\n *\n * @param position - The desired offset position of the handle.\n *\n * #### Notes\n * The position is relative to the offset parent.\n *\n * This will move the handle as close as possible to the desired\n * position. The sibling widgets will be adjusted as necessary.\n */\n moveHandle(index: number, position: number): void {\n // Bail if the index is invalid or the handle is hidden.\n let handle = this._handles[index];\n if (!handle || handle.classList.contains('lm-mod-hidden')) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (this._orientation === 'horizontal') {\n delta = position - handle.offsetLeft;\n } else {\n delta = position - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent widget resizing unless needed.\n for (let sizer of this._sizers) {\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(this._sizers, index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['orientation'] = this.orientation;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create the item, handle, and sizer for the new widget.\n let item = new LayoutItem(widget);\n let handle = Private.createHandle(this.renderer);\n let average = Private.averageSize(this._sizers);\n let sizer = Private.createSizer(average);\n\n // Insert the item, handle, and sizer into the internal arrays.\n ArrayExt.insert(this._items, index, item);\n ArrayExt.insert(this._sizers, index, sizer);\n ArrayExt.insert(this._handles, index, handle);\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget and handle nodes to the parent.\n this.parent!.node.appendChild(widget.node);\n this.parent!.node.appendChild(handle);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the item, sizer, and handle for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n ArrayExt.move(this._handles, fromIndex, toIndex);\n\n // Post a fit request to the parent to show/hide last handle.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the item, handle, and sizer for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n let handle = ArrayExt.removeAt(this._handles, index);\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget and handle nodes from the parent.\n this.parent!.node.removeChild(widget.node);\n this.parent!.node.removeChild(handle!);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const item = this._items[i];\n if (item.isHidden) {\n return;\n }\n\n // Fetch the style for the handle.\n let handleStyle = this._handles[i].style;\n\n // Update the widget and handle, and advance the relevant edge.\n if (isHorizontal) {\n left += this.widgetOffset;\n item.update(left, top, size, height);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${this._spacing}px`;\n handleStyle.height = `${height}px`;\n } else {\n top += this.widgetOffset;\n item.update(left, top, width, size);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${this._spacing}px`;\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Update the handles and track the visible widget count.\n let nVisible = 0;\n let lastHandleIndex = -1;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n if (this._items[i].isHidden) {\n this._handles[i].classList.add('lm-mod-hidden');\n } else {\n this._handles[i].classList.remove('lm-mod-hidden');\n lastHandleIndex = i;\n nVisible++;\n }\n }\n\n // Hide the handle for the last visible widget.\n if (lastHandleIndex !== -1) {\n this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n }\n\n // Update the fixed space for the visible items.\n this._fixed =\n this._spacing * Math.max(0, nVisible - 1) +\n this.widgetOffset * this._items.length;\n\n // Setup the computed minimum size.\n let horz = this._orientation === 'horizontal';\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed size limits.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // Prevent resizing unless necessary.\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the stretch factor.\n sizer.stretch = SplitLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0 && this.widgetOffset === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Set up the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n let horz = this._orientation === 'horizontal';\n\n if (nVisible > 0) {\n // Compute the adjusted layout space.\n let space: number;\n if (horz) {\n // left += this.widgetOffset;\n space = Math.max(0, width - this._fixed);\n } else {\n // top += this.widgetOffset;\n space = Math.max(0, height - this._fixed);\n }\n\n // Scale the size hints if they are normalized.\n if (this._hasNormedSizes) {\n for (let sizer of this._sizers) {\n sizer.sizeHint *= space;\n }\n this._hasNormedSizes = false;\n }\n\n // Distribute the layout space to the box sizers.\n let delta = BoxEngine.calc(this._sizers, space);\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n const item = this._items[i];\n\n // Fetch the computed size for the widget.\n const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n this.updateItemPosition(\n i,\n horz,\n horz ? left + offset : left,\n horz ? top : top + offset,\n height,\n width,\n size\n );\n\n const fullOffset =\n this.widgetOffset +\n (this._handles[i].classList.contains('lm-mod-hidden')\n ? 0\n : this._spacing);\n\n if (horz) {\n left += size + fullOffset;\n } else {\n top += size + fullOffset;\n }\n }\n }\n\n protected widgetOffset = 0;\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _hasNormedSizes = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _handles: HTMLDivElement[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: SplitLayout.Alignment = 'start';\n private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n /**\n * A type alias for a split layout orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a split layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a split layout.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split layout.\n */\n renderer: IRenderer;\n\n /**\n * The orientation of the layout.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a split layout.\n */\n export interface IRenderer {\n /**\n * Create a new handle for use with a split layout.\n *\n * @returns A new handle element.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * Get the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Create a new box sizer with the given size hint.\n */\n export function createSizer(size: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = Math.floor(size);\n return sizer;\n }\n\n /**\n * Create a new split handle node using the given renderer.\n */\n export function createHandle(\n renderer: SplitLayout.IRenderer\n ): HTMLDivElement {\n let handle = renderer.createHandle();\n handle.style.position = 'absolute';\n // Do not use size containment to allow the handle to fill the available space\n handle.style.contain = 'style';\n return handle;\n }\n\n /**\n * Compute the average size of an array of box sizers.\n */\n export function averageSize(sizers: BoxSizer[]): number {\n return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n }\n\n /**\n * Normalize an array of values.\n */\n export function normalize(values: number[]): number[] {\n let n = values.length;\n if (n === 0) {\n return [];\n }\n let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof SplitLayout) {\n child.parent.fit();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n /**\n * Construct a new accordion layout.\n *\n * @param options - The options for initializing the layout.\n *\n * #### Notes\n * The default orientation will be vertical.\n *\n * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n */\n constructor(options: AccordionLayout.IOptions) {\n super({ ...options, orientation: options.orientation || 'vertical' });\n this.titleSpace = options.titleSpace || 22;\n }\n\n /**\n * The section title height or width depending on the orientation.\n */\n get titleSpace(): number {\n return this.widgetOffset;\n }\n set titleSpace(value: number) {\n value = Utils.clampDimension(value);\n if (this.widgetOffset === value) {\n return;\n }\n this.widgetOffset = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return this._titles;\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n\n // Clear the layout state.\n this._titles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the accordion layout.\n */\n readonly renderer: AccordionLayout.IRenderer;\n\n public updateTitle(index: number, widget: Widget): void {\n const oldTitle = this._titles[index];\n const expanded = oldTitle.classList.contains('lm-mod-expanded');\n const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n this._titles[index] = newTitle;\n\n // Add the title node to the parent before the widget.\n this.parent!.node.replaceChild(newTitle, oldTitle);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n if (!widget.id) {\n widget.id = `id-${UUID.uuid4()}`;\n }\n super.insertWidget(index, widget);\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(index: number, widget: Widget): void {\n const title = Private.createTitle(this.renderer, widget.title);\n\n ArrayExt.insert(this._titles, index, title);\n\n // Add the title node to the parent before the widget.\n this.parent!.node.appendChild(title);\n\n widget.node.setAttribute('role', 'region');\n widget.node.setAttribute('aria-labelledby', title.id);\n\n super.attachWidget(index, widget);\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n ArrayExt.move(this._titles, fromIndex, toIndex);\n super.moveWidget(fromIndex, toIndex, widget);\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n const title = ArrayExt.removeAt(this._titles, index);\n\n this.parent!.node.removeChild(title!);\n\n super.detachWidget(index, widget);\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const titleStyle = this._titles[i].style;\n\n // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n titleStyle.top = `${top}px`;\n titleStyle.left = `${left}px`;\n titleStyle.height = `${this.widgetOffset}px`;\n if (isHorizontal) {\n titleStyle.width = `${height}px`;\n } else {\n titleStyle.width = `${width}px`;\n }\n\n super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n }\n\n private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n /**\n * A type alias for a accordion layout orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion layout alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * An options object for initializing a accordion layout.\n */\n export interface IOptions extends SplitLayout.IOptions {\n /**\n * The renderer to use for the accordion layout.\n */\n renderer: IRenderer;\n\n /**\n * The section title height or width depending on the orientation.\n *\n * The default is `22`.\n */\n titleSpace?: number;\n }\n\n /**\n * A renderer for use with an accordion layout.\n */\n export interface IRenderer extends SplitLayout.IRenderer {\n /**\n * Common class name for all accordion titles.\n */\n readonly titleClassName: string;\n\n /**\n * Render the element for a section title.\n *\n * @param title - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(title: Title): HTMLElement;\n }\n}\n\nnamespace Private {\n /**\n * Create the title HTML element.\n *\n * @param renderer Accordion renderer\n * @param data Widget title\n * @returns Title HTML element\n */\n export function createTitle(\n renderer: AccordionLayout.IRenderer,\n data: Title,\n expanded: boolean = true\n ): HTMLElement {\n const title = renderer.createSectionTitle(data);\n title.style.position = 'absolute';\n title.style.contain = 'strict';\n title.setAttribute('aria-label', `${data.label} Section`);\n title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n title.setAttribute('aria-controls', data.owner.id);\n if (expanded) {\n title.classList.add('lm-mod-expanded');\n }\n return title;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n /**\n * Construct a new panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: Panel.IOptions = {}) {\n super();\n this.addClass('lm-Panel');\n this.layout = Private.createLayout(options);\n }\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return (this.layout as PanelLayout).widgets;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n (this.layout as PanelLayout).addWidget(widget);\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n (this.layout as PanelLayout).insertWidget(index, widget);\n }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n /**\n * An options object for creating a panel.\n */\n export interface IOptions {\n /**\n * The panel layout to use for the panel.\n *\n * The default is a new `PanelLayout`.\n */\n layout?: PanelLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a panel layout for the given panel options.\n */\n export function createLayout(options: Panel.IOptions): PanelLayout {\n return options.layout || new PanelLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n /**\n * Construct a new split panel.\n *\n * @param options - The options for initializing the split panel.\n */\n constructor(options: SplitPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-SplitPanel');\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n this._releaseMouse();\n super.dispose();\n }\n\n /**\n * Get the layout orientation for the split panel.\n */\n get orientation(): SplitPanel.Orientation {\n return (this.layout as SplitLayout).orientation;\n }\n\n /**\n * Set the layout orientation for the split panel.\n */\n set orientation(value: SplitPanel.Orientation) {\n (this.layout as SplitLayout).orientation = value;\n }\n\n /**\n * Get the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n get alignment(): SplitPanel.Alignment {\n return (this.layout as SplitLayout).alignment;\n }\n\n /**\n * Set the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n set alignment(value: SplitPanel.Alignment) {\n (this.layout as SplitLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the split panel.\n */\n get spacing(): number {\n return (this.layout as SplitLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the split panel.\n */\n set spacing(value: number) {\n (this.layout as SplitLayout).spacing = value;\n }\n\n /**\n * The renderer used by the split panel.\n */\n get renderer(): SplitPanel.IRenderer {\n return (this.layout as SplitLayout).renderer;\n }\n\n /**\n * A signal emitted when a split handle has moved.\n */\n get handleMoved(): ISignal {\n return this._handleMoved;\n }\n\n /**\n * A read-only array of the split handles in the panel.\n */\n get handles(): ReadonlyArray {\n return (this.layout as SplitLayout).handles;\n }\n\n /**\n * Get the relative sizes of the widgets in the panel.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return (this.layout as SplitLayout).relativeSizes();\n }\n\n /**\n * Set the relative sizes for the widgets in the panel.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n }\n\n /**\n * Handle the DOM events for the split panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * Handle the `'keydown'` event for the split panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n if (this._pressData) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the split panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the primary button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the target, if any.\n let layout = this.layout as SplitLayout;\n let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n return handle.contains(event.target as HTMLElement);\n });\n\n // Bail early if the mouse press was not on a handle.\n if (index === -1) {\n return;\n }\n\n // Stop the event when a split handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n document.addEventListener('pointerup', this, true);\n document.addEventListener('pointermove', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Compute the offset delta for the handle press.\n let delta: number;\n let handle = layout.handles[index];\n let rect = handle.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n delta = event.clientX - rect.left;\n } else {\n delta = event.clientY - rect.top;\n }\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!);\n this._pressData = { index, delta, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the split panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Stop the event when dragging a split handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let pos: number;\n let layout = this.layout as SplitLayout;\n let rect = this.node.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n pos = event.clientX - rect.left - this._pressData!.delta;\n } else {\n pos = event.clientY - rect.top - this._pressData!.delta;\n }\n\n // Move the handle as close to the desired position as possible.\n layout.moveHandle(this._pressData!.index, pos);\n }\n\n /**\n * Handle the `'pointerup'` event for the split panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the primary button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse grab for the split panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Emit the handle moved signal.\n this._handleMoved.emit();\n\n // Remove the extra document listeners.\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('pointerup', this, true);\n document.removeEventListener('pointermove', this, true);\n document.removeEventListener('contextmenu', this, true);\n }\n\n private _handleMoved = new Signal(this);\n private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n /**\n * A type alias for a split panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a split panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a split panel renderer.\n */\n export type IRenderer = SplitLayout.IRenderer;\n\n /**\n * An options object for initializing a split panel.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The layout orientation of the panel.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The split layout to use for the split panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `SplitLayout`.\n */\n layout?: SplitLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new handle for use with a split panel.\n *\n * @returns A new handle element for a split panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-SplitPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * Get the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return SplitLayout.getStretch(widget);\n }\n\n /**\n * Set the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n SplitLayout.setStretch(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The index of the pressed handle.\n */\n index: number;\n\n /**\n * The offset of the press in handle coordinates.\n */\n delta: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * Create a split layout for the given panel options.\n */\n export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n return (\n options.layout ||\n new SplitLayout({\n renderer: options.renderer || SplitPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n */\nexport class AccordionPanel extends SplitPanel {\n /**\n * Construct a new accordion panel.\n *\n * @param options - The options for initializing the accordion panel.\n */\n constructor(options: AccordionPanel.IOptions = {}) {\n super({ ...options, layout: Private.createLayout(options) });\n this.addClass('lm-AccordionPanel');\n }\n\n /**\n * The renderer used by the accordion panel.\n */\n get renderer(): AccordionPanel.IRenderer {\n return (this.layout as AccordionLayout).renderer;\n }\n\n /**\n * The section title space.\n *\n * This is the height if the panel is vertical and the width if it is\n * horizontal.\n */\n get titleSpace(): number {\n return (this.layout as AccordionLayout).titleSpace;\n }\n set titleSpace(value: number) {\n (this.layout as AccordionLayout).titleSpace = value;\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return (this.layout as AccordionLayout).titles;\n }\n\n /**\n * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n */\n get expansionToggled(): ISignal {\n return this._expansionToggled;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n super.addWidget(widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Collapse the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n collapse(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && !widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Expand the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n expand(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n super.insertWidget(index, widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Handle the DOM events for the accordion panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n super.handleEvent(event);\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._eventKeyDown(event as KeyboardEvent);\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n super.onBeforeAttach(msg);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n super.onAfterDetach(msg);\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n return widget.contains(sender.owner);\n });\n\n if (index >= 0) {\n (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n this.update();\n }\n }\n\n /**\n * Compute the size of widgets in this panel on the title click event.\n * On closing, the size of the widget is cached and we will try to expand\n * the last opened widget.\n * On opening, we will use the cached size if it is available to restore the\n * widget.\n * In both cases, if we can not compute the size of widgets, we will let\n * `SplitLayout` decide.\n *\n * @param index - The index of widget to be opened of closed\n *\n * @returns Relative size of widgets in this panel, if this size can\n * not be computed, return `undefined`\n */\n private _computeWidgetSize(index: number): number[] | undefined {\n const layout = this.layout as AccordionLayout;\n\n const widget = layout.widgets[index];\n if (!widget) {\n return undefined;\n }\n const isHidden = widget.isHidden;\n const widgetSizes = layout.absoluteSizes();\n const delta = (isHidden ? -1 : 1) * this.spacing;\n const totalSize = widgetSizes.reduce(\n (prev: number, curr: number) => prev + curr\n );\n\n let newSize = [...widgetSizes];\n\n if (!isHidden) {\n // Hide the widget\n const currentSize = widgetSizes[index];\n\n this._widgetSizesCache.set(widget, currentSize);\n newSize[index] = 0;\n\n const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // All widget are closed, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n\n newSize[widgetToCollapse] =\n widgetSizes[widgetToCollapse] + currentSize + delta;\n } else {\n // Show the widget\n const previousSize = this._widgetSizesCache.get(widget);\n if (!previousSize) {\n // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n newSize[index] += previousSize;\n\n const widgetToCollapse = newSize\n .map(sz => sz - previousSize > 0)\n .lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // Can not reduce the size of one widget, reduce all opened widgets\n // proportionally with its size.\n newSize.forEach((_, idx) => {\n if (idx !== index) {\n newSize[idx] -=\n (widgetSizes[idx] / totalSize) * (previousSize - delta);\n }\n });\n } else {\n newSize[widgetToCollapse] -= previousSize - delta;\n }\n }\n return newSize.map(sz => sz / (totalSize + delta));\n }\n /**\n * Handle the `'click'` event for the accordion panel\n */\n private _evtClick(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this._toggleExpansion(index);\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the accordion panel.\n */\n private _eventKeyDown(event: KeyboardEvent): void {\n if (event.defaultPrevented) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n let handled = false;\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n const keyCode = event.keyCode.toString();\n\n // If Space or Enter is pressed on title, emulate click event\n if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n target.click();\n handled = true;\n } else if (\n this.orientation === 'horizontal'\n ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n ) {\n // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n const direction =\n event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n ? -1\n : 1;\n const length = this.titles.length;\n const newIndex = (index + length + direction) % length;\n\n this.titles[newIndex].focus();\n handled = true;\n } else if (event.key === 'End' || keyCode === '35') {\n // If End is pressed on title, focus on the last title\n this.titles[this.titles.length - 1].focus();\n handled = true;\n } else if (event.key === 'Home' || keyCode === '36') {\n // If Home is pressed on title, focus on the first title\n this.titles[0].focus();\n handled = true;\n }\n }\n\n if (handled) {\n event.preventDefault();\n }\n }\n }\n\n private _toggleExpansion(index: number) {\n const title = this.titles[index];\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n const newSize = this._computeWidgetSize(index);\n if (newSize) {\n this.setRelativeSizes(newSize, false);\n }\n\n if (widget.isHidden) {\n title.classList.add('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'true');\n widget.show();\n } else {\n title.classList.remove('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'false');\n widget.hide();\n }\n\n // Emit the expansion state signal.\n this._expansionToggled.emit(index);\n }\n\n private _widgetSizesCache: WeakMap = new WeakMap();\n private _expansionToggled = new Signal(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n /**\n * A type alias for a accordion panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a accordion panel renderer.\n */\n export type IRenderer = AccordionLayout.IRenderer;\n\n /**\n * An options object for initializing a accordion panel.\n */\n export interface IOptions extends Partial {\n /**\n * The accordion layout to use for the accordion panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `AccordionLayout`.\n */\n layout?: AccordionLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer extends SplitPanel.Renderer implements IRenderer {\n constructor() {\n super();\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches any title node in the accordion.\n */\n readonly titleClassName = 'lm-AccordionPanel-title';\n\n /**\n * Render the collapse indicator for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the collapse indicator.\n */\n createCollapseIcon(data: Title): HTMLElement {\n return document.createElement('span');\n }\n\n /**\n * Render the element for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(data: Title): HTMLElement {\n const handle = document.createElement('h3');\n handle.setAttribute('tabindex', '0');\n handle.id = this.createTitleKey(data);\n handle.className = this.titleClassName;\n for (const aData in data.dataset) {\n handle.dataset[aData] = data.dataset[aData];\n }\n\n const collapser = handle.appendChild(this.createCollapseIcon(data));\n collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n const label = handle.appendChild(document.createElement('span'));\n label.className = 'lm-AccordionPanel-titleLabel';\n label.textContent = data.label;\n label.title = data.caption || data.label;\n\n return handle;\n }\n\n /**\n * Create a unique render key for the title.\n *\n * @param data - The data to use for the title.\n *\n * @returns The unique render key for the title.\n *\n * #### Notes\n * This method caches the key against the section title the first time\n * the key is generated.\n */\n createTitleKey(data: Title): string {\n let key = this._titleKeys.get(data);\n if (key === undefined) {\n key = `title-key-${this._uuid}-${this._titleID++}`;\n this._titleKeys.set(data, key);\n }\n return key;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _titleID = 0;\n private _titleKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n /**\n * Create an accordion layout for the given panel options.\n *\n * @param options Panel options\n * @returns Panel layout\n */\n export function createLayout(\n options: AccordionPanel.IOptions\n ): AccordionLayout {\n return (\n options.layout ||\n new AccordionLayout({\n renderer: options.renderer || AccordionPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing,\n titleSpace: options.titleSpace\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n /**\n * Construct a new box layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: BoxLayout.IOptions = {}) {\n super();\n if (options.direction !== undefined) {\n this._direction = options.direction;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the layout direction for the box layout.\n */\n get direction(): BoxLayout.Direction {\n return this._direction;\n }\n\n /**\n * Set the layout direction for the box layout.\n */\n set direction(value: BoxLayout.Direction) {\n if (this._direction === value) {\n return;\n }\n this._direction = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['direction'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the box layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the box layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['direction'] = this.direction;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Create and add a new sizer for the widget.\n ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Move the sizer for the widget.\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Remove the sizer for the widget.\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Update the fixed space for the visible items.\n this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n // Setup the computed minimum size.\n let horz = Private.isHorizontal(this._direction);\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the size basis and stretch factor.\n sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n sizer.stretch = BoxLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Distribute the layout space and adjust the start position.\n let delta: number;\n switch (this._direction) {\n case 'left-to-right':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n break;\n case 'top-to-bottom':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n break;\n case 'right-to-left':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n left += width;\n break;\n case 'bottom-to-top':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n top += height;\n break;\n default:\n throw 'unreachable';\n }\n\n // Setup the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the computed size for the widget.\n let size = this._sizers[i].size;\n\n // Update the widget geometry and advance the relevant edge.\n switch (this._direction) {\n case 'left-to-right':\n item.update(left + offset, top, size + extra, height);\n left += size + extra + this._spacing;\n break;\n case 'top-to-bottom':\n item.update(left, top + offset, width, size + extra);\n top += size + extra + this._spacing;\n break;\n case 'right-to-left':\n item.update(left - offset - size - extra, top, size + extra, height);\n left -= size + extra + this._spacing;\n break;\n case 'bottom-to-top':\n item.update(left, top - offset - size - extra, width, size + extra);\n top -= size + extra + this._spacing;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: BoxLayout.Alignment = 'start';\n private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n /**\n * A type alias for a box layout direction.\n */\n export type Direction =\n | 'left-to-right'\n | 'right-to-left'\n | 'top-to-bottom'\n | 'bottom-to-top';\n\n /**\n * A type alias for a box layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a box layout.\n */\n export interface IOptions {\n /**\n * The direction of the layout.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * Get the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n\n /**\n * Get the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return Private.sizeBasisProperty.get(widget);\n }\n\n /**\n * Set the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n Private.sizeBasisProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * The property descriptor for a widget size basis.\n */\n export const sizeBasisProperty = new AttachedProperty({\n name: 'sizeBasis',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Test whether a direction has horizontal orientation.\n */\n export function isHorizontal(dir: BoxLayout.Direction): boolean {\n return dir === 'left-to-right' || dir === 'right-to-left';\n }\n\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n export function clampSpacing(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof BoxLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n /**\n * Construct a new box panel.\n *\n * @param options - The options for initializing the box panel.\n */\n constructor(options: BoxPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-BoxPanel');\n }\n\n /**\n * Get the layout direction for the box panel.\n */\n get direction(): BoxPanel.Direction {\n return (this.layout as BoxLayout).direction;\n }\n\n /**\n * Set the layout direction for the box panel.\n */\n set direction(value: BoxPanel.Direction) {\n (this.layout as BoxLayout).direction = value;\n }\n\n /**\n * Get the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxPanel.Alignment {\n return (this.layout as BoxLayout).alignment;\n }\n\n /**\n * Set the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxPanel.Alignment) {\n (this.layout as BoxLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the box panel.\n */\n get spacing(): number {\n return (this.layout as BoxLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the box panel.\n */\n set spacing(value: number) {\n (this.layout as BoxLayout).spacing = value;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-BoxPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-BoxPanel-child');\n }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n /**\n * A type alias for a box panel direction.\n */\n export type Direction = BoxLayout.Direction;\n\n /**\n * A type alias for a box panel alignment.\n */\n export type Alignment = BoxLayout.Alignment;\n\n /**\n * An options object for initializing a box panel.\n */\n export interface IOptions {\n /**\n * The layout direction of the panel.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The box layout to use for the box panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `BoxLayout`.\n */\n layout?: BoxLayout;\n }\n\n /**\n * Get the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return BoxLayout.getStretch(widget);\n }\n\n /**\n * Set the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n BoxLayout.setStretch(widget, value);\n }\n\n /**\n * Get the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return BoxLayout.getSizeBasis(widget);\n }\n\n /**\n * Set the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n BoxLayout.setSizeBasis(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a box layout for the given panel options.\n */\n export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n return options.layout || new BoxLayout(options);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n /**\n * Construct a new command palette.\n *\n * @param options - The options for initializing the palette.\n */\n constructor(options: CommandPalette.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-CommandPalette');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || CommandPalette.defaultRenderer;\n this.commands.commandChanged.connect(this._onGenericChange, this);\n this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._items.length = 0;\n this._results = null;\n super.dispose();\n }\n\n /**\n * The command registry used by the command palette.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the command palette.\n */\n readonly renderer: CommandPalette.IRenderer;\n\n /**\n * The command palette search node.\n *\n * #### Notes\n * This is the node which contains the search-related elements.\n */\n get searchNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-search'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The command palette input node.\n *\n * #### Notes\n * This is the actual input node for the search area.\n */\n get inputNode(): HTMLInputElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-input'\n )[0] as HTMLInputElement;\n }\n\n /**\n * The command palette content node.\n *\n * #### Notes\n * This is the node which holds the command item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * A read-only array of the command items in the palette.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Add a command item to the command palette.\n *\n * @param options - The options for creating the command item.\n *\n * @returns The command item added to the palette.\n */\n addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n // Create a new command item for the options.\n let item = Private.createItem(this.commands, options);\n\n // Add the item to the array.\n this._items.push(item);\n\n // Refresh the search results.\n this.refresh();\n\n // Return the item added to the palette.\n return item;\n }\n\n /**\n * Adds command items to the command palette.\n *\n * @param items - An array of options for creating each command item.\n *\n * @returns The command items added to the palette.\n */\n addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n const newItems = items.map(item => Private.createItem(this.commands, item));\n newItems.forEach(item => this._items.push(item));\n this.refresh();\n return newItems;\n }\n\n /**\n * Remove an item from the command palette.\n *\n * @param item - The item to remove from the palette.\n *\n * #### Notes\n * This is a no-op if the item is not in the palette.\n */\n removeItem(item: CommandPalette.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the command palette.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Remove all items from the command palette.\n */\n clearItems(): void {\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the array of items.\n this._items.length = 0;\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Clear the search results and schedule an update.\n *\n * #### Notes\n * This should be called whenever the search results of the palette\n * should be updated.\n *\n * This is typically called automatically by the palette as needed,\n * but can be called manually if the input text is programatically\n * changed.\n *\n * The rendered results are updated asynchronously.\n */\n refresh(): void {\n this._results = null;\n if (this.inputNode.value !== '') {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'inherit';\n } else {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'none';\n }\n this.update();\n }\n\n /**\n * Handle the DOM events for the command palette.\n *\n * @param event - The DOM event sent to the command palette.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the command palette's DOM node.\n * It should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'input':\n this.refresh();\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('input', this);\n this.node.addEventListener('focus', this, true);\n this.node.addEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('input', this);\n this.node.removeEventListener('focus', this, true);\n this.node.removeEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n */\n protected onAfterShow(msg: Message): void {\n this.update();\n super.onAfterShow(msg);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n let input = this.inputNode;\n input.focus();\n input.select();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.isHidden) {\n return;\n }\n\n // Fetch the current query text and content node.\n let query = this.inputNode.value;\n let contentNode = this.contentNode;\n\n // Ensure the search results are generated.\n let results = this._results;\n if (!results) {\n // Generate and store the new search results.\n results = this._results = Private.search(this._items, query);\n\n // Reset the active index.\n this._activeIndex = query\n ? ArrayExt.findFirstIndex(results, Private.canActivate)\n : -1;\n }\n\n // If there is no query and no results, clear the content.\n if (!query && results.length === 0) {\n VirtualDOM.render(null, contentNode);\n return;\n }\n\n // If the is a query but no results, render the empty message.\n if (query && results.length === 0) {\n let content = this.renderer.renderEmptyMessage({ query });\n VirtualDOM.render(content, contentNode);\n return;\n }\n\n // Create the render content for the search results.\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let content = new Array(results.length);\n for (let i = 0, n = results.length; i < n; ++i) {\n let result = results[i];\n if (result.type === 'header') {\n let indices = result.indices;\n let category = result.category;\n content[i] = renderer.renderHeader({ category, indices });\n } else {\n let item = result.item;\n let indices = result.indices;\n let active = i === activeIndex;\n content[i] = renderer.renderItem({ item, indices, active });\n }\n }\n\n // Render the search result content.\n VirtualDOM.render(content, contentNode);\n\n // Adjust the scroll position as needed.\n if (activeIndex < 0 || activeIndex >= results.length) {\n contentNode.scrollTop = 0;\n } else {\n let element = contentNode.children[activeIndex];\n ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n }\n }\n\n /**\n * Handle the `'click'` event for the command palette.\n */\n private _evtClick(event: MouseEvent): void {\n // Bail if the click is not the left button.\n if (event.button !== 0) {\n return;\n }\n\n // Clear input if the target is clear button\n if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n this.inputNode.value = '';\n this.refresh();\n return;\n }\n\n // Find the index of the item which was clicked.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return node.contains(event.target as HTMLElement);\n });\n\n // Bail if the click was not on an item.\n if (index === -1) {\n return;\n }\n\n // Kill the event when a content item is clicked.\n event.preventDefault();\n event.stopPropagation();\n\n // Execute the item if possible.\n this._execute(index);\n }\n\n /**\n * Handle the `'keydown'` event for the command palette.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n return;\n }\n switch (event.keyCode) {\n case 13: // Enter\n event.preventDefault();\n event.stopPropagation();\n this._execute(this._activeIndex);\n break;\n case 38: // Up Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activatePreviousItem();\n break;\n case 40: // Down Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activateNextItem();\n break;\n }\n }\n\n /**\n * Activate the next enabled command item.\n */\n private _activateNextItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the next enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this._activeIndex = ArrayExt.findFirstIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Activate the previous enabled command item.\n */\n private _activatePreviousItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the previous enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this._activeIndex = ArrayExt.findLastIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Execute the command item at the given index, if possible.\n */\n private _execute(index: number): void {\n // Bail if there are no search results.\n if (!this._results) {\n return;\n }\n\n // Bail if the index is out of range.\n let part = this._results[index];\n if (!part) {\n return;\n }\n\n // Update the search text if the item is a header.\n if (part.type === 'header') {\n let input = this.inputNode;\n input.value = `${part.category.toLowerCase()} `;\n input.focus();\n this.refresh();\n return;\n }\n\n // Bail if item is not enabled.\n if (!part.item.isEnabled) {\n return;\n }\n\n // Execute the item.\n this.commands.execute(part.item.command, part.item.args);\n\n // Clear the query text.\n this.inputNode.value = '';\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Toggle the focused modifier based on the input node focus state.\n */\n private _toggleFocused(): void {\n let focused = document.activeElement === this.inputNode;\n this.toggleClass('lm-mod-focused', focused);\n }\n\n /**\n * A signal handler for generic command changes.\n */\n private _onGenericChange(): void {\n this.refresh();\n }\n\n private _activeIndex = -1;\n private _items: CommandPalette.IItem[] = [];\n private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n /**\n * An options object for creating a command palette.\n */\n export interface IOptions {\n /**\n * The command registry for use with the command palette.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the command palette.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for creating a command item.\n */\n export interface IItemOptions {\n /**\n * The category for the item.\n */\n category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n command: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n *\n * The rank is used as a tie-breaker when ordering command items\n * for display. Items are sorted in the following order:\n * 1. Text match (lower is better)\n * 2. Category (locale order)\n * 3. Rank (lower is better)\n * 4. Label (locale order)\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n\n /**\n * An object which represents an item in a command palette.\n *\n * #### Notes\n * Item objects are created automatically by a command palette.\n */\n export interface IItem {\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n readonly label: string;\n\n /**\n * The display caption for the command item.\n */\n readonly caption: string;\n\n /**\n * The icon renderer for the command item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the command item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the command item.\n */\n readonly iconLabel: string;\n\n /**\n * The extra class name for the command item.\n */\n readonly className: string;\n\n /**\n * The dataset for the command item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the command item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the command item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the command item is toggleable.\n */\n readonly isToggleable: boolean;\n\n /**\n * Whether the command item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the command item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * The render data for a command palette header.\n */\n export interface IHeaderRenderData {\n /**\n * The category of the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched characters in the category.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * The render data for a command palette item.\n */\n export interface IItemRenderData {\n /**\n * The command palette item to render.\n */\n readonly item: IItem;\n\n /**\n * The indices of the matched characters in the label.\n */\n readonly indices: ReadonlyArray | null;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n }\n\n /**\n * The render data for a command palette empty message.\n */\n export interface IEmptyMessageRenderData {\n /**\n * The query which failed to match any commands.\n */\n query: string;\n }\n\n /**\n * A renderer for use with a command palette.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement;\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n *\n * #### Notes\n * The command palette will not render invisible items.\n */\n renderItem(data: IItemRenderData): VirtualElement;\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement {\n let content = this.formatHeader(data);\n return h.li({ className: 'lm-CommandPalette-header' }, content);\n }\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IItemRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n if (data.item.isToggleable) {\n return h.li(\n {\n className,\n dataset,\n role: 'menuitemcheckbox',\n 'aria-checked': `${data.item.isToggled}`\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n return h.li(\n {\n className,\n dataset,\n role: 'menuitem'\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n let content = this.formatEmptyMessage(data);\n return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n }\n\n /**\n * Render the icon for a command palette item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the icon.\n */\n renderItemIcon(data: IItemRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the content for a command palette item.\n *\n * @param data - The data to use for rendering the content.\n *\n * @returns A virtual element representing the content.\n */\n renderItemContent(data: IItemRenderData): VirtualElement {\n return h.div(\n { className: 'lm-CommandPalette-itemContent' },\n this.renderItemLabel(data),\n this.renderItemCaption(data)\n );\n }\n\n /**\n * Render the label for a command palette item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the label.\n */\n renderItemLabel(data: IItemRenderData): VirtualElement {\n let content = this.formatItemLabel(data);\n return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n }\n\n /**\n * Render the caption for a command palette item.\n *\n * @param data - The data to use for rendering the caption.\n *\n * @returns A virtual element representing the caption.\n */\n renderItemCaption(data: IItemRenderData): VirtualElement {\n let content = this.formatItemCaption(data);\n return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n }\n\n /**\n * Render the shortcut for a command palette item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the shortcut.\n */\n renderItemShortcut(data: IItemRenderData): VirtualElement {\n let content = this.formatItemShortcut(data);\n return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n }\n\n /**\n * Create the class name for the command palette item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the command palette item.\n */\n createItemClass(data: IItemRenderData): string {\n // Set up the initial class name.\n let name = 'lm-CommandPalette-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the command palette item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the command palette item.\n */\n createItemDataset(data: IItemRenderData): ElementDataset {\n return { ...data.item.dataset, command: data.item.command };\n }\n\n /**\n * Create the class name for the command item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IItemRenderData): string {\n let name = 'lm-CommandPalette-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the header node.\n *\n * @param data - The data to use for the header content.\n *\n * @returns The content to add to the header node.\n */\n formatHeader(data: IHeaderRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.category;\n }\n return StringExt.highlight(data.category, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the empty message node.\n *\n * @param data - The data to use for the empty message content.\n *\n * @returns The content to add to the empty message node.\n */\n formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n return `No commands found that match '${data.query}'`;\n }\n\n /**\n * Create the render content for the item shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatItemShortcut(data: IItemRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n\n /**\n * Create the render content for the item label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatItemLabel(data: IItemRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.item.label;\n }\n return StringExt.highlight(data.item.label, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the item caption node.\n *\n * @param data - The data to use for the caption content.\n *\n * @returns The content to add to the caption node.\n */\n formatItemCaption(data: IItemRenderData): h.Child {\n return data.item.caption;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a command palette.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let search = document.createElement('div');\n let wrapper = document.createElement('div');\n let input = document.createElement('input');\n let content = document.createElement('ul');\n let clear = document.createElement('button');\n search.className = 'lm-CommandPalette-search';\n wrapper.className = 'lm-CommandPalette-wrapper';\n input.className = 'lm-CommandPalette-input';\n clear.className = 'lm-close-icon';\n\n content.className = 'lm-CommandPalette-content';\n content.setAttribute('role', 'menu');\n input.spellcheck = false;\n wrapper.appendChild(input);\n wrapper.appendChild(clear);\n search.appendChild(wrapper);\n node.appendChild(search);\n node.appendChild(content);\n return node;\n }\n\n /**\n * Create a new command item from a command registry and options.\n */\n export function createItem(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ): CommandPalette.IItem {\n return new CommandItem(commands, options);\n }\n\n /**\n * A search result object for a header label.\n */\n export interface IHeaderResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'header';\n\n /**\n * The category for the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched category characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A search result object for a command item.\n */\n export interface IItemResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'item';\n\n /**\n * The command item which was matched.\n */\n readonly item: CommandPalette.IItem;\n\n /**\n * The indices of the matched label characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A type alias for a search result item.\n */\n export type SearchResult = IHeaderResult | IItemResult;\n\n /**\n * Search an array of command items for fuzzy matches.\n */\n export function search(\n items: CommandPalette.IItem[],\n query: string\n ): SearchResult[] {\n // Fuzzy match the items for the query.\n let scores = matchItems(items, query);\n\n // Sort the items based on their score.\n scores.sort(scoreCmp);\n\n // Create the results for the search.\n return createResults(scores);\n }\n\n /**\n * Test whether a result item can be activated.\n */\n export function canActivate(result: SearchResult): boolean {\n return result.type === 'item' && result.item.isEnabled;\n }\n\n /**\n * Normalize a category for a command item.\n */\n function normalizeCategory(category: string): string {\n return category.trim().replace(/\\s+/g, ' ');\n }\n\n /**\n * Normalize the query text for a fuzzy search.\n */\n function normalizeQuery(text: string): string {\n return text.replace(/\\s+/g, '').toLowerCase();\n }\n\n /**\n * An enum of the supported match types.\n */\n const enum MatchType {\n Label,\n Category,\n Split,\n Default\n }\n\n /**\n * A text match score with associated command item.\n */\n interface IScore {\n /**\n * The numerical type for the text match.\n */\n matchType: MatchType;\n\n /**\n * The numerical score for the text match.\n */\n score: number;\n\n /**\n * The indices of the matched category characters.\n */\n categoryIndices: number[] | null;\n\n /**\n * The indices of the matched label characters.\n */\n labelIndices: number[] | null;\n\n /**\n * The command item associated with the match.\n */\n item: CommandPalette.IItem;\n }\n\n /**\n * Perform a fuzzy match on an array of command items.\n */\n function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n // Normalize the query text to lower case with no whitespace.\n query = normalizeQuery(query);\n\n // Create the array to hold the scores.\n let scores: IScore[] = [];\n\n // Iterate over the items and match against the query.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Ignore items which are not visible.\n let item = items[i];\n if (!item.isVisible) {\n continue;\n }\n\n // If the query is empty, all items are matched by default.\n if (!query) {\n scores.push({\n matchType: MatchType.Default,\n categoryIndices: null,\n labelIndices: null,\n score: 0,\n item\n });\n continue;\n }\n\n // Run the fuzzy search for the item and query.\n let score = fuzzySearch(item, query);\n\n // Ignore the item if it is not a match.\n if (!score) {\n continue;\n }\n\n // Penalize disabled items.\n // TODO - push disabled items all the way down in sort cmp?\n if (!item.isEnabled) {\n score.score += 1000;\n }\n\n // Add the score to the results.\n scores.push(score);\n }\n\n // Return the final array of scores.\n return scores;\n }\n\n /**\n * Perform a fuzzy search on a single command item.\n */\n function fuzzySearch(\n item: CommandPalette.IItem,\n query: string\n ): IScore | null {\n // Create the source text to be searched.\n let category = item.category.toLowerCase();\n let label = item.label.toLowerCase();\n let source = `${category} ${label}`;\n\n // Set up the match score and indices array.\n let score = Infinity;\n let indices: number[] | null = null;\n\n // The regex for search word boundaries\n let rgx = /\\b\\w/g;\n\n // Search the source by word boundary.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Find the next word boundary in the source.\n let rgxMatch = rgx.exec(source);\n\n // Break if there is no more source context.\n if (!rgxMatch) {\n break;\n }\n\n // Run the string match on the relevant substring.\n let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n // Break if there is no match.\n if (!match) {\n break;\n }\n\n // Update the match if the score is better.\n if (match.score <= score) {\n score = match.score;\n indices = match.indices;\n }\n }\n\n // Bail if there was no match.\n if (!indices || score === Infinity) {\n return null;\n }\n\n // Compute the pivot index between category and label text.\n let pivot = category.length + 1;\n\n // Find the slice index to separate matched indices.\n let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n // Extract the matched category and label indices.\n let categoryIndices = indices.slice(0, j);\n let labelIndices = indices.slice(j);\n\n // Adjust the label indices for the pivot offset.\n for (let i = 0, n = labelIndices.length; i < n; ++i) {\n labelIndices[i] -= pivot;\n }\n\n // Handle a pure label match.\n if (categoryIndices.length === 0) {\n return {\n matchType: MatchType.Label,\n categoryIndices: null,\n labelIndices,\n score,\n item\n };\n }\n\n // Handle a pure category match.\n if (labelIndices.length === 0) {\n return {\n matchType: MatchType.Category,\n categoryIndices,\n labelIndices: null,\n score,\n item\n };\n }\n\n // Handle a split match.\n return {\n matchType: MatchType.Split,\n categoryIndices,\n labelIndices,\n score,\n item\n };\n }\n\n /**\n * A sort comparison function for a match score.\n */\n function scoreCmp(a: IScore, b: IScore): number {\n // First compare based on the match type\n let m1 = a.matchType - b.matchType;\n if (m1 !== 0) {\n return m1;\n }\n\n // Otherwise, compare based on the match score.\n let d1 = a.score - b.score;\n if (d1 !== 0) {\n return d1;\n }\n\n // Find the match index based on the match type.\n let i1 = 0;\n let i2 = 0;\n switch (a.matchType) {\n case MatchType.Label:\n i1 = a.labelIndices![0];\n i2 = b.labelIndices![0];\n break;\n case MatchType.Category:\n case MatchType.Split:\n i1 = a.categoryIndices![0];\n i2 = b.categoryIndices![0];\n break;\n }\n\n // Compare based on the match index.\n if (i1 !== i2) {\n return i1 - i2;\n }\n\n // Otherwise, compare by category.\n let d2 = a.item.category.localeCompare(b.item.category);\n if (d2 !== 0) {\n return d2;\n }\n\n // Otherwise, compare by rank.\n let r1 = a.item.rank;\n let r2 = b.item.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity safe\n }\n\n // Finally, compare by label.\n return a.item.label.localeCompare(b.item.label);\n }\n\n /**\n * Create the results from an array of sorted scores.\n */\n function createResults(scores: IScore[]): SearchResult[] {\n // Set up the search results array.\n let results: SearchResult[] = [];\n\n // Iterate over each score in the array.\n for (let i = 0, n = scores.length; i < n; ++i) {\n // Extract the current item and indices.\n let { item, categoryIndices, labelIndices } = scores[i];\n\n // Extract the category for the current item.\n let category = item.category;\n\n // Is this the same category as the preceding result?\n if (i === 0 || category !== scores[i - 1].item.category) {\n // Add the header result for the category.\n results.push({ type: 'header', category, indices: categoryIndices });\n }\n\n // Create the item result for the score.\n results.push({ type: 'item', item, indices: labelIndices });\n }\n\n // Return the final results.\n return results;\n }\n\n /**\n * A concrete implementation of `CommandPalette.IItem`.\n */\n class CommandItem implements CommandPalette.IItem {\n /**\n * Construct a new command item.\n */\n constructor(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ) {\n this._commands = commands;\n this.category = normalizeCategory(options.category);\n this.command = options.command;\n this.args = options.args || JSONExt.emptyObject;\n this.rank = options.rank !== undefined ? options.rank : Infinity;\n }\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n get label(): string {\n return this._commands.label(this.command, this.args);\n }\n\n /**\n * The icon renderer for the command item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._commands.icon(this.command, this.args);\n }\n\n /**\n * The icon class for the command item.\n */\n get iconClass(): string {\n return this._commands.iconClass(this.command, this.args);\n }\n\n /**\n * The icon label for the command item.\n */\n get iconLabel(): string {\n return this._commands.iconLabel(this.command, this.args);\n }\n\n /**\n * The display caption for the command item.\n */\n get caption(): string {\n return this._commands.caption(this.command, this.args);\n }\n\n /**\n * The extra class name for the command item.\n */\n get className(): string {\n return this._commands.className(this.command, this.args);\n }\n\n /**\n * The dataset for the command item.\n */\n get dataset(): CommandRegistry.Dataset {\n return this._commands.dataset(this.command, this.args);\n }\n\n /**\n * Whether the command item is enabled.\n */\n get isEnabled(): boolean {\n return this._commands.isEnabled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggled.\n */\n get isToggled(): boolean {\n return this._commands.isToggled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggleable.\n */\n get isToggleable(): boolean {\n return this._commands.isToggleable(this.command, this.args);\n }\n\n /**\n * Whether the command item is visible.\n */\n get isVisible(): boolean {\n return this._commands.isVisible(this.command, this.args);\n }\n\n /**\n * The key binding for the command item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ARIAAttrNames,\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n pageXOffset: number;\n pageYOffset: number;\n clientWidth: number;\n clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n /**\n * Construct a new menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: Menu.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-Menu');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || Menu.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the menu.\n */\n dispose(): void {\n this.close();\n this._items.length = 0;\n super.dispose();\n }\n\n /**\n * A signal emitted just before the menu is closed.\n *\n * #### Notes\n * This signal is emitted when the menu receives a `'close-request'`\n * message, just before it removes itself from the DOM.\n *\n * This signal is not emitted if the menu is already detached from\n * the DOM when it receives the `'close-request'` message.\n */\n get aboutToClose(): ISignal {\n return this._aboutToClose;\n }\n\n /**\n * A signal emitted when a new menu is requested by the user.\n *\n * #### Notes\n * This signal is emitted whenever the user presses the right or left\n * arrow keys, and a submenu cannot be opened or closed in response.\n *\n * This signal is useful when implementing menu bars in order to open\n * the next or previous menu in response to a user key press.\n *\n * This signal is only emitted for the root menu in a hierarchy.\n */\n get menuRequested(): ISignal {\n return this._menuRequested;\n }\n\n /**\n * The command registry used by the menu.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the menu.\n */\n readonly renderer: Menu.IRenderer;\n\n /**\n * The parent menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu is an open submenu.\n */\n get parentMenu(): Menu | null {\n return this._parentMenu;\n }\n\n /**\n * The child menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu has an open submenu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The root menu of the menu hierarchy.\n */\n get rootMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._parentMenu) {\n menu = menu._parentMenu;\n }\n return menu;\n }\n\n /**\n * The leaf menu of the menu hierarchy.\n */\n get leafMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._childMenu) {\n menu = menu._childMenu;\n }\n return menu;\n }\n\n /**\n * The menu content node.\n *\n * #### Notes\n * This is the node which holds the menu item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-Menu-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu item.\n */\n get activeItem(): Menu.IItem | null {\n return this._items[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the item will be set to `null`.\n */\n set activeItem(value: Menu.IItem | null) {\n this.activeIndex = value ? this._items.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu item.\n *\n * #### Notes\n * This will be `-1` if no menu item is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._items.length) {\n value = -1;\n }\n\n // Ensure the item can be activated.\n if (value !== -1 && !Private.canActivate(this._items[value])) {\n value = -1;\n }\n\n // Bail if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Make active element in focus\n if (\n this._activeIndex >= 0 &&\n this.contentNode.childNodes[this._activeIndex]\n ) {\n (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n }\n\n // schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menu items in the menu.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Activate the next selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activateNextItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this.activeIndex = ArrayExt.findFirstIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Activate the previous selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activatePreviousItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this.activeIndex = ArrayExt.findLastIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Trigger the active menu item.\n *\n * #### Notes\n * If the active item is a submenu, it will be opened and the first\n * item will be activated.\n *\n * If the active item is a command, the command will be executed.\n *\n * If the menu is not attached, this is a no-op.\n *\n * If there is no active item, this is a no-op.\n */\n triggerActiveItem(): void {\n // Bail if the menu is not attached.\n if (!this.isAttached) {\n return;\n }\n\n // Bail if there is no active item.\n let item = this.activeItem;\n if (!item) {\n return;\n }\n\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // If the item is a submenu, open it.\n if (item.type === 'submenu') {\n this._openChildMenu(true);\n return;\n }\n\n // Close the root menu before executing the command.\n this.rootMenu.close();\n\n // Execute the command for the item.\n let { command, args } = item;\n if (this.commands.isEnabled(command, args)) {\n this.commands.execute(command, args);\n } else {\n console.log(`Command '${command}' is disabled.`);\n }\n }\n\n /**\n * Add a menu item to the end of the menu.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n */\n addItem(options: Menu.IItemOptions): Menu.IItem {\n return this.insertItem(this._items.length, options);\n }\n\n /**\n * Insert a menu item into the menu at the specified index.\n *\n * @param index - The index at which to insert the item.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n *\n * #### Notes\n * The index will be clamped to the bounds of the items.\n */\n insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Clamp the insert index to the array bounds.\n let i = Math.max(0, Math.min(index, this._items.length));\n\n // Create the item for the options.\n let item = Private.createItem(this, options);\n\n // Insert the item into the array.\n ArrayExt.insert(this._items, i, item);\n\n // Schedule an update of the items.\n this.update();\n\n // Return the item added to the menu.\n return item;\n }\n\n /**\n * Remove an item from the menu.\n *\n * @param item - The item to remove from the menu.\n *\n * #### Notes\n * This is a no-op if the item is not in the menu.\n */\n removeItem(item: Menu.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the menu.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Remove all menu items from the menu.\n */\n clearItems(): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the items.\n this._items.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Open the menu at the specified location.\n *\n * @param x - The client X coordinate of the menu location.\n *\n * @param y - The client Y coordinate of the menu location.\n *\n * @param options - The additional options for opening the menu.\n *\n * #### Notes\n * The menu will be opened at the given location unless it will not\n * fully fit on the screen. If it will not fit, it will be adjusted\n * to fit naturally on the screen.\n *\n * The menu will be attached under the `host` element in the DOM\n * (or `document.body` if `host` is `null`) and before the `ref`\n * element (or as the last child of `host` if `ref` is `null`).\n * The menu may be displayed outside of the `host` element\n * following the rules of CSS absolute positioning.\n *\n * This is a no-op if the menu is already attached to the DOM.\n */\n open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n // Bail early if the menu is already attached.\n if (this.isAttached) {\n return;\n }\n\n // Extract the menu options.\n let forceX = options.forceX || false;\n let forceY = options.forceY || false;\n const host = options.host ?? null;\n const ref = options.ref ?? null;\n\n // Open the menu as a root menu.\n Private.openRootMenu(this, x, y, forceX, forceY, host, ref);\n\n // Activate the menu to accept keyboard input.\n this.activate();\n }\n\n /**\n * Handle the DOM events for the menu.\n *\n * @param event - The DOM event sent to the menu.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu's DOM nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseenter':\n this._evtMouseEnter(event as MouseEvent);\n break;\n case 'mouseleave':\n this._evtMouseLeave(event as MouseEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mouseup', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseenter', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('contextmenu', this);\n this.node.ownerDocument.addEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mouseup', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseenter', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('contextmenu', this);\n this.node.ownerDocument.removeEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this.node.focus();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let items = this._items;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let collapsedFlags = Private.computeCollapsed(items);\n let content = new Array(items.length);\n for (let i = 0, n = items.length; i < n; ++i) {\n let item = items[i];\n let active = i === activeIndex;\n let collapsed = collapsedFlags[i];\n content[i] = renderer.renderItem({\n item,\n active,\n collapsed,\n onfocus: () => {\n this.activeIndex = i;\n }\n });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n */\n protected onCloseRequest(msg: Message): void {\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Close any open child menu.\n let childMenu = this._childMenu;\n if (childMenu) {\n this._childIndex = -1;\n this._childMenu = null;\n childMenu._parentMenu = null;\n childMenu.close();\n }\n\n // Remove this menu from its parent and activate the parent.\n let parentMenu = this._parentMenu;\n if (parentMenu) {\n this._parentMenu = null;\n parentMenu._childIndex = -1;\n parentMenu._childMenu = null;\n parentMenu.activate();\n }\n\n // Emit the `aboutToClose` signal if the menu is attached.\n if (this.isAttached) {\n this._aboutToClose.emit(undefined);\n }\n\n // Finish closing the menu.\n super.onCloseRequest(msg);\n }\n\n /**\n * Handle the `'keydown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // A menu handles all keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Enter\n if (kc === 13) {\n this.triggerActiveItem();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this.close();\n return;\n }\n\n // Left Arrow\n if (kc === 37) {\n if (this._parentMenu) {\n this.close();\n } else {\n this._menuRequested.emit('previous');\n }\n return;\n }\n\n // Up Arrow\n if (kc === 38) {\n this.activatePreviousItem();\n return;\n }\n\n // Right Arrow\n if (kc === 39) {\n let item = this.activeItem;\n if (item && item.type === 'submenu') {\n this.triggerActiveItem();\n } else {\n this.rootMenu._menuRequested.emit('next');\n }\n return;\n }\n\n // Down Arrow\n if (kc === 40) {\n this.activateNextItem();\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._items, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that item is triggered.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.triggerActiveItem();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n }\n }\n\n /**\n * Handle the `'mouseup'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseUp(event: MouseEvent): void {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.triggerActiveItem();\n }\n\n /**\n * Handle the `'mousemove'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Hit test the item nodes for the item under the mouse.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the mouse is already over the active index.\n if (index === this._activeIndex) {\n return;\n }\n\n // Update and coerce the active index.\n this.activeIndex = index;\n index = this.activeIndex;\n\n // If the index is the current child index, cancel the timers.\n if (index === this._childIndex) {\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n return;\n }\n\n // If a child menu is currently open, start the close timer.\n if (this._childIndex !== -1) {\n this._startCloseTimer();\n }\n\n // Cancel the open timer to give a full delay for opening.\n this._cancelOpenTimer();\n\n // Bail if the active item is not a valid submenu item.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n return;\n }\n\n // Start the open timer to open the active item submenu.\n this._startOpenTimer();\n }\n\n /**\n * Handle the `'mouseenter'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseEnter(event: MouseEvent): void {\n // Synchronize the active ancestor items.\n for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n menu._cancelOpenTimer();\n menu._cancelCloseTimer();\n menu.activeIndex = menu._childIndex;\n }\n }\n\n /**\n * Handle the `'mouseleave'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseLeave(event: MouseEvent): void {\n // Cancel any pending submenu opening.\n this._cancelOpenTimer();\n\n // If there is no open child menu, just reset the active index.\n if (!this._childMenu) {\n this.activeIndex = -1;\n return;\n }\n\n // If the mouse is over the child menu, cancel the close timer.\n let { clientX, clientY } = event;\n if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n this._cancelCloseTimer();\n return;\n }\n\n // Otherwise, reset the active index and start the close timer.\n this.activeIndex = -1;\n this._startCloseTimer();\n }\n\n /**\n * Handle the `'mousedown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the document node.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the menu is not a root menu.\n if (this._parentMenu) {\n return;\n }\n\n // The mouse button which is pressed is irrelevant. If the press\n // is not on a menu, the entire hierarchy is closed and the event\n // is allowed to propagate. This allows other code to act on the\n // event, such as focusing the clicked element.\n if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n event.preventDefault();\n event.stopPropagation();\n } else {\n this.close();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if the active item is not a valid submenu.\n */\n private _openChildMenu(activateFirst = false): void {\n // If the item is not a valid submenu, close the child menu.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n this._closeChildMenu();\n return;\n }\n\n // Do nothing if the child menu will not change.\n let submenu = item.submenu;\n if (submenu === this._childMenu) {\n return;\n }\n\n // Prior to any DOM modifications save window data\n Menu.saveWindowData();\n\n // Ensure the current child menu is closed.\n this._closeChildMenu();\n\n // Update the private child state.\n this._childMenu = submenu;\n this._childIndex = this._activeIndex;\n\n // Set the parent menu reference for the child.\n submenu._parentMenu = this;\n\n // Ensure the menu is updated and lookup the item node.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n let itemNode = this.contentNode.children[this._activeIndex];\n\n // Open the submenu at the active node.\n Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n // Activate the first item if desired.\n if (activateFirst) {\n submenu.activeIndex = -1;\n submenu.activateNextItem();\n }\n\n // Activate the child menu.\n submenu.activate();\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n if (this._childMenu) {\n this._childMenu.close();\n }\n }\n\n /**\n * Start the open timer, unless it is already pending.\n */\n private _startOpenTimer(): void {\n if (this._openTimerID === 0) {\n this._openTimerID = window.setTimeout(() => {\n this._openTimerID = 0;\n this._openChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Start the close timer, unless it is already pending.\n */\n private _startCloseTimer(): void {\n if (this._closeTimerID === 0) {\n this._closeTimerID = window.setTimeout(() => {\n this._closeTimerID = 0;\n this._closeChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Cancel the open timer, if the timer is pending.\n */\n private _cancelOpenTimer(): void {\n if (this._openTimerID !== 0) {\n clearTimeout(this._openTimerID);\n this._openTimerID = 0;\n }\n }\n\n /**\n * Cancel the close timer, if the timer is pending.\n */\n private _cancelCloseTimer(): void {\n if (this._closeTimerID !== 0) {\n clearTimeout(this._closeTimerID);\n this._closeTimerID = 0;\n }\n }\n\n /**\n * Save window data used for menu positioning in transient cache.\n *\n * In order to avoid layout trashing it is recommended to invoke this\n * method immediately prior to opening the menu and any DOM modifications\n * (like closing previously visible menu, or adding a class to menu widget).\n *\n * The transient cache will be released upon `open()` call.\n */\n static saveWindowData(): void {\n Private.saveWindowData();\n }\n\n private _childIndex = -1;\n private _activeIndex = -1;\n private _openTimerID = 0;\n private _closeTimerID = 0;\n private _items: Menu.IItem[] = [];\n private _childMenu: Menu | null = null;\n private _parentMenu: Menu | null = null;\n private _aboutToClose = new Signal(this);\n private _menuRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n /**\n * An options object for creating a menu.\n */\n export interface IOptions {\n /**\n * The command registry for use with the menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the menu.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for the `open` method on a menu.\n */\n export interface IOpenOptions {\n /**\n * Whether to force the X position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * X coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceX?: boolean;\n\n /**\n * Whether to force the Y position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * Y coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceY?: boolean;\n\n /**\n * The DOM node to use as the menu's host.\n *\n * If not specified then uses `document.body`.\n */\n host?: HTMLElement;\n\n /**\n * The child of `host` to use as the reference element.\n * If this is provided, the menu will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * menu to be added as the last child of the host.\n */\n ref?: HTMLElement;\n }\n\n /**\n * A type alias for a menu item type.\n */\n export type ItemType = 'command' | 'submenu' | 'separator';\n\n /**\n * An options object for creating a menu item.\n */\n export interface IItemOptions {\n /**\n * The type of the menu item.\n *\n * The default value is `'command'`.\n */\n type?: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n *\n * The default value is an empty string.\n */\n command?: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n *\n * The default value is `null`.\n */\n submenu?: Menu | null;\n }\n\n /**\n * An object which represents a menu item.\n *\n * #### Notes\n * Item objects are created automatically by a menu.\n */\n export interface IItem {\n /**\n * The type of the menu item.\n */\n readonly type: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n readonly label: string;\n\n /**\n * The mnemonic index for the menu item.\n */\n readonly mnemonic: number;\n\n /**\n * The icon renderer for the menu item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the menu item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the menu item.\n */\n readonly iconLabel: string;\n\n /**\n * The display caption for the menu item.\n */\n readonly caption: string;\n\n /**\n * The extra class name for the menu item.\n */\n readonly className: string;\n\n /**\n * The dataset for the menu item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the menu item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the menu item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the menu item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the menu item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * An object which holds the data to render a menu item.\n */\n export interface IRenderData {\n /**\n * The item to be rendered.\n */\n readonly item: IItem;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the item should be collapsed.\n */\n readonly collapsed: boolean;\n\n /**\n * Handler for when element is in focus.\n */\n readonly onfocus?: () => void;\n }\n\n /**\n * A renderer for use with a menu.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n tabindex: '0',\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderShortcut(data),\n this.renderSubmenu(data)\n );\n }\n\n /**\n * Render the icon element for a menu item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-Menu-itemLabel' }, content);\n }\n\n /**\n * Render the shortcut element for a menu item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the item shortcut.\n */\n renderShortcut(data: IRenderData): VirtualElement {\n let content = this.formatShortcut(data);\n return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n }\n\n /**\n * Render the submenu icon element for a menu item.\n *\n * @param data - The data to use for rendering the submenu icon.\n *\n * @returns A virtual element representing the submenu icon.\n */\n renderSubmenu(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n }\n\n /**\n * Create the class name for the menu item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n // Setup the initial class name.\n let name = 'lm-Menu-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (!data.item.isVisible) {\n name += ' lm-mod-hidden';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n if (data.collapsed) {\n name += ' lm-mod-collapsed';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the menu item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the menu item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n let result: ElementDataset;\n let { type, command, dataset } = data.item;\n if (type === 'command') {\n result = { ...dataset, type, command };\n } else {\n result = { ...dataset, type };\n }\n return result;\n }\n\n /**\n * Create the class name for the menu item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-Menu-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the aria attributes for menu item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n let aria: { [T in ARIAAttrNames]?: string } = {};\n switch (data.item.type) {\n case 'separator':\n aria.role = 'presentation';\n break;\n case 'submenu':\n aria['aria-haspopup'] = 'true';\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n break;\n default:\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n aria.role = 'menuitem';\n }\n return aria;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.item;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n\n /**\n * Create the render content for the shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatShortcut(data: IRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The ms delay for opening and closing a submenu.\n */\n export const TIMER_DELAY = 300;\n\n /**\n * The horizontal pixel overlap for an open submenu.\n */\n export const SUBMENU_OVERLAP = 3;\n\n let transientWindowDataCache: IWindowData | null = null;\n let transientCacheCounter: number = 0;\n\n function getWindowData(): IWindowData {\n // if transient cache is in use, take one from it\n if (transientCacheCounter > 0) {\n transientCacheCounter--;\n return transientWindowDataCache!;\n }\n return _getWindowData();\n }\n\n /**\n * Store window data in transient cache.\n *\n * The transient cache will be released upon `getWindowData()` call.\n * If this function is called multiple times, the cache will be\n * retained until as many calls to `getWindowData()` were made.\n *\n * Note: should be called before any DOM modifications.\n */\n export function saveWindowData(): void {\n transientWindowDataCache = _getWindowData();\n transientCacheCounter++;\n }\n\n /**\n * Create the DOM node for a menu.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-Menu-content';\n node.appendChild(content);\n content.setAttribute('role', 'menu');\n node.tabIndex = 0;\n return node;\n }\n\n /**\n * Test whether a menu item can be activated.\n */\n export function canActivate(item: Menu.IItem): boolean {\n return item.type !== 'separator' && item.isEnabled && item.isVisible;\n }\n\n /**\n * Create a new menu item for an owner menu.\n */\n export function createItem(\n owner: Menu,\n options: Menu.IItemOptions\n ): Menu.IItem {\n return new MenuItem(owner.commands, options);\n }\n\n /**\n * Hit test a menu hierarchy starting at the given root.\n */\n export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n if (ElementExt.hitTest(temp.node, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Compute which extra separator items should be collapsed.\n */\n export function computeCollapsed(\n items: ReadonlyArray\n ): boolean[] {\n // Allocate the return array and fill it with `false`.\n let result = new Array(items.length);\n ArrayExt.fill(result, false);\n\n // Collapse the leading separators.\n let k1 = 0;\n let n = items.length;\n for (; k1 < n; ++k1) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k1] = true;\n }\n\n // Hide the trailing separators.\n let k2 = n - 1;\n for (; k2 >= 0; --k2) {\n let item = items[k2];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k2] = true;\n }\n\n // Hide the remaining consecutive separators.\n let hide = false;\n while (++k1 < k2) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n hide = false;\n } else if (hide) {\n result[k1] = true;\n } else {\n hide = true;\n }\n }\n\n // Return the resulting flags.\n return result;\n }\n\n function _getWindowData(): IWindowData {\n return {\n pageXOffset: window.pageXOffset,\n pageYOffset: window.pageYOffset,\n clientWidth: document.documentElement.clientWidth,\n clientHeight: document.documentElement.clientHeight\n };\n }\n\n /**\n * Open a menu as a root menu at the target location.\n */\n export function openRootMenu(\n menu: Menu,\n x: number,\n y: number,\n forceX: boolean,\n forceY: boolean,\n host: HTMLElement | null,\n ref: HTMLElement | null\n ): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before attaching and measuring.\n MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch - (forceY ? y : 0);\n\n // Fetch common variables.\n let node = menu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(menu, host || document.body, ref);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Adjust the X position of the menu to fit on-screen.\n if (!forceX && x + width > px + cw) {\n x = px + cw - width;\n }\n\n // Adjust the Y position of the menu to fit on-screen.\n if (!forceY && y + height > py + ch) {\n if (y > py + ch) {\n y = py + ch - height;\n } else {\n y = y - height;\n }\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * Open a menu as a submenu using an item node for positioning.\n */\n export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before opening.\n MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch;\n\n // Fetch common variables.\n let node = submenu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(submenu, itemNode.ownerDocument.body);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Compute the box sizing for the menu.\n let box = ElementExt.boxSizing(submenu.node);\n\n // Get the bounding rect for the target item node.\n let itemRect = itemNode.getBoundingClientRect();\n\n // Compute the target X position.\n let x = itemRect.right - SUBMENU_OVERLAP;\n\n // Adjust the X position to fit on the screen.\n if (x + width > px + cw) {\n x = itemRect.left + SUBMENU_OVERLAP - width;\n }\n\n // Compute the target Y position.\n let y = itemRect.top - box.borderTop - box.paddingTop;\n\n // Adjust the Y position to fit on the screen.\n if (y + height > py + ch) {\n y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n items: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Lookup the item\n let item = items[k];\n\n // Ignore items which cannot be activated.\n if (!canActivate(item)) {\n continue;\n }\n\n // Ignore items with an empty label.\n let label = item.label;\n if (label.length === 0) {\n continue;\n }\n\n // Lookup the mnemonic index for the label.\n let mn = item.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < label.length) {\n if (label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n\n /**\n * A concrete implementation of `Menu.IItem`.\n */\n class MenuItem implements Menu.IItem {\n /**\n * Construct a new menu item.\n */\n constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n this._commands = commands;\n this.type = options.type || 'command';\n this.command = options.command || '';\n this.args = options.args || JSONExt.emptyObject;\n this.submenu = options.submenu || null;\n }\n\n /**\n * The type of the menu item.\n */\n readonly type: Menu.ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n get label(): string {\n if (this.type === 'command') {\n return this._commands.label(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.label;\n }\n return '';\n }\n\n /**\n * The mnemonic index for the menu item.\n */\n get mnemonic(): number {\n if (this.type === 'command') {\n return this._commands.mnemonic(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.mnemonic;\n }\n return -1;\n }\n\n /**\n * The icon renderer for the menu item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n if (this.type === 'command') {\n return this._commands.icon(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.icon;\n }\n return undefined;\n }\n\n /**\n * The icon class for the menu item.\n */\n get iconClass(): string {\n if (this.type === 'command') {\n return this._commands.iconClass(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconClass;\n }\n return '';\n }\n\n /**\n * The icon label for the menu item.\n */\n get iconLabel(): string {\n if (this.type === 'command') {\n return this._commands.iconLabel(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconLabel;\n }\n return '';\n }\n\n /**\n * The display caption for the menu item.\n */\n get caption(): string {\n if (this.type === 'command') {\n return this._commands.caption(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.caption;\n }\n return '';\n }\n\n /**\n * The extra class name for the menu item.\n */\n get className(): string {\n if (this.type === 'command') {\n return this._commands.className(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.className;\n }\n return '';\n }\n\n /**\n * The dataset for the menu item.\n */\n get dataset(): CommandRegistry.Dataset {\n if (this.type === 'command') {\n return this._commands.dataset(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.dataset;\n }\n return {};\n }\n\n /**\n * Whether the menu item is enabled.\n */\n get isEnabled(): boolean {\n if (this.type === 'command') {\n return this._commands.isEnabled(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * Whether the menu item is toggled.\n */\n get isToggled(): boolean {\n if (this.type === 'command') {\n return this._commands.isToggled(this.command, this.args);\n }\n return false;\n }\n\n /**\n * Whether the menu item is visible.\n */\n get isVisible(): boolean {\n if (this.type === 'command') {\n return this._commands.isVisible(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * The key binding for the menu item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n if (this.type === 'command') {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n return null;\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n /**\n * Construct a new context menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: ContextMenu.IOptions) {\n const { groupByTarget, sortBySelector, ...others } = options;\n this.menu = new Menu(others);\n this._groupByTarget = groupByTarget !== false;\n this._sortBySelector = sortBySelector !== false;\n }\n\n /**\n * The menu widget which displays the matched context items.\n */\n readonly menu: Menu;\n\n /**\n * Add an item to the context menu.\n *\n * @param options - The options for creating the item.\n *\n * @returns A disposable which will remove the item from the menu.\n */\n addItem(options: ContextMenu.IItemOptions): IDisposable {\n // Create an item from the given options.\n let item = Private.createItem(options, this._idTick++);\n\n // Add the item to the internal array.\n this._items.push(item);\n\n // Return a disposable which will remove the item.\n return new DisposableDelegate(() => {\n ArrayExt.removeFirstOf(this._items, item);\n });\n }\n\n /**\n * Open the context menu in response to a `'contextmenu'` event.\n *\n * @param event - The `'contextmenu'` event of interest.\n *\n * @returns `true` if the menu was opened, or `false` if no items\n * matched the event and the menu was not opened.\n *\n * #### Notes\n * This method will populate the context menu with items which match\n * the propagation path of the event, then open the menu at the mouse\n * position indicated by the event.\n */\n open(event: MouseEvent): boolean {\n // Prior to any DOM modifications update the window data.\n Menu.saveWindowData();\n\n // Clear the current contents of the context menu.\n this.menu.clearItems();\n\n // Bail early if there are no items to match.\n if (this._items.length === 0) {\n return false;\n }\n\n // Find the matching items for the event.\n let items = Private.matchItems(\n this._items,\n event,\n this._groupByTarget,\n this._sortBySelector\n );\n\n // Bail if there are no matching items.\n if (!items || items.length === 0) {\n return false;\n }\n\n // Add the filtered items to the menu.\n for (const item of items) {\n this.menu.addItem(item);\n }\n\n // Open the context menu at the current mouse position.\n this.menu.open(event.clientX, event.clientY);\n\n // Indicate success.\n return true;\n }\n\n private _groupByTarget: boolean = true;\n private _idTick = 0;\n private _items: Private.IItem[] = [];\n private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n /**\n * An options object for initializing a context menu.\n */\n export interface IOptions {\n /**\n * The command registry to use with the context menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the context menu.\n */\n renderer?: Menu.IRenderer;\n\n /**\n * Whether to sort by selector and rank or only rank.\n *\n * Default true.\n */\n sortBySelector?: boolean;\n\n /**\n * Whether to group items following the DOM hierarchy.\n *\n * Default true.\n *\n * #### Note\n * If true, when the mouse event occurs on element `span` within `div.top`,\n * the items matching `div.top` will be shown before the ones matching `body`.\n */\n groupByTarget?: boolean;\n }\n\n /**\n * An options object for creating a context menu item.\n */\n export interface IItemOptions extends Menu.IItemOptions {\n /**\n * The CSS selector for the context menu item.\n *\n * The context menu item will only be displayed in the context menu\n * when the selector matches a node on the propagation path of the\n * contextmenu event. This allows the menu item to be restricted to\n * user-defined contexts.\n *\n * The selector must not contain commas.\n */\n selector: string;\n\n /**\n * The rank for the item.\n *\n * The rank is used as a tie-breaker when ordering context menu\n * items for display. Items are sorted in the following order:\n * 1. Depth in the DOM tree (deeper is better)\n * 2. Selector specificity (higher is better)\n * 3. Rank (lower is better)\n * 4. Insertion order\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A normalized item for a context menu.\n */\n export interface IItem extends Menu.IItemOptions {\n /**\n * The selector for the item.\n */\n selector: string;\n\n /**\n * The rank for the item.\n */\n rank: number;\n\n /**\n * The tie-breaking id for the item.\n */\n id: number;\n }\n\n /**\n * Create a normalized context menu item from an options object.\n */\n export function createItem(\n options: ContextMenu.IItemOptions,\n id: number\n ): IItem {\n let selector = validateSelector(options.selector);\n let rank = options.rank !== undefined ? options.rank : Infinity;\n return { ...options, selector, rank, id };\n }\n\n /**\n * Find the items which match a context menu event.\n *\n * The results are sorted by DOM level, specificity, and rank.\n */\n export function matchItems(\n items: IItem[],\n event: MouseEvent,\n groupByTarget: boolean,\n sortBySelector: boolean\n ): IItem[] | null {\n // Look up the target of the event.\n let target = event.target as Element | null;\n\n // Bail if there is no target.\n if (!target) {\n return null;\n }\n\n // Look up the current target of the event.\n let currentTarget = event.currentTarget as Element | null;\n\n // Bail if there is no current target.\n if (!currentTarget) {\n return null;\n }\n\n // There are some third party libraries that cause the `target` to\n // be detached from the DOM before lumino can process the event.\n // If that happens, search for a new target node by point. If that\n // node is still dangling, bail.\n if (!currentTarget.contains(target)) {\n target = document.elementFromPoint(event.clientX, event.clientY);\n if (!target || !currentTarget.contains(target)) {\n return null;\n }\n }\n\n // Set up the result array.\n let result: IItem[] = [];\n\n // Copy the items array to allow in-place modification.\n let availableItems: Array = items.slice();\n\n // Walk up the DOM hierarchy searching for matches.\n while (target !== null) {\n // Set up the match array for this DOM level.\n let matches: IItem[] = [];\n\n // Search the remaining items for matches.\n for (let i = 0, n = availableItems.length; i < n; ++i) {\n // Fetch the item.\n let item = availableItems[i];\n\n // Skip items which are already consumed.\n if (!item) {\n continue;\n }\n\n // Skip items which do not match the element.\n if (!Selector.matches(target, item.selector)) {\n continue;\n }\n\n // Add the matched item to the result for this DOM level.\n matches.push(item);\n\n // Mark the item as consumed.\n availableItems[i] = null;\n }\n\n // Sort the matches for this level and add them to the results.\n if (matches.length !== 0) {\n if (groupByTarget) {\n matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n result.push(...matches);\n }\n\n // Stop searching at the limits of the DOM range.\n if (target === currentTarget) {\n break;\n }\n\n // Step to the parent DOM level.\n target = target.parentElement;\n }\n\n if (!groupByTarget) {\n result.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n\n // Return the matched and sorted results.\n return result;\n }\n\n /**\n * Validate the selector for a menu item.\n *\n * This returns the validated selector, or throws if the selector is\n * invalid or contains commas.\n */\n function validateSelector(selector: string): string {\n if (selector.indexOf(',') !== -1) {\n throw new Error(`Selector cannot contain commas: ${selector}`);\n }\n if (!Selector.isValid(selector)) {\n throw new Error(`Invalid selector: ${selector}`);\n }\n return selector;\n }\n\n /**\n * A sort comparison function for a context menu item by ranks.\n */\n function itemCmpRank(a: IItem, b: IItem): number {\n // Sort based on rank.\n let r1 = a.rank;\n let r2 = b.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity-safe\n }\n\n // When all else fails, sort by item id.\n return a.id - b.id;\n }\n\n /**\n * A sort comparison function for a context menu item by selectors and ranks.\n */\n function itemCmp(a: IItem, b: IItem): number {\n // Sort first based on selector specificity.\n let s1 = Selector.calculateSpecificity(a.selector);\n let s2 = Selector.calculateSpecificity(b.selector);\n if (s1 !== s2) {\n return s2 - s1;\n }\n\n // If specificities are equal\n return itemCmpRank(a, b);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ElementARIAAttrs,\n ElementBaseAttrs,\n ElementDataset,\n ElementInlineStyle,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n 'ArrowLeft',\n 'ArrowUp',\n 'ArrowRight',\n 'ArrowDown',\n 'Home',\n 'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar extends Widget {\n /**\n * Construct a new tab bar.\n *\n * @param options - The options for initializing the tab bar.\n */\n constructor(options: TabBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-TabBar');\n this.contentNode.setAttribute('role', 'tablist');\n this.setFlag(Widget.Flag.DisallowLayout);\n this._document = options.document || document;\n this.tabsMovable = options.tabsMovable || false;\n this.titlesEditable = options.titlesEditable || false;\n this.allowDeselect = options.allowDeselect || false;\n this.addButtonEnabled = options.addButtonEnabled || false;\n this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n this.name = options.name || '';\n this.orientation = options.orientation || 'horizontal';\n this.removeBehavior = options.removeBehavior || 'select-tab-after';\n this.renderer = options.renderer || TabBar.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._releaseMouse();\n this._titles.length = 0;\n this._previousTitle = null;\n super.dispose();\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when a tab is moved by the user.\n *\n * #### Notes\n * This signal is emitted when a tab is moved by user interaction.\n *\n * This signal is not emitted when a tab is moved programmatically.\n */\n get tabMoved(): ISignal> {\n return this._tabMoved;\n }\n\n /**\n * A signal emitted when a tab is clicked by the user.\n *\n * #### Notes\n * If the clicked tab is not the current tab, the clicked tab will be\n * made current and the `currentChanged` signal will be emitted first.\n *\n * This signal is emitted even if the clicked tab is the current tab.\n */\n get tabActivateRequested(): ISignal<\n this,\n TabBar.ITabActivateRequestedArgs\n > {\n return this._tabActivateRequested;\n }\n\n /**\n * A signal emitted when the tab bar add button is clicked.\n */\n get addRequested(): ISignal {\n return this._addRequested;\n }\n\n /**\n * A signal emitted when a tab close icon is clicked.\n *\n * #### Notes\n * This signal is not emitted unless the tab title is `closable`.\n */\n get tabCloseRequested(): ISignal> {\n return this._tabCloseRequested;\n }\n\n /**\n * A signal emitted when a tab is dragged beyond the detach threshold.\n *\n * #### Notes\n * This signal is emitted when the user drags a tab with the mouse,\n * and mouse is dragged beyond the detach threshold.\n *\n * The consumer of the signal should call `releaseMouse` and remove\n * the tab in order to complete the detach.\n *\n * This signal is only emitted once per drag cycle.\n */\n get tabDetachRequested(): ISignal> {\n return this._tabDetachRequested;\n }\n\n /**\n * The renderer used by the tab bar.\n */\n readonly renderer: TabBar.IRenderer;\n\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n get document(): Document | ShadowRoot {\n return this._document;\n }\n\n /**\n * Whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n tabsMovable: boolean;\n\n /**\n * Whether the titles can be user-edited.\n *\n */\n get titlesEditable(): boolean {\n return this._titlesEditable;\n }\n\n /**\n * Set whether titles can be user edited.\n *\n */\n set titlesEditable(value: boolean) {\n this._titlesEditable = value;\n }\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * #### Notes\n * Tabs can be always be deselected programmatically.\n */\n allowDeselect: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n */\n insertBehavior: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n */\n removeBehavior: TabBar.RemoveBehavior;\n\n /**\n * Get the currently selected title.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get currentTitle(): Title | null {\n return this._titles[this._currentIndex] || null;\n }\n\n /**\n * Set the currently selected title.\n *\n * #### Notes\n * If the title does not exist, the title will be set to `null`.\n */\n set currentTitle(value: Title | null) {\n this.currentIndex = value ? this._titles.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this._currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `-1`.\n */\n set currentIndex(value: number) {\n // Adjust for an out of range index.\n if (value < 0 || value >= this._titles.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._currentIndex === value) {\n return;\n }\n\n // Look up the previous index and title.\n let pi = this._currentIndex;\n let pt = this._titles[pi] || null;\n\n // Look up the current index and title.\n let ci = value;\n let ct = this._titles[ci] || null;\n\n // Update the current index and previous title.\n this._currentIndex = ci;\n this._previousTitle = pt;\n\n // Schedule an update of the tabs.\n this.update();\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: ci,\n currentTitle: ct\n });\n }\n\n /**\n * Get the name of the tab bar.\n */\n get name(): string {\n return this._name;\n }\n\n /**\n * Set the name of the tab bar.\n */\n set name(value: string) {\n this._name = value;\n if (value) {\n this.contentNode.setAttribute('aria-label', value);\n } else {\n this.contentNode.removeAttribute('aria-label');\n }\n }\n\n /**\n * Get the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n get orientation(): TabBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n set orientation(value: TabBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Toggle the orientation values.\n this._orientation = value;\n this.dataset['orientation'] = value;\n this.contentNode.setAttribute('aria-orientation', value);\n }\n\n /**\n * Whether the add button is enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add button is enabled.\n */\n set addButtonEnabled(value: boolean) {\n // Do nothing if the value does not change.\n if (this._addButtonEnabled === value) {\n return;\n }\n\n this._addButtonEnabled = value;\n if (value) {\n this.addButtonNode.classList.remove('lm-mod-hidden');\n } else {\n this.addButtonNode.classList.add('lm-mod-hidden');\n }\n }\n\n /**\n * A read-only array of the titles in the tab bar.\n */\n get titles(): ReadonlyArray> {\n return this._titles;\n }\n\n /**\n * The tab bar content node.\n *\n * #### Notes\n * This is the node which holds the tab nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * The tab bar add button node.\n *\n * #### Notes\n * This is the node which holds the add button.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get addButtonNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-addButton'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Add a tab to the end of the tab bar.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * If the title is already added to the tab bar, it will be moved.\n */\n addTab(value: Title | Title.IOptions): Title {\n return this.insertTab(this._titles.length, value);\n }\n\n /**\n * Insert a tab into the tab bar at the specified index.\n *\n * @param index - The index at which to insert the tab.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the tabs.\n *\n * If the title is already added to the tab bar, it will be moved.\n */\n insertTab(index: number, value: Title | Title.IOptions): Title {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Coerce the value to a title.\n let title = Private.asTitle(value);\n\n // Look up the index of the title.\n let i = this._titles.indexOf(title);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._titles.length));\n\n // If the title is not in the array, insert it.\n if (i === -1) {\n // Insert the title into the array.\n ArrayExt.insert(this._titles, j, title);\n\n // Connect to the title changed signal.\n title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the insert.\n this._adjustCurrentForInsert(j, title);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n // Otherwise, the title exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._titles.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return title;\n }\n\n // Move the title to the new location.\n ArrayExt.move(this._titles, i, j);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n /**\n * Remove a tab from the tab bar.\n *\n * @param title - The title for the tab to remove.\n *\n * #### Notes\n * This is a no-op if the title is not in the tab bar.\n */\n removeTab(title: Title): void {\n this.removeTabAt(this._titles.indexOf(title));\n }\n\n /**\n * Remove the tab at a given index from the tab bar.\n *\n * @param index - The index of the tab to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeTabAt(index: number): void {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Remove the title from the array.\n let title = ArrayExt.removeAt(this._titles, index);\n\n // Bail if the index is out of range.\n if (!title) {\n return;\n }\n\n // Disconnect from the title changed signal.\n title.changed.disconnect(this._onTitleChanged, this);\n\n // Clear the previous title if it's being removed.\n if (title === this._previousTitle) {\n this._previousTitle = null;\n }\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the remove.\n this._adjustCurrentForRemove(index, title);\n }\n\n /**\n * Remove all tabs from the tab bar.\n */\n clearTabs(): void {\n // Bail if there is nothing to remove.\n if (this._titles.length === 0) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Disconnect from the title changed signals.\n for (let title of this._titles) {\n title.changed.disconnect(this._onTitleChanged, this);\n }\n\n // Get the current index and title.\n let pi = this.currentIndex;\n let pt = this.currentTitle;\n\n // Reset the current index and previous title.\n this._currentIndex = -1;\n this._previousTitle = null;\n\n // Clear the title array.\n this._titles.length = 0;\n\n // Schedule an update of the tabs.\n this.update();\n\n // If no tab was selected, there's nothing else to do.\n if (pi === -1) {\n return;\n }\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n *\n * #### Notes\n * This will cause the tab bar to stop handling mouse events and to\n * restore the tabs to their non-dragged positions.\n */\n releaseMouse(): void {\n this._releaseMouse();\n }\n\n /**\n * Handle the DOM events for the tab bar.\n *\n * @param event - The DOM event sent to the tab bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tab bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'dblclick':\n this._evtDblClick(event as MouseEvent);\n break;\n case 'keydown':\n event.eventPhase === Event.CAPTURING_PHASE\n ? this._evtKeyDownCapturing(event as KeyboardEvent)\n : this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n this.node.addEventListener('dblclick', this);\n this.node.addEventListener('keydown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this.node.removeEventListener('dblclick', this);\n this.node.removeEventListener('keydown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let titles = this._titles;\n let renderer = this.renderer;\n let currentTitle = this.currentTitle;\n let content = new Array(titles.length);\n // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n // If the add button handles it, no need to do anything. If no element of the tab\n // bar handles it, set it on the current or the first tab to ensure one element\n // handles it after update.\n const tabHandlingTabindex =\n this._getCurrentTabindex() ??\n (this._currentIndex > -1 ? this._currentIndex : 0);\n\n for (let i = 0, n = titles.length; i < n; ++i) {\n let title = titles[i];\n let current = title === currentTitle;\n let zIndex = current ? n : n - i - 1;\n let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * Get the index of the tab which handles tabindex=\"0\".\n * If the add button handles tabindex=\"0\", -1 is returned.\n * If none of the previous handles tabindex=\"0\", null is returned.\n */\n private _getCurrentTabindex(): number | null {\n let index = null;\n const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n if (elemTabindex) {\n index = [...this.contentNode.children].indexOf(elemTabindex);\n } else if (\n this._addButtonEnabled &&\n this.addButtonNode.getAttribute('tabindex') === '0'\n ) {\n index = -1;\n }\n return index;\n }\n\n /**\n * Handle the `'dblclick'` event for the tab bar.\n */\n private _evtDblClick(event: MouseEvent): void {\n // Do nothing if titles are not editable\n if (!this.titlesEditable) {\n return;\n }\n\n let tabs = this.contentNode.children;\n\n // Find the index of the targeted tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab.\n if (index === -1) {\n return;\n }\n\n let title = this.titles[index];\n let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n if (label && label.contains(event.target as HTMLElement)) {\n let value = title.label || '';\n\n // Clear the label element\n let oldValue = label.innerHTML;\n label.innerHTML = '';\n\n let input = document.createElement('input');\n input.classList.add('lm-TabBar-tabInput');\n input.value = value;\n label.appendChild(input);\n\n let onblur = () => {\n input.removeEventListener('blur', onblur);\n label.innerHTML = oldValue;\n this.node.addEventListener('keydown', this);\n };\n\n input.addEventListener('dblclick', (event: Event) =>\n event.stopPropagation()\n );\n input.addEventListener('blur', onblur);\n input.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n if (input.value !== '') {\n title.label = title.caption = input.value;\n }\n onblur();\n } else if (event.key === 'Escape') {\n onblur();\n }\n });\n this.node.removeEventListener('keydown', this);\n input.select();\n input.focus();\n\n if (label.children.length > 0) {\n (label.children[0] as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at capturing phase.\n */\n private _evtKeyDownCapturing(event: KeyboardEvent): void {\n if (event.eventPhase !== Event.CAPTURING_PHASE) {\n return;\n }\n\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.key === 'Escape') {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at target phase.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Allow for navigation using tab key\n if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n return;\n }\n\n // Check if Enter or Spacebar key has been pressed and open that tab\n if (\n event.key === 'Enter' ||\n event.key === 'Spacebar' ||\n event.key === ' '\n ) {\n // Get focus element that is in focus by the tab key\n const focusedElement = document.activeElement;\n\n // Test first if the focus is on the add button node\n if (\n this.addButtonEnabled &&\n this.addButtonNode.contains(focusedElement)\n ) {\n event.preventDefault();\n event.stopPropagation();\n this._addRequested.emit();\n } else {\n const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n tab.contains(focusedElement)\n );\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this.currentIndex = index;\n }\n }\n // Handle the arrow keys to switch tabs.\n } else if (ARROW_KEYS.includes(event.key)) {\n // Create a list of all focusable elements in the tab bar.\n const focusable: Element[] = [...this.contentNode.children];\n if (this.addButtonEnabled) {\n focusable.push(this.addButtonNode);\n }\n // If the tab bar contains only one element, nothing to do.\n if (focusable.length <= 1) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n\n // Get the current focused element.\n let focusedIndex = focusable.indexOf(document.activeElement as Element);\n if (focusedIndex === -1) {\n focusedIndex = this._currentIndex;\n }\n\n // Find the next element to focus on.\n let nextFocused: Element | null | undefined;\n if (\n (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowDown' && this._orientation === 'vertical')\n ) {\n nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n } else if (\n (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowUp' && this._orientation === 'vertical')\n ) {\n nextFocused =\n focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n } else if (event.key === 'Home') {\n nextFocused = focusable[0];\n } else if (event.key === 'End') {\n nextFocused = focusable[focusable.length - 1];\n }\n\n // Change the focused element and the tabindex value.\n if (nextFocused) {\n focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n nextFocused?.setAttribute('tabindex', '0');\n (nextFocused as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the tab bar.\n */\n private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse press.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if a drag is in progress.\n if (this._dragData) {\n return;\n }\n\n // Do nothing if a title editable input was clicked.\n if (\n (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n ) {\n return;\n }\n\n // Check if the add button was clicked.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the pressed tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab or the add button.\n if (index === -1 && !addButtonClicked) {\n return;\n }\n\n // Pressing on a tab stops the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Initialize the non-measured parts of the drag data.\n this._dragData = {\n tab: tabs[index] as HTMLElement,\n index: index,\n pressX: event.clientX,\n pressY: event.clientY,\n tabPos: -1,\n tabSize: -1,\n tabPressPos: -1,\n targetIndex: -1,\n tabLayout: null,\n contentRect: null,\n override: null,\n dragActive: false,\n dragAborted: false,\n detachRequested: false\n };\n\n // Add the document pointer up listener.\n this.document.addEventListener('pointerup', this, true);\n\n // Do nothing else if the middle button or add button is clicked.\n if (event.button === 1 || addButtonClicked) {\n return;\n }\n\n // Do nothing else if the close icon is clicked.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n return;\n }\n\n // Add the extra listeners if the tabs are movable.\n if (this.tabsMovable) {\n this.document.addEventListener('pointermove', this, true);\n this.document.addEventListener('keydown', this, true);\n this.document.addEventListener('contextmenu', this, true);\n }\n\n // Update the current index as appropriate.\n if (this.allowDeselect && this.currentIndex === index) {\n this.currentIndex = -1;\n } else {\n this.currentIndex = index;\n }\n\n // Do nothing else if there is no current tab.\n if (this.currentIndex === -1) {\n return;\n }\n\n // Emit the tab activate request signal.\n this._tabActivateRequested.emit({\n index: this.currentIndex,\n title: this.currentTitle!\n });\n }\n\n /**\n * Handle the `'pointermove'` event for the tab bar.\n */\n private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Suppress the event during a drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Bail early if the drag threshold has not been met.\n if (!data.dragActive && !Private.dragExceeded(data, event)) {\n return;\n }\n\n // Activate the drag if necessary.\n if (!data.dragActive) {\n // Fill in the rest of the drag data measurements.\n let tabRect = data.tab.getBoundingClientRect();\n if (this._orientation === 'horizontal') {\n data.tabPos = data.tab.offsetLeft;\n data.tabSize = tabRect.width;\n data.tabPressPos = data.pressX - tabRect.left;\n } else {\n data.tabPos = data.tab.offsetTop;\n data.tabSize = tabRect.height;\n data.tabPressPos = data.pressY - tabRect.top;\n }\n data.tabPressOffset = {\n x: data.pressX - tabRect.left,\n y: data.pressY - tabRect.top\n };\n data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n data.contentRect = this.contentNode.getBoundingClientRect();\n data.override = Drag.overrideCursor('default');\n\n // Add the dragging style classes.\n data.tab.classList.add('lm-mod-dragging');\n this.addClass('lm-mod-dragging');\n\n // Mark the drag as active.\n data.dragActive = true;\n }\n\n // Emit the detach requested signal if the threshold is exceeded.\n if (!data.detachRequested && Private.detachExceeded(data, event)) {\n // Only emit the signal once per drag cycle.\n data.detachRequested = true;\n\n // Setup the arguments for the signal.\n let index = data.index;\n let clientX = event.clientX;\n let clientY = event.clientY;\n let tab = tabs[index] as HTMLElement;\n let title = this._titles[index];\n\n // Emit the tab detach requested signal.\n this._tabDetachRequested.emit({\n index,\n title,\n tab,\n clientX,\n clientY,\n offset: data.tabPressOffset\n });\n\n // Bail if the signal handler aborted the drag.\n if (data.dragAborted) {\n return;\n }\n }\n\n // Update the positions of the tabs.\n Private.layoutTabs(tabs, data, event, this._orientation);\n }\n\n /**\n * Handle the `'pointerup'` event for the document.\n */\n private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse release.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if no drag is in progress.\n const data = this._dragData;\n if (!data) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Remove the extra mouse event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Handle a release when the drag is not active.\n if (!data.dragActive) {\n // Clear the drag data.\n this._dragData = null;\n\n // Handle clicking the add button.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n if (addButtonClicked) {\n this._addRequested.emit(undefined);\n return;\n }\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the released tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the release is not on the original pressed tab.\n if (index !== data.index) {\n return;\n }\n\n // Ignore the release if the title is not closable.\n let title = this._titles[index];\n if (!title.closable) {\n return;\n }\n\n // Emit the close requested signal if the middle button is released.\n if (event.button === 1) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Emit the close requested signal if the close icon was released.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Otherwise, there is nothing left to do.\n return;\n }\n\n // Do nothing if the left button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Position the tab at its final resting position.\n Private.finalizeTabPosition(data, this._orientation);\n\n // Remove the dragging class from the tab so it can be transitioned.\n data.tab.classList.remove('lm-mod-dragging');\n\n // Parse the transition duration for releasing the tab.\n let duration = Private.parseTransitionDuration(data.tab);\n\n // Complete the release on a timer to allow the tab to transition.\n setTimeout(() => {\n // Do nothing if the drag has been aborted.\n if (data.dragAborted) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Reset the positions of the tabs.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor grab.\n data.override!.dispose();\n\n // Remove the remaining dragging style.\n this.removeClass('lm-mod-dragging');\n\n // If the tab was not moved, there is nothing else to do.\n let i = data.index;\n let j = data.targetIndex;\n if (j === -1 || i === j) {\n return;\n }\n\n // Move the title to the new locations.\n ArrayExt.move(this._titles, i, j);\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Emit the tab moved signal.\n this._tabMoved.emit({\n fromIndex: i,\n toIndex: j,\n title: this._titles[j]\n });\n\n // Update the tabs immediately to prevent flicker.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n }, duration);\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n */\n private _releaseMouse(): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Remove the extra document event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Indicate the drag has been aborted. This allows the mouse\n // event handlers to return early when the drag is canceled.\n data.dragAborted = true;\n\n // If the drag is not active, there's nothing more to do.\n if (!data.dragActive) {\n return;\n }\n\n // Reset the tabs to their non-dragged positions.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor override.\n data.override!.dispose();\n\n // Clear the dragging style classes.\n data.tab.classList.remove('lm-mod-dragging');\n this.removeClass('lm-mod-dragging');\n }\n\n /**\n * Adjust the current index for a tab insert operation.\n *\n * This method accounts for the tab bar's insertion behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForInsert(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ct = this.currentTitle;\n let ci = this._currentIndex;\n let bh = this.insertBehavior;\n\n // TODO: do we need to do an update to update the aria-selected attribute?\n\n // Handle the behavior where the new tab is always selected,\n // or the behavior where the new tab is selected if needed.\n if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n this._currentIndex = i;\n this._previousTitle = ct;\n this._currentChanged.emit({\n previousIndex: ci,\n previousTitle: ct,\n currentIndex: i,\n currentTitle: title\n });\n return;\n }\n\n // Otherwise, silently adjust the current index if needed.\n if (ci >= i) {\n this._currentIndex++;\n }\n }\n\n /**\n * Adjust the current index for a tab move operation.\n *\n * This method will not cause the actual current tab to change.\n * It silently adjusts the index to account for the given move.\n */\n private _adjustCurrentForMove(i: number, j: number): void {\n if (this._currentIndex === i) {\n this._currentIndex = j;\n } else if (this._currentIndex < i && this._currentIndex >= j) {\n this._currentIndex++;\n } else if (this._currentIndex > i && this._currentIndex <= j) {\n this._currentIndex--;\n }\n }\n\n /**\n * Adjust the current index for a tab remove operation.\n *\n * This method accounts for the tab bar's remove behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForRemove(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ci = this._currentIndex;\n let bh = this.removeBehavior;\n\n // Silently adjust the index if the current tab is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._currentIndex--;\n }\n return;\n }\n\n // TODO: do we need to do an update to adjust the aria-selected value?\n\n // No tab gets selected if the tab bar is empty.\n if (this._titles.length === 0) {\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n return;\n }\n\n // Handle behavior where the next sibling tab is selected.\n if (bh === 'select-tab-after') {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous sibling tab is selected.\n if (bh === 'select-tab-before') {\n this._currentIndex = Math.max(0, i - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous history tab is selected.\n if (bh === 'select-previous-tab') {\n if (this._previousTitle) {\n this._currentIndex = this._titles.indexOf(this._previousTitle);\n this._previousTitle = null;\n } else {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n }\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Otherwise, no tab gets selected.\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n this.update();\n }\n\n private _name: string;\n private _currentIndex = -1;\n private _titles: Title[] = [];\n private _orientation: TabBar.Orientation;\n private _document: Document | ShadowRoot;\n private _titlesEditable: boolean = false;\n private _previousTitle: Title | null = null;\n private _dragData: Private.IDragData | null = null;\n private _addButtonEnabled: boolean = false;\n private _tabMoved = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n private _addRequested = new Signal(this);\n private _tabCloseRequested = new Signal<\n this,\n TabBar.ITabCloseRequestedArgs\n >(this);\n private _tabDetachRequested = new Signal<\n this,\n TabBar.ITabDetachRequestedArgs\n >(this);\n private _tabActivateRequested = new Signal<\n this,\n TabBar.ITabActivateRequestedArgs\n >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n /**\n * A type alias for a tab bar orientation.\n */\n export type Orientation =\n | /**\n * The tabs are arranged in a single row, left-to-right.\n *\n * The tab text orientation is horizontal.\n */\n 'horizontal'\n\n /**\n * The tabs are arranged in a single column, top-to-bottom.\n *\n * The tab text orientation is horizontal.\n */\n | 'vertical';\n\n /**\n * A type alias for the selection behavior on tab insert.\n */\n export type InsertBehavior =\n | /**\n * The selected tab will not be changed.\n */\n 'none'\n\n /**\n * The inserted tab will be selected.\n */\n | 'select-tab'\n\n /**\n * The inserted tab will be selected if the current tab is null.\n */\n | 'select-tab-if-needed';\n\n /**\n * A type alias for the selection behavior on tab remove.\n */\n export type RemoveBehavior =\n | /**\n * No tab will be selected.\n */\n 'none'\n\n /**\n * The tab after the removed tab will be selected if possible.\n */\n | 'select-tab-after'\n\n /**\n * The tab before the removed tab will be selected if possible.\n */\n | 'select-tab-before'\n\n /**\n * The previously selected tab will be selected if possible.\n */\n | 'select-previous-tab';\n\n /**\n * An options object for creating a tab bar.\n */\n export interface IOptions {\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n\n /**\n * Name of the tab bar.\n *\n * This is used for accessibility reasons. The default is the empty string.\n */\n name?: string;\n\n /**\n * The layout orientation of the tab bar.\n *\n * The default is `horizontal`.\n */\n orientation?: TabBar.Orientation;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * The default is `false`.\n */\n allowDeselect?: boolean;\n\n /**\n * Whether the titles can be directly edited by the user.\n *\n * The default is `false`.\n */\n titlesEditable?: boolean;\n\n /**\n * Whether the add button is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n *\n * The default is `'select-tab-if-needed'`.\n */\n insertBehavior?: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n *\n * The default is `'select-tab-after'`.\n */\n removeBehavior?: TabBar.RemoveBehavior;\n\n /**\n * A renderer to use with the tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n readonly previousIndex: number;\n\n /**\n * The previously selected title.\n */\n readonly previousTitle: Title | null;\n\n /**\n * The currently selected index.\n */\n readonly currentIndex: number;\n\n /**\n * The currently selected title.\n */\n readonly currentTitle: Title | null;\n }\n\n /**\n * The arguments object for the `tabMoved` signal.\n */\n export interface ITabMovedArgs {\n /**\n * The previous index of the tab.\n */\n readonly fromIndex: number;\n\n /**\n * The current index of the tab.\n */\n readonly toIndex: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabActivateRequested` signal.\n */\n export interface ITabActivateRequestedArgs {\n /**\n * The index of the tab to activate.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabCloseRequested` signal.\n */\n export interface ITabCloseRequestedArgs {\n /**\n * The index of the tab to close.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabDetachRequested` signal.\n */\n export interface ITabDetachRequestedArgs {\n /**\n * The index of the tab to detach.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n\n /**\n * The node representing the tab.\n */\n readonly tab: HTMLElement;\n\n /**\n * The current client X position of the mouse.\n */\n readonly clientX: number;\n\n /**\n * The current client Y position of the mouse.\n */\n readonly clientY: number;\n\n /**\n * The mouse position in the tab coordinate.\n */\n readonly offset?: { x: number; y: number };\n }\n\n /**\n * An object which holds the data to render a tab.\n */\n export interface IRenderData {\n /**\n * The title associated with the tab.\n */\n readonly title: Title;\n\n /**\n * Whether the tab is the current tab.\n */\n readonly current: boolean;\n\n /**\n * The z-index for the tab.\n */\n readonly zIndex: number;\n\n /**\n * The tabindex value for the tab.\n */\n readonly tabIndex?: number;\n }\n\n /**\n * A renderer for use with a tab bar.\n */\n export interface IRenderer {\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector: string;\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n constructor() {\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement {\n let title = data.title.caption;\n let key = this.createTabKey(data);\n let id = key;\n let style = this.createTabStyle(data);\n let className = this.createTabClass(data);\n let dataset = this.createTabDataset(data);\n let aria = this.createTabARIA(data);\n if (data.title.closable) {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderCloseIcon(data)\n );\n } else {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n }\n\n /**\n * Render the icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n const { title } = data;\n let className = this.createIconClass(data);\n\n // If title.icon is undefined, it will be ignored.\n return h.div({ className }, title.icon!, title.iconLabel);\n }\n\n /**\n * Render the label element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n }\n\n /**\n * Render the close icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab close icon.\n */\n renderCloseIcon(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n }\n\n /**\n * Create a unique render key for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The unique render key for the tab.\n *\n * #### Notes\n * This method caches the key against the tab title the first time\n * the key is generated. This enables efficient rendering of moved\n * tabs and avoids subtle hover style artifacts.\n */\n createTabKey(data: IRenderData): string {\n let key = this._tabKeys.get(data.title);\n if (key === undefined) {\n key = `tab-key-${this._uuid}-${this._tabID++}`;\n this._tabKeys.set(data.title, key);\n }\n return key;\n }\n\n /**\n * Create the inline style object for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The inline style data for the tab.\n */\n createTabStyle(data: IRenderData): ElementInlineStyle {\n return { zIndex: `${data.zIndex}` };\n }\n\n /**\n * Create the class name for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab.\n */\n createTabClass(data: IRenderData): string {\n let name = 'lm-TabBar-tab';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.title.closable) {\n name += ' lm-mod-closable';\n }\n if (data.current) {\n name += ' lm-mod-current';\n }\n return name;\n }\n\n /**\n * Create the dataset for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The dataset for the tab.\n */\n createTabDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the ARIA attributes for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The ARIA attributes for the tab.\n */\n createTabARIA(data: IRenderData): ElementARIAAttrs | ElementBaseAttrs {\n return {\n role: 'tab',\n 'aria-selected': data.current.toString(),\n tabindex: `${data.tabIndex ?? '-1'}`\n };\n }\n\n /**\n * Create the class name for the tab icon.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-TabBar-tabIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _tabID = 0;\n private _tabKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * A selector which matches the add button node in the tab bar.\n */\n export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The start drag distance threshold.\n */\n export const DRAG_THRESHOLD = 5;\n\n /**\n * The detach distance threshold.\n */\n export const DETACH_THRESHOLD = 20;\n\n /**\n * A struct which holds the drag data for a tab bar.\n */\n export interface IDragData {\n /**\n * The tab node being dragged.\n */\n tab: HTMLElement;\n\n /**\n * The index of the tab being dragged.\n */\n index: number;\n\n /**\n * The mouse press client X position.\n */\n pressX: number;\n\n /**\n * The mouse press client Y position.\n */\n pressY: number;\n\n /**\n * The offset left/top of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPos: number;\n\n /**\n * The offset width/height of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabSize: number;\n\n /**\n * The original mouse X/Y position in tab coordinates.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPressPos: number;\n\n /**\n * The original mouse position in tab coordinates.\n *\n * This is undefined if the drag is not active.\n */\n tabPressOffset?: { x: number; y: number };\n\n /**\n * The tab target index upon mouse release.\n *\n * This will be `-1` if the drag is not active.\n */\n targetIndex: number;\n\n /**\n * The array of tab layout objects snapped at drag start.\n *\n * This will be `null` if the drag is not active.\n */\n tabLayout: ITabLayout[] | null;\n\n /**\n * The bounding client rect of the tab bar content node.\n *\n * This will be `null` if the drag is not active.\n */\n contentRect: DOMRect | null;\n\n /**\n * The disposable to clean up the cursor override.\n *\n * This will be `null` if the drag is not active.\n */\n override: IDisposable | null;\n\n /**\n * Whether the drag is currently active.\n */\n dragActive: boolean;\n\n /**\n * Whether the drag has been aborted.\n */\n dragAborted: boolean;\n\n /**\n * Whether a detach request as been made.\n */\n detachRequested: boolean;\n }\n\n /**\n * An object which holds layout data for a tab.\n */\n export interface ITabLayout {\n /**\n * The left/top margin value for the tab.\n */\n margin: number;\n\n /**\n * The offset left/top position of the tab.\n */\n pos: number;\n\n /**\n * The offset width/height of the tab.\n */\n size: number;\n }\n\n /**\n * Create the DOM node for a tab bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.setAttribute('role', 'tablist');\n content.className = 'lm-TabBar-content';\n node.appendChild(content);\n\n let add = document.createElement('div');\n add.className = 'lm-TabBar-addButton lm-mod-hidden';\n add.setAttribute('tabindex', '-1');\n add.setAttribute('role', 'button');\n node.appendChild(add);\n return node;\n }\n\n /**\n * Coerce a title or options into a real title.\n */\n export function asTitle(value: Title | Title.IOptions): Title {\n return value instanceof Title ? value : new Title(value);\n }\n\n /**\n * Parse the transition duration for a tab node.\n */\n export function parseTransitionDuration(tab: HTMLElement): number {\n let style = window.getComputedStyle(tab);\n return 1000 * (parseFloat(style.transitionDuration!) || 0);\n }\n\n /**\n * Get a snapshot of the current tab layout values.\n */\n export function snapTabLayout(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): ITabLayout[] {\n let layout = new Array(tabs.length);\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let node = tabs[i] as HTMLElement;\n let style = window.getComputedStyle(node);\n if (orientation === 'horizontal') {\n layout[i] = {\n pos: node.offsetLeft,\n size: node.offsetWidth,\n margin: parseFloat(style.marginLeft!) || 0\n };\n } else {\n layout[i] = {\n pos: node.offsetTop,\n size: node.offsetHeight,\n margin: parseFloat(style.marginTop!) || 0\n };\n }\n }\n return layout;\n }\n\n /**\n * Test if the event exceeds the drag threshold.\n */\n export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n let dx = Math.abs(event.clientX - data.pressX);\n let dy = Math.abs(event.clientY - data.pressY);\n return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n }\n\n /**\n * Test if the event exceeds the drag detach threshold.\n */\n export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n let rect = data.contentRect!;\n return (\n event.clientX < rect.left - DETACH_THRESHOLD ||\n event.clientX >= rect.right + DETACH_THRESHOLD ||\n event.clientY < rect.top - DETACH_THRESHOLD ||\n event.clientY >= rect.bottom + DETACH_THRESHOLD\n );\n }\n\n /**\n * Update the relative tab positions and computed target index.\n */\n export function layoutTabs(\n tabs: HTMLCollection,\n data: IDragData,\n event: MouseEvent,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive values.\n let pressPos: number;\n let localPos: number;\n let clientPos: number;\n let clientSize: number;\n if (orientation === 'horizontal') {\n pressPos = data.pressX;\n localPos = event.clientX - data.contentRect!.left;\n clientPos = event.clientX;\n clientSize = data.contentRect!.width;\n } else {\n pressPos = data.pressY;\n localPos = event.clientY - data.contentRect!.top;\n clientPos = event.clientY;\n clientSize = data.contentRect!.height;\n }\n\n // Compute the target data.\n let targetIndex = data.index;\n let targetPos = localPos - data.tabPressPos;\n let targetEnd = targetPos + data.tabSize;\n\n // Update the relative tab positions.\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let pxPos: string;\n let layout = data.tabLayout![i];\n let threshold = layout.pos + (layout.size >> 1);\n if (i < data.index && targetPos < threshold) {\n pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n targetIndex = Math.min(targetIndex, i);\n } else if (i > data.index && targetEnd > threshold) {\n pxPos = `${-data.tabSize - layout.margin}px`;\n targetIndex = Math.max(targetIndex, i);\n } else if (i === data.index) {\n let ideal = clientPos - pressPos;\n let limit = clientSize - (data.tabPos + data.tabSize);\n pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n } else {\n pxPos = '';\n }\n if (orientation === 'horizontal') {\n (tabs[i] as HTMLElement).style.left = pxPos;\n } else {\n (tabs[i] as HTMLElement).style.top = pxPos;\n }\n }\n\n // Update the computed target index.\n data.targetIndex = targetIndex;\n }\n\n /**\n * Position the drag tab at its final resting relative position.\n */\n export function finalizeTabPosition(\n data: IDragData,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive client size.\n let clientSize: number;\n if (orientation === 'horizontal') {\n clientSize = data.contentRect!.width;\n } else {\n clientSize = data.contentRect!.height;\n }\n\n // Compute the ideal final tab position.\n let ideal: number;\n if (data.targetIndex === data.index) {\n ideal = 0;\n } else if (data.targetIndex > data.index) {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n } else {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos - data.tabPos;\n }\n\n // Compute the tab position limit.\n let limit = clientSize - (data.tabPos + data.tabSize);\n let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n // Set the final orientation-sensitive position.\n if (orientation === 'horizontal') {\n data.tab.style.left = `${final}px`;\n } else {\n data.tab.style.top = `${final}px`;\n }\n }\n\n /**\n * Reset the relative positions of the given tabs.\n */\n export function resetTabPositions(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): void {\n for (const tab of tabs) {\n if (orientation === 'horizontal') {\n (tab as HTMLElement).style.left = '';\n } else {\n (tab as HTMLElement).style.top = '';\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n /**\n * Construct a new dock layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: DockLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n this._document = options.document || document;\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n */\n dispose(): void {\n // Get an iterator over the widgets in the layout.\n let widgets = this[Symbol.iterator]();\n\n // Dispose of the layout items.\n this._items.forEach(item => {\n item.dispose();\n });\n\n // Clear the layout state before disposing the widgets.\n this._box = null;\n this._root = null;\n this._items.clear();\n\n // Dispose of the widgets contained in the old layout root.\n for (const widget of widgets) {\n widget.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The renderer used by the dock layout.\n */\n readonly renderer: DockLayout.IRenderer;\n\n /**\n * The method for hiding child widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n for (const bar of this.tabBars()) {\n if (bar.titles.length > 1) {\n for (const title of bar.titles) {\n title.owner.hiddenMode = this._hiddenMode;\n }\n }\n }\n }\n\n /**\n * Get the inter-element spacing for the dock layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the dock layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Whether the dock layout is empty.\n */\n get isEmpty(): boolean {\n return this._root === null;\n }\n\n /**\n * Create an iterator over all widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This iterator includes the generated tab bars.\n */\n [Symbol.iterator](): IterableIterator {\n return this._root ? this._root.iterAllWidgets() : empty();\n }\n\n /**\n * Create an iterator over the user widgets in the layout.\n *\n * @returns A new iterator over the user widgets in the layout.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n widgets(): IterableIterator {\n return this._root ? this._root.iterUserWidgets() : empty();\n }\n\n /**\n * Create an iterator over the selected widgets in the layout.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the layout.\n */\n selectedWidgets(): IterableIterator {\n return this._root ? this._root.iterSelectedWidgets() : empty();\n }\n\n /**\n * Create an iterator over the tab bars in the layout.\n *\n * @returns A new iterator over the tab bars in the layout.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n tabBars(): IterableIterator> {\n return this._root ? this._root.iterTabBars() : empty();\n }\n\n /**\n * Create an iterator over the handles in the layout.\n *\n * @returns A new iterator over the handles in the layout.\n */\n handles(): IterableIterator {\n return this._root ? this._root.iterHandles() : empty();\n }\n\n /**\n * Move a handle to the given offset position.\n *\n * @param handle - The handle to move.\n *\n * @param offsetX - The desired offset X position of the handle.\n *\n * @param offsetY - The desired offset Y position of the handle.\n *\n * #### Notes\n * If the given handle is not contained in the layout, this is no-op.\n *\n * The handle will be moved as close as possible to the desired\n * position without violating any of the layout constraints.\n *\n * Only one of the coordinates is used depending on the orientation\n * of the handle. This method accepts both coordinates to make it\n * easy to invoke from a mouse move event without needing to know\n * the handle orientation.\n */\n moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n // Bail early if there is no root or if the handle is hidden.\n let hidden = handle.classList.contains('lm-mod-hidden');\n if (!this._root || hidden) {\n return;\n }\n\n // Lookup the split node for the handle.\n let data = this._root.findSplitNode(handle);\n if (!data) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (data.node.orientation === 'horizontal') {\n delta = offsetX - handle.offsetLeft;\n } else {\n delta = offsetY - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent sibling resizing unless needed.\n data.node.holdSizes();\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Save the current configuration of the dock layout.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockLayout.ILayoutConfig {\n // Bail early if there is no root.\n if (!this._root) {\n return { main: null };\n }\n\n // Hold the current sizes in the layout tree.\n this._root.holdAllSizes();\n\n // Return the layout config.\n return { main: this._root.createConfig() };\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n */\n restoreLayout(config: DockLayout.ILayoutConfig): void {\n // Create the widget set for validating the config.\n let widgetSet = new Set();\n\n // Normalize the main area config and collect the widgets.\n let mainConfig: DockLayout.AreaConfig | null;\n if (config.main) {\n mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n } else {\n mainConfig = null;\n }\n\n // Create iterators over the old content.\n let oldWidgets = this.widgets();\n let oldTabBars = this.tabBars();\n let oldHandles = this.handles();\n\n // Clear the root before removing the old content.\n this._root = null;\n\n // Unparent the old widgets which are not in the new config.\n for (const widget of oldWidgets) {\n if (!widgetSet.has(widget)) {\n widget.parent = null;\n }\n }\n\n // Dispose of the old tab bars.\n for (const tabBar of oldTabBars) {\n tabBar.dispose();\n }\n\n // Remove the old handles.\n for (const handle of oldHandles) {\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n }\n\n // Reparent the new widgets to the current parent.\n for (const widget of widgetSet) {\n widget.parent = this.parent;\n }\n\n // Create the root node for the new config.\n if (mainConfig) {\n this._root = Private.realizeAreaConfig(\n mainConfig,\n {\n // Ignoring optional `document` argument as we must reuse `this._document`\n createTabBar: (document?: Document | ShadowRoot) =>\n this._createTabBar(),\n createHandle: () => this._createHandle()\n },\n this._document\n );\n } else {\n this._root = null;\n }\n\n // If there is no parent, there is nothing more to do.\n if (!this.parent) {\n return;\n }\n\n // Attach the new widgets to the parent.\n widgetSet.forEach(widget => {\n this.attachWidget(widget);\n });\n\n // Post a fit request to the parent.\n this.parent.fit();\n }\n\n /**\n * Add a widget to the dock layout.\n *\n * @param widget - The widget to add to the dock layout.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * The widget will be moved if it is already contained in the layout.\n *\n * An error will be thrown if the reference widget is invalid.\n */\n addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n // Parse the options.\n let ref = options.ref || null;\n let mode = options.mode || 'tab-after';\n\n // Find the tab node which holds the reference widget.\n let refNode: Private.TabLayoutNode | null = null;\n if (this._root && ref) {\n refNode = this._root.findTabNode(ref);\n }\n\n // Throw an error if the reference widget is invalid.\n if (ref && !refNode) {\n throw new Error('Reference widget is not in the layout.');\n }\n\n // Reparent the widget to the current layout parent.\n widget.parent = this.parent;\n\n // Insert the widget according to the insert mode.\n switch (mode) {\n case 'tab-after':\n this._insertTab(widget, ref, refNode, true);\n break;\n case 'tab-before':\n this._insertTab(widget, ref, refNode, false);\n break;\n case 'split-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false);\n break;\n case 'split-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false);\n break;\n case 'split-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true);\n break;\n case 'split-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true);\n break;\n case 'merge-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n break;\n case 'merge-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n break;\n case 'merge-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n break;\n case 'merge-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n break;\n }\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Ensure the widget is attached to the parent widget.\n this.attachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Remove the widget from its current layout location.\n this._removeWidget(widget);\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Detach the widget from the parent widget.\n this.detachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Find the tab area which contains the given client position.\n *\n * @param clientX - The client X position of interest.\n *\n * @param clientY - The client Y position of interest.\n *\n * @returns The geometry of the tab area at the given position, or\n * `null` if there is no tab area at the given position.\n */\n hitTestTabAreas(\n clientX: number,\n clientY: number\n ): DockLayout.ITabAreaGeometry | null {\n // Bail early if hit testing cannot produce valid results.\n if (!this._root || !this.parent || !this.parent.isVisible) {\n return null;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent.node);\n }\n\n // Convert from client to local coordinates.\n let rect = this.parent.node.getBoundingClientRect();\n let x = clientX - rect.left - this._box.borderLeft;\n let y = clientY - rect.top - this._box.borderTop;\n\n // Find the tab layout node at the local position.\n let tabNode = this._root.hitTestTabNodes(x, y);\n\n // Bail if a tab layout node was not found.\n if (!tabNode) {\n return null;\n }\n\n // Extract the data from the tab node.\n let { tabBar, top, left, width, height } = tabNode;\n\n // Compute the right and bottom edges of the tab area.\n let borderWidth = this._box.borderLeft + this._box.borderRight;\n let borderHeight = this._box.borderTop + this._box.borderBottom;\n let right = rect.width - borderWidth - (left + width);\n let bottom = rect.height - borderHeight - (top + height);\n\n // Return the hit test results.\n return { tabBar, x, y, top, left, right, bottom, width, height };\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n // Perform superclass initialization.\n super.init();\n\n // Attach each widget to the parent.\n for (const widget of this) {\n this.attachWidget(widget);\n }\n\n // Attach each handle to the parent.\n for (const handle of this.handles()) {\n this.parent!.node.appendChild(handle);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Attach the widget to the layout parent widget.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a no-op if the widget is already attached.\n */\n protected attachWidget(widget: Widget): void {\n // Do nothing if the widget is already attached.\n if (this.parent!.node === widget.node.parentNode) {\n return;\n }\n\n // Create the layout item for the widget.\n this._items.set(widget, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach the widget from the layout parent widget.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a no-op if the widget is not attached.\n */\n protected detachWidget(widget: Widget): void {\n // Do nothing if the widget is not attached.\n if (this.parent!.node !== widget.node.parentNode) {\n return;\n }\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Delete the layout item for the widget.\n let item = this._items.get(widget);\n if (item) {\n this._items.delete(widget);\n item.dispose();\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Remove the specified widget from the layout structure.\n *\n * #### Notes\n * This is a no-op if the widget is not in the layout tree.\n *\n * This does not detach the widget from the parent node.\n */\n private _removeWidget(widget: Widget): void {\n // Bail early if there is no layout root.\n if (!this._root) {\n return;\n }\n\n // Find the tab node which contains the given widget.\n let tabNode = this._root.findTabNode(widget);\n\n // Bail early if the tab node is not found.\n if (!tabNode) {\n return;\n }\n\n Private.removeAria(widget);\n\n // If there are multiple tabs, just remove the widget's tab.\n if (tabNode.tabBar.titles.length > 1) {\n tabNode.tabBar.removeTab(widget.title);\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n tabNode.tabBar.titles.length == 1\n ) {\n const existingWidget = tabNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Display;\n }\n return;\n }\n\n // Otherwise, the tab node needs to be removed...\n\n // Dispose the tab bar.\n tabNode.tabBar.dispose();\n\n // Handle the case where the tab node is the root.\n if (this._root === tabNode) {\n this._root = null;\n return;\n }\n\n // Otherwise, remove the tab node from its parent...\n\n // Prevent widget resizing unless needed.\n this._root.holdAllSizes();\n\n // Clear the parent reference on the tab node.\n let splitNode = tabNode.parent!;\n tabNode.parent = null;\n\n // Remove the tab node from its parent split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n ArrayExt.removeAt(splitNode.sizers, i);\n\n // Remove the handle from its parent DOM node.\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n\n // If there are multiple children, just update the handles.\n if (splitNode.children.length > 1) {\n splitNode.syncHandles();\n return;\n }\n\n // Otherwise, the split node also needs to be removed...\n\n // Clear the parent reference on the split node.\n let maybeParent = splitNode.parent;\n splitNode.parent = null;\n\n // Lookup the remaining child node and handle.\n let childNode = splitNode.children[0];\n let childHandle = splitNode.handles[0];\n\n // Clear the split node data.\n splitNode.children.length = 0;\n splitNode.handles.length = 0;\n splitNode.sizers.length = 0;\n\n // Remove the child handle from its parent node.\n if (childHandle.parentNode) {\n childHandle.parentNode.removeChild(childHandle);\n }\n\n // Handle the case where the split node is the root.\n if (this._root === splitNode) {\n childNode.parent = null;\n this._root = childNode;\n return;\n }\n\n // Otherwise, move the child node to the parent node...\n let parentNode = maybeParent!;\n\n // Lookup the index of the split node.\n let j = parentNode.children.indexOf(splitNode);\n\n // Handle the case where the child node is a tab node.\n if (childNode instanceof Private.TabLayoutNode) {\n childNode.parent = parentNode;\n parentNode.children[j] = childNode;\n return;\n }\n\n // Remove the split data from the parent.\n let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n ArrayExt.removeAt(parentNode.children, j);\n ArrayExt.removeAt(parentNode.sizers, j);\n\n // Remove the handle from its parent node.\n if (splitHandle.parentNode) {\n splitHandle.parentNode.removeChild(splitHandle);\n }\n\n // The child node and the split parent node will have the same\n // orientation. Merge the grand-children with the parent node.\n for (let i = 0, n = childNode.children.length; i < n; ++i) {\n let gChild = childNode.children[i];\n let gHandle = childNode.handles[i];\n let gSizer = childNode.sizers[i];\n ArrayExt.insert(parentNode.children, j + i, gChild);\n ArrayExt.insert(parentNode.handles, j + i, gHandle);\n ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n gChild.parent = parentNode;\n }\n\n // Clear the child node.\n childNode.children.length = 0;\n childNode.handles.length = 0;\n childNode.sizers.length = 0;\n childNode.parent = null;\n\n // Sync the handles on the parent node.\n parentNode.syncHandles();\n }\n\n /**\n * Create the tab layout node to hold the widget.\n */\n private _createTabNode(widget: Widget): Private.TabLayoutNode {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n Private.addAria(widget, tabNode.tabBar);\n return tabNode;\n }\n\n /**\n * Insert a widget next to an existing tab.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertTab(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n after: boolean\n ): void {\n // Do nothing if the tab is inserted next to itself.\n if (widget === ref) {\n return;\n }\n\n // Create the root if it does not exist.\n if (!this._root) {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n this._root = tabNode;\n Private.addAria(widget, tabNode.tabBar);\n return;\n }\n\n // Use the first tab node as the ref node if needed.\n if (!refNode) {\n refNode = this._root.findFirstTabNode()!;\n }\n\n // If the widget is not contained in the ref node, ensure it is\n // removed from the layout and hidden before being added again.\n if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n this._removeWidget(widget);\n widget.hide();\n }\n\n // Lookup the target index for inserting the tab.\n let index: number;\n if (ref) {\n index = refNode.tabBar.titles.indexOf(ref.title);\n } else {\n index = refNode.tabBar.currentIndex;\n }\n\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n if (refNode.tabBar.titles.length === 0) {\n // Singular tab should use display mode to limit number of layers.\n widget.hiddenMode = Widget.HiddenMode.Display;\n } else if (refNode.tabBar.titles.length == 1) {\n // If we are adding a second tab, switch the existing tab back to scale.\n const existingWidget = refNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n // For the third and subsequent tabs no special action is needed.\n widget.hiddenMode = Widget.HiddenMode.Scale;\n }\n } else {\n // For all other modes just propagate the current mode.\n widget.hiddenMode = this._hiddenMode;\n }\n\n // Insert the widget's tab relative to the target index.\n refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n Private.addAria(widget, refNode.tabBar);\n }\n\n /**\n * Insert a widget as a new split area.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertSplit(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n orientation: Private.Orientation,\n after: boolean,\n merge: boolean = false\n ): void {\n // Do nothing if there is no effective split.\n if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n return;\n }\n\n // Ensure the widget is removed from the current layout.\n this._removeWidget(widget);\n\n // Set the root if it does not exist.\n if (!this._root) {\n this._root = this._createTabNode(widget);\n return;\n }\n\n // If the ref node parent is null, split the root.\n if (!refNode || !refNode.parent) {\n // Ensure the root is split with the correct orientation.\n let root = this._splitRoot(orientation);\n\n // Determine the insert index for the new tab node.\n let i = after ? root.children.length : 0;\n\n // Normalize the split node.\n root.normalizeSizes();\n\n // Create the sizer for new tab node.\n let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n // Insert the tab node sized to the golden ratio.\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(root.children, i, tabNode);\n ArrayExt.insert(root.sizers, i, sizer);\n ArrayExt.insert(root.handles, i, this._createHandle());\n tabNode.parent = root;\n\n // Re-normalize the split node to maintain the ratios.\n root.normalizeSizes();\n\n // Finally, synchronize the visibility of the handles.\n root.syncHandles();\n return;\n }\n\n // Lookup the split node for the ref widget.\n let splitNode = refNode.parent;\n\n // If the split node already had the correct orientation,\n // the widget can be inserted into the split node directly.\n if (splitNode.orientation === orientation) {\n // Find the index of the ref node.\n let i = splitNode.children.indexOf(refNode);\n\n // Conditionally reuse a tab layout found in the wanted position.\n if (merge) {\n let j = i + (after ? 1 : -1);\n let sibling = splitNode.children[j];\n if (sibling instanceof Private.TabLayoutNode) {\n this._insertTab(widget, null, sibling, true);\n ++sibling.tabBar.currentIndex;\n return;\n }\n }\n\n // Normalize the split node.\n splitNode.normalizeSizes();\n\n // Consume half the space for the insert location.\n let s = (splitNode.sizers[i].sizeHint /= 2);\n\n // Insert the tab node sized to the other half.\n let j = i + (after ? 1 : 0);\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(splitNode.children, j, tabNode);\n ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n ArrayExt.insert(splitNode.handles, j, this._createHandle());\n tabNode.parent = splitNode;\n\n // Finally, synchronize the visibility of the handles.\n splitNode.syncHandles();\n return;\n }\n\n // Remove the ref node from the split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n // Create a new normalized split node for the children.\n let childNode = new Private.SplitLayoutNode(orientation);\n childNode.normalized = true;\n\n // Add the ref node sized to half the space.\n childNode.children.push(refNode);\n childNode.sizers.push(Private.createSizer(0.5));\n childNode.handles.push(this._createHandle());\n refNode.parent = childNode;\n\n // Add the tab node sized to the other half.\n let j = after ? 1 : 0;\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(childNode.children, j, tabNode);\n ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n ArrayExt.insert(childNode.handles, j, this._createHandle());\n tabNode.parent = childNode;\n\n // Synchronize the visibility of the handles.\n childNode.syncHandles();\n\n // Finally, add the new child node to the original split node.\n ArrayExt.insert(splitNode.children, i, childNode);\n childNode.parent = splitNode;\n }\n\n /**\n * Ensure the root is a split node with the given orientation.\n */\n private _splitRoot(\n orientation: Private.Orientation\n ): Private.SplitLayoutNode {\n // Bail early if the root already meets the requirements.\n let oldRoot = this._root;\n if (oldRoot instanceof Private.SplitLayoutNode) {\n if (oldRoot.orientation === orientation) {\n return oldRoot;\n }\n }\n\n // Create a new root node with the specified orientation.\n let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n // Add the old root to the new root.\n if (oldRoot) {\n newRoot.children.push(oldRoot);\n newRoot.sizers.push(Private.createSizer(0));\n newRoot.handles.push(this._createHandle());\n oldRoot.parent = newRoot;\n }\n\n // Return the new root as a convenience.\n return newRoot;\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the size limits for the layout tree.\n if (this._root) {\n let limits = this._root.fit(this._spacing, this._items);\n minW = limits.minWidth;\n minH = limits.minHeight;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Bail early if there is no root layout node.\n if (!this._root) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let x = this._box.paddingTop;\n let y = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the geometry of the layout tree.\n this._root.update(x, y, width, height, this._spacing, this._items);\n }\n\n /**\n * Create a new tab bar for use by the dock layout.\n *\n * #### Notes\n * The tab bar will be attached to the parent if it exists.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar using the renderer.\n let tabBar = this.renderer.createTabBar(this._document);\n\n // Enforce necessary tab bar behavior.\n tabBar.orientation = 'horizontal';\n\n // Attach the tab bar to the parent if possible.\n if (this.parent) {\n this.attachWidget(tabBar);\n }\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for the dock layout.\n *\n * #### Notes\n * The handle will be attached to the parent if it exists.\n */\n private _createHandle(): HTMLDivElement {\n // Create the handle using the renderer.\n let handle = this.renderer.createHandle();\n\n // Initialize the handle layout behavior.\n let style = handle.style;\n style.position = 'absolute';\n style.contain = 'strict';\n style.top = '0';\n style.left = '0';\n style.width = '0';\n style.height = '0';\n\n // Attach the handle to the parent if it exists.\n if (this.parent) {\n this.parent.node.appendChild(handle);\n }\n\n // Return the initialized handle.\n return handle;\n }\n\n private _spacing = 4;\n private _dirty = false;\n private _root: Private.LayoutNode | null = null;\n private _box: ElementExt.IBoxSizing | null = null;\n private _document: Document | ShadowRoot;\n private _hiddenMode: Widget.HiddenMode;\n private _items: Private.ItemMap = new Map();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n /**\n * An options object for creating a dock layout.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * The renderer to use for the dock layout.\n */\n renderer: IRenderer;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a dock layout.\n */\n export interface IRenderer {\n /**\n * Create a new tab bar for use with a dock layout.\n *\n * @returns A new tab bar for a dock layout.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar;\n\n /**\n * Create a new handle node for use with a dock layout.\n *\n * @returns A new handle node for a dock layout.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * A type alias for the supported insertion modes.\n *\n * An insert mode is used to specify how a widget should be added\n * to the dock layout relative to a reference widget.\n */\n export type InsertMode =\n | /**\n * The area to the top of the reference widget.\n *\n * The widget will be inserted just above the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the top edge of the dock layout.\n */\n 'split-top'\n\n /**\n * The area to the left of the reference widget.\n *\n * The widget will be inserted just left of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the left edge of the dock layout.\n */\n | 'split-left'\n\n /**\n * The area to the right of the reference widget.\n *\n * The widget will be inserted just right of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the right edge of the dock layout.\n */\n | 'split-right'\n\n /**\n * The area to the bottom of the reference widget.\n *\n * The widget will be inserted just below the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the bottom edge of the dock layout.\n */\n | 'split-bottom'\n\n /**\n * Like `split-top` but if a tab layout exists above the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-top'\n\n /**\n * Like `split-left` but if a tab layout exists left of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-left'\n\n /**\n * Like `split-right` but if a tab layout exists right of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-right'\n\n /**\n * Like `split-bottom` but if a tab layout exists below the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-bottom'\n\n /**\n * The tab position before the reference widget.\n *\n * The widget will be added as a tab before the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-before'\n\n /**\n * The tab position after the reference widget.\n *\n * The widget will be added as a tab after the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-after';\n\n /**\n * An options object for adding a widget to the dock layout.\n */\n export interface IAddOptions {\n /**\n * The insertion mode for adding the widget.\n *\n * The default is `'tab-after'`.\n */\n mode?: InsertMode;\n\n /**\n * The reference widget for the insert location.\n *\n * The default is `null`.\n */\n ref?: Widget | null;\n }\n\n /**\n * A layout config object for a tab area.\n */\n export interface ITabAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'tab-area';\n\n /**\n * The widgets contained in the tab area.\n */\n widgets: Widget[];\n\n /**\n * The index of the selected tab.\n */\n currentIndex: number;\n }\n\n /**\n * A layout config object for a split area.\n */\n export interface ISplitAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'split-area';\n\n /**\n * The orientation of the split area.\n */\n orientation: 'horizontal' | 'vertical';\n\n /**\n * The children in the split area.\n */\n children: AreaConfig[];\n\n /**\n * The relative sizes of the children.\n */\n sizes: number[];\n }\n\n /**\n * A type alias for a general area config.\n */\n export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n /**\n * A dock layout configuration object.\n */\n export interface ILayoutConfig {\n /**\n * The layout config for the main dock area.\n */\n main: AreaConfig | null;\n }\n\n /**\n * An object which represents the geometry of a tab area.\n */\n export interface ITabAreaGeometry {\n /**\n * The tab bar for the tab area.\n */\n tabBar: TabBar;\n\n /**\n * The local X position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the local X coordinate of the hit test query.\n */\n x: number;\n\n /**\n * The local Y position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the local Y coordinate of the hit test query.\n */\n y: number;\n\n /**\n * The local coordinate of the top edge of the tab area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the top edge of the tab area.\n */\n top: number;\n\n /**\n * The local coordinate of the left edge of the tab area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the left edge of the tab area.\n */\n left: number;\n\n /**\n * The local coordinate of the right edge of the tab area.\n *\n * #### Notes\n * This is the distance from the right edge of the layout parent\n * widget, to the right edge of the tab area.\n */\n right: number;\n\n /**\n * The local coordinate of the bottom edge of the tab area.\n *\n * #### Notes\n * This is the distance from the bottom edge of the layout parent\n * widget, to the bottom edge of the tab area.\n */\n bottom: number;\n\n /**\n * The width of the tab area.\n *\n * #### Notes\n * This is total width allocated for the tab area.\n */\n width: number;\n\n /**\n * The height of the tab area.\n *\n * #### Notes\n * This is total height allocated for the tab area.\n */\n height: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * A type alias for a dock layout node.\n */\n export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n /**\n * A type alias for the orientation of a split layout node.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a layout item map.\n */\n export type ItemMap = Map;\n\n /**\n * Create a box sizer with an initial size hint.\n */\n export function createSizer(hint: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = hint;\n sizer.size = hint;\n return sizer;\n }\n\n /**\n * Normalize an area config object and collect the visited widgets.\n */\n export function normalizeAreaConfig(\n config: DockLayout.AreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n let result: DockLayout.AreaConfig | null;\n if (config.type === 'tab-area') {\n result = normalizeTabAreaConfig(config, widgetSet);\n } else {\n result = normalizeSplitAreaConfig(config, widgetSet);\n }\n return result;\n }\n\n /**\n * Convert a normalized area config into a layout tree.\n */\n export function realizeAreaConfig(\n config: DockLayout.AreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): LayoutNode {\n let node: LayoutNode;\n if (config.type === 'tab-area') {\n node = realizeTabAreaConfig(config, renderer, document);\n } else {\n node = realizeSplitAreaConfig(config, renderer, document);\n }\n return node;\n }\n\n /**\n * A layout node which holds the data for a tabbed area.\n */\n export class TabLayoutNode {\n /**\n * Construct a new tab layout node.\n *\n * @param tabBar - The tab bar to use for the layout node.\n */\n constructor(tabBar: TabBar) {\n let tabSizer = new BoxSizer();\n let widgetSizer = new BoxSizer();\n tabSizer.stretch = 0;\n widgetSizer.stretch = 1;\n this.tabBar = tabBar;\n this.sizers = [tabSizer, widgetSizer];\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * The tab bar for the layout node.\n */\n readonly tabBar: TabBar;\n\n /**\n * The sizers for the layout node.\n */\n readonly sizers: [BoxSizer, BoxSizer];\n\n /**\n * The most recent value for the `top` edge of the layout box.\n */\n get top(): number {\n return this._top;\n }\n\n /**\n * The most recent value for the `left` edge of the layout box.\n */\n get left(): number {\n return this._left;\n }\n\n /**\n * The most recent value for the `width` of the layout box.\n */\n get width(): number {\n return this._width;\n }\n\n /**\n * The most recent value for the `height` of the layout box.\n */\n get height(): number {\n return this._height;\n }\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n yield this.tabBar;\n yield* this.iterUserWidgets();\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const title of this.tabBar.titles) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n let title = this.tabBar.currentTitle;\n if (title) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n yield this.tabBar;\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n // eslint-disable-next-line require-yield\n *iterHandles(): IterableIterator {\n return;\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n return this;\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n if (x < this._left || x >= this._left + this._width) {\n return null;\n }\n if (y < this._top || y >= this._top + this._height) {\n return null;\n }\n return this;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ITabAreaConfig {\n let widgets = this.tabBar.titles.map(title => title.owner);\n let currentIndex = this.tabBar.currentIndex;\n return { type: 'tab-area', widgets, currentIndex };\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n return;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Set up the limit variables.\n let minWidth = 0;\n let minHeight = 0;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Lookup the tab bar and widget sizers.\n let [tabBarSizer, widgetSizer] = this.sizers;\n\n // Update the tab bar limits.\n if (tabBarItem) {\n tabBarItem.fit();\n }\n\n // Update the widget limits.\n if (widgetItem) {\n widgetItem.fit();\n }\n\n // Update the results and sizer for the tab bar.\n if (tabBarItem && !tabBarItem.isHidden) {\n minWidth = Math.max(minWidth, tabBarItem.minWidth);\n minHeight += tabBarItem.minHeight;\n tabBarSizer.minSize = tabBarItem.minHeight;\n tabBarSizer.maxSize = tabBarItem.maxHeight;\n } else {\n tabBarSizer.minSize = 0;\n tabBarSizer.maxSize = 0;\n }\n\n // Update the results and sizer for the current widget.\n if (widgetItem && !widgetItem.isHidden) {\n minWidth = Math.max(minWidth, widgetItem.minWidth);\n minHeight += widgetItem.minHeight;\n widgetSizer.minSize = widgetItem.minHeight;\n widgetSizer.maxSize = Infinity;\n } else {\n widgetSizer.minSize = 0;\n widgetSizer.maxSize = Infinity;\n }\n\n // Return the computed size limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Update the layout box values.\n this._top = top;\n this._left = left;\n this._width = width;\n this._height = height;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, height);\n\n // Update the tab bar item using the computed size.\n if (tabBarItem && !tabBarItem.isHidden) {\n let size = this.sizers[0].size;\n tabBarItem.update(left, top, width, size);\n top += size;\n }\n\n // Layout the widget using the computed size.\n if (widgetItem && !widgetItem.isHidden) {\n let size = this.sizers[1].size;\n widgetItem.update(left, top, width, size);\n }\n }\n\n private _top = 0;\n private _left = 0;\n private _width = 0;\n private _height = 0;\n }\n\n /**\n * A layout node which holds the data for a split area.\n */\n export class SplitLayoutNode {\n /**\n * Construct a new split layout node.\n *\n * @param orientation - The orientation of the node.\n */\n constructor(orientation: Orientation) {\n this.orientation = orientation;\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * Whether the sizers have been normalized.\n */\n normalized = false;\n\n /**\n * The orientation of the node.\n */\n readonly orientation: Orientation;\n\n /**\n * The child nodes for the split node.\n */\n readonly children: LayoutNode[] = [];\n\n /**\n * The box sizers for the layout children.\n */\n readonly sizers: BoxSizer[] = [];\n\n /**\n * The handles for the layout children.\n */\n readonly handles: HTMLDivElement[] = [];\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterAllWidgets();\n }\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterUserWidgets();\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterSelectedWidgets();\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n for (const child of this.children) {\n yield* child.iterTabBars();\n }\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n *iterHandles(): IterableIterator {\n yield* this.handles;\n for (const child of this.children) {\n yield* child.iterHandles();\n }\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findTabNode(widget);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n let index = this.handles.indexOf(handle);\n if (index !== -1) {\n return { index, node: this };\n }\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findSplitNode(handle);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n if (this.children.length === 0) {\n return null;\n }\n return this.children[0].findFirstTabNode();\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].hitTestTabNodes(x, y);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ISplitAreaConfig {\n let orientation = this.orientation;\n let sizes = this.createNormalizedSizes();\n let children = this.children.map(child => child.createConfig());\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Sync the visibility and orientation of the handles.\n */\n syncHandles(): void {\n this.handles.forEach((handle, i) => {\n handle.setAttribute('data-orientation', this.orientation);\n if (i === this.handles.length - 1) {\n handle.classList.add('lm-mod-hidden');\n } else {\n handle.classList.remove('lm-mod-hidden');\n }\n });\n }\n\n /**\n * Hold the current sizes of the box sizers.\n *\n * This sets the size hint of each sizer to its current size.\n */\n holdSizes(): void {\n for (const sizer of this.sizers) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n for (const child of this.children) {\n child.holdAllSizes();\n }\n this.holdSizes();\n }\n\n /**\n * Normalize the sizes of the split layout node.\n */\n normalizeSizes(): void {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return;\n }\n\n // Hold the current sizes of the sizers.\n this.holdSizes();\n\n // Compute the sum of the sizes.\n let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint = 1 / n;\n }\n } else {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint /= sum;\n }\n }\n\n // Mark the sizes as normalized.\n this.normalized = true;\n }\n\n /**\n * Snap the normalized sizes of the split layout node.\n */\n createNormalizedSizes(): number[] {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return [];\n }\n\n // Grab the current sizes of the sizers.\n let sizes = this.sizers.map(sizer => sizer.size);\n\n // Compute the sum of the sizes.\n let sum = sizes.reduce((v, size) => v + size, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] = 1 / n;\n }\n } else {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] /= sum;\n }\n }\n\n // Return the normalized sizes.\n return sizes;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Compute the required fixed space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n // Set up the limit variables.\n let minWidth = horizontal ? fixed : 0;\n let minHeight = horizontal ? 0 : fixed;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Fit the children and update the limits.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let limits = this.children[i].fit(spacing, items);\n if (horizontal) {\n minHeight = Math.max(minHeight, limits.minHeight);\n minWidth += limits.minWidth;\n this.sizers[i].minSize = limits.minWidth;\n } else {\n minWidth = Math.max(minWidth, limits.minWidth);\n minHeight += limits.minHeight;\n this.sizers[i].minSize = limits.minHeight;\n }\n }\n\n // Return the computed limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Compute the available layout space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n // De-normalize the sizes if needed.\n if (this.normalized) {\n for (const sizer of this.sizers) {\n sizer.sizeHint *= space;\n }\n this.normalized = false;\n }\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, space);\n\n // Update the geometry of the child nodes and handles.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let child = this.children[i];\n let size = this.sizers[i].size;\n let handleStyle = this.handles[i].style;\n if (horizontal) {\n child.update(left, top, size, height, spacing, items);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${spacing}px`;\n handleStyle.height = `${height}px`;\n left += spacing;\n } else {\n child.update(left, top, width, size, spacing, items);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${spacing}px`;\n top += spacing;\n }\n }\n }\n }\n\n export function addAria(widget: Widget, tabBar: TabBar): void {\n widget.node.setAttribute('role', 'tabpanel');\n let renderer = tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n export function removeAria(widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n }\n\n /**\n * Normalize a tab area config and collect the visited widgets.\n */\n function normalizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n widgetSet: Set\n ): DockLayout.ITabAreaConfig | null {\n // Bail early if there is no content.\n if (config.widgets.length === 0) {\n return null;\n }\n\n // Setup the filtered widgets array.\n let widgets: Widget[] = [];\n\n // Filter the config for unique widgets.\n for (const widget of config.widgets) {\n if (!widgetSet.has(widget)) {\n widgetSet.add(widget);\n widgets.push(widget);\n }\n }\n\n // Bail if there are no effective widgets.\n if (widgets.length === 0) {\n return null;\n }\n\n // Normalize the current index.\n let index = config.currentIndex;\n if (index !== -1 && (index < 0 || index >= widgets.length)) {\n index = 0;\n }\n\n // Return a normalized config object.\n return { type: 'tab-area', widgets, currentIndex: index };\n }\n\n /**\n * Normalize a split area config and collect the visited widgets.\n */\n function normalizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n // Set up the result variables.\n let orientation = config.orientation;\n let children: DockLayout.AreaConfig[] = [];\n let sizes: number[] = [];\n\n // Normalize the config children.\n for (let i = 0, n = config.children.length; i < n; ++i) {\n // Normalize the child config.\n let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n // Ignore an empty child.\n if (!child) {\n continue;\n }\n\n // Add the child or hoist its content as appropriate.\n if (child.type === 'tab-area' || child.orientation !== orientation) {\n children.push(child);\n sizes.push(Math.abs(config.sizes[i] || 0));\n } else {\n children.push(...child.children);\n sizes.push(...child.sizes);\n }\n }\n\n // Bail if there are no effective children.\n if (children.length === 0) {\n return null;\n }\n\n // If there is only one effective child, return that child.\n if (children.length === 1) {\n return children[0];\n }\n\n // Return a normalized config object.\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Convert a normalized tab area config into a layout tree.\n */\n function realizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): TabLayoutNode {\n // Create the tab bar for the layout node.\n let tabBar = renderer.createTabBar(document);\n\n // Hide each widget and add it to the tab bar.\n for (const widget of config.widgets) {\n widget.hide();\n tabBar.addTab(widget.title);\n Private.addAria(widget, tabBar);\n }\n\n // Set the current index of the tab bar.\n tabBar.currentIndex = config.currentIndex;\n\n // Return the new tab layout node.\n return new TabLayoutNode(tabBar);\n }\n\n /**\n * Convert a normalized split area config into a layout tree.\n */\n function realizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): SplitLayoutNode {\n // Create the split layout node.\n let node = new SplitLayoutNode(config.orientation);\n\n // Add each child to the layout node.\n config.children.forEach((child, i) => {\n // Create the child data for the layout node.\n let childNode = realizeAreaConfig(child, renderer, document);\n let sizer = createSizer(config.sizes[i]);\n let handle = renderer.createHandle();\n\n // Add the child data to the layout node.\n node.children.push(childNode);\n node.handles.push(handle);\n node.sizers.push(sizer);\n\n // Update the parent for the child node.\n childNode.parent = node;\n });\n\n // Synchronize the handle state for the layout node.\n node.syncHandles();\n\n // Normalize the sizes for the layout node.\n node.normalizeSizes();\n\n // Return the new layout node.\n return node;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n */\nexport class DockPanel extends Widget {\n /**\n * Construct a new dock panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: DockPanel.IOptions = {}) {\n super();\n this.addClass('lm-DockPanel');\n this._document = options.document || document;\n this._mode = options.mode || 'multiple-document';\n this._renderer = options.renderer || DockPanel.defaultRenderer;\n this._edges = options.edges || Private.DEFAULT_EDGES;\n if (options.tabsMovable !== undefined) {\n this._tabsMovable = options.tabsMovable;\n }\n if (options.tabsConstrained !== undefined) {\n this._tabsConstrained = options.tabsConstrained;\n }\n if (options.addButtonEnabled !== undefined) {\n this._addButtonEnabled = options.addButtonEnabled;\n }\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = this._mode;\n\n // Create the delegate renderer for the layout.\n let renderer: DockPanel.IRenderer = {\n createTabBar: () => this._createTabBar(),\n createHandle: () => this._createHandle()\n };\n\n // Set up the dock layout for the panel.\n this.layout = new DockLayout({\n document: this._document,\n renderer,\n spacing: options.spacing,\n hiddenMode: options.hiddenMode\n });\n\n // Set up the overlay drop indicator.\n this.overlay = options.overlay || new DockPanel.Overlay();\n this.node.appendChild(this.overlay.node);\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n // Ensure the mouse is released.\n this._releaseMouse();\n\n // Hide the overlay.\n this.overlay.hide(0);\n\n // Cancel a drag if one is in progress.\n if (this._drag) {\n this._drag.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The method for hiding widgets.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as DockLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as DockLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when the layout configuration is modified.\n *\n * #### Notes\n * This signal is emitted whenever the current layout configuration\n * may have changed.\n *\n * This signal is emitted asynchronously in a collapsed fashion, so\n * that multiple synchronous modifications results in only a single\n * emit of the signal.\n */\n get layoutModified(): ISignal {\n return this._layoutModified;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The overlay used by the dock panel.\n */\n readonly overlay: DockPanel.IOverlay;\n\n /**\n * The renderer used by the dock panel.\n */\n get renderer(): DockPanel.IRenderer {\n return (this.layout as DockLayout).renderer;\n }\n\n /**\n * Get the spacing between the widgets.\n */\n get spacing(): number {\n return (this.layout as DockLayout).spacing;\n }\n\n /**\n * Set the spacing between the widgets.\n */\n set spacing(value: number) {\n (this.layout as DockLayout).spacing = value;\n }\n\n /**\n * Get the mode for the dock panel.\n */\n get mode(): DockPanel.Mode {\n return this._mode;\n }\n\n /**\n * Set the mode for the dock panel.\n *\n * #### Notes\n * Changing the mode is a destructive operation with respect to the\n * panel's layout configuration. If layout state must be preserved,\n * save the current layout config before changing the mode.\n */\n set mode(value: DockPanel.Mode) {\n // Bail early if the mode does not change.\n if (this._mode === value) {\n return;\n }\n\n // Update the internal mode.\n this._mode = value;\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = value;\n\n // Get the layout for the panel.\n let layout = this.layout as DockLayout;\n\n // Configure the layout for the specified mode.\n switch (value) {\n case 'multiple-document':\n for (const tabBar of layout.tabBars()) {\n tabBar.show();\n }\n break;\n case 'single-document':\n layout.restoreLayout(Private.createSingleDocumentConfig(this));\n break;\n default:\n throw 'unreachable';\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Whether the tabs can be dragged / moved at runtime.\n */\n get tabsMovable(): boolean {\n return this._tabsMovable;\n }\n\n /**\n * Enable / Disable draggable / movable tabs.\n */\n set tabsMovable(value: boolean) {\n this._tabsMovable = value;\n for (const tabBar of this.tabBars()) {\n tabBar.tabsMovable = value;\n }\n }\n\n /**\n * Whether the tabs are constrained to their source dock panel\n */\n get tabsConstrained(): boolean {\n return this._tabsConstrained;\n }\n\n /**\n * Constrain/Allow tabs to be dragged outside of this dock panel\n */\n set tabsConstrained(value: boolean) {\n this._tabsConstrained = value;\n }\n\n /**\n * Whether the add buttons for each tab bar are enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add buttons for each tab bar are enabled.\n */\n set addButtonEnabled(value: boolean) {\n this._addButtonEnabled = value;\n for (const tabBar of this.tabBars()) {\n tabBar.addButtonEnabled = value;\n }\n }\n\n /**\n * Whether the dock panel is empty.\n */\n get isEmpty(): boolean {\n return (this.layout as DockLayout).isEmpty;\n }\n\n /**\n * Create an iterator over the user widgets in the panel.\n *\n * @returns A new iterator over the user widgets in the panel.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n *widgets(): IterableIterator {\n yield* (this.layout as DockLayout).widgets();\n }\n\n /**\n * Create an iterator over the selected widgets in the panel.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the panel.\n */\n *selectedWidgets(): IterableIterator {\n yield* (this.layout as DockLayout).selectedWidgets();\n }\n\n /**\n * Create an iterator over the tab bars in the panel.\n *\n * @returns A new iterator over the tab bars in the panel.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n *tabBars(): IterableIterator> {\n yield* (this.layout as DockLayout).tabBars();\n }\n\n /**\n * Create an iterator over the handles in the panel.\n *\n * @returns A new iterator over the handles in the panel.\n */\n *handles(): IterableIterator {\n yield* (this.layout as DockLayout).handles();\n }\n\n /**\n * Select a specific widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will make the widget the current widget in its tab area.\n */\n selectWidget(widget: Widget): void {\n // Find the tab bar which contains the widget.\n let tabBar = find(this.tabBars(), bar => {\n return bar.titles.indexOf(widget.title) !== -1;\n });\n\n // Throw an error if no tab bar is found.\n if (!tabBar) {\n throw new Error('Widget is not contained in the dock panel.');\n }\n\n // Ensure the widget is the current widget.\n tabBar.currentTitle = widget.title;\n }\n\n /**\n * Activate a specified widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will select and activate the given widget.\n */\n activateWidget(widget: Widget): void {\n this.selectWidget(widget);\n widget.activate();\n }\n\n /**\n * Save the current layout configuration of the dock panel.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockPanel.ILayoutConfig {\n return (this.layout as DockLayout).saveLayout();\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n *\n * The dock panel automatically reverts to `'multiple-document'`\n * mode when a layout config is restored.\n */\n restoreLayout(config: DockPanel.ILayoutConfig): void {\n // Reset the mode.\n this._mode = 'multiple-document';\n\n // Restore the layout.\n (this.layout as DockLayout).restoreLayout(config);\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Add a widget to the dock panel.\n *\n * @param widget - The widget to add to the dock panel.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * If the panel is in single document mode, the options are ignored\n * and the widget is always added as tab in the hidden tab bar.\n */\n addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n // Add the widget to the layout.\n if (this._mode === 'single-document') {\n (this.layout as DockLayout).addWidget(widget);\n } else {\n (this.layout as DockLayout).addWidget(widget, options);\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n */\n processMessage(msg: Message): void {\n if (msg.type === 'layout-modified') {\n this._layoutModified.emit(undefined);\n } else {\n super.processMessage(msg);\n }\n }\n\n /**\n * Handle the DOM events for the dock panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'lm-dragenter':\n this._evtDragEnter(event as Drag.Event);\n break;\n case 'lm-dragleave':\n this._evtDragLeave(event as Drag.Event);\n break;\n case 'lm-dragover':\n this._evtDragOver(event as Drag.Event);\n break;\n case 'lm-drop':\n this._evtDrop(event as Drag.Event);\n break;\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('lm-dragenter', this);\n this.node.addEventListener('lm-dragleave', this);\n this.node.addEventListener('lm-dragover', this);\n this.node.addEventListener('lm-drop', this);\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('lm-dragenter', this);\n this.node.removeEventListener('lm-dragleave', this);\n this.node.removeEventListener('lm-dragover', this);\n this.node.removeEventListener('lm-drop', this);\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Add the widget class to the child.\n msg.child.addClass('lm-DockPanel-widget');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Remove the widget class from the child.\n msg.child.removeClass('lm-DockPanel-widget');\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `'lm-dragenter'` event for the dock panel.\n */\n private _evtDragEnter(event: Drag.Event): void {\n // If the factory mime type is present, mark the event as\n // handled in order to get the rest of the drag events.\n if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handle the `'lm-dragleave'` event for the dock panel.\n */\n private _evtDragLeave(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n if (this._tabsConstrained && event.source !== this) return;\n\n event.stopPropagation();\n\n // The new target might be a descendant, so we might still handle the drop.\n // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n // hide is cancelled by the lm-dragover handler's show overlay logic.\n this.overlay.hide(1);\n }\n\n /**\n * Handle the `'lm-dragover'` event for the dock panel.\n */\n private _evtDragOver(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Show the drop indicator overlay and update the drop\n // action based on the drop target zone under the mouse.\n if (\n (this._tabsConstrained && event.source !== this) ||\n this._showOverlay(event.clientX, event.clientY) === 'invalid'\n ) {\n event.dropAction = 'none';\n } else {\n event.stopPropagation();\n event.dropAction = event.proposedAction;\n }\n }\n\n /**\n * Handle the `'lm-drop'` event for the dock panel.\n */\n private _evtDrop(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Hide the drop indicator overlay.\n this.overlay.hide(0);\n\n // Bail if the proposed action is to do nothing.\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n\n // Find the drop target under the mouse.\n let { clientX, clientY } = event;\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // Bail if the drop zone is invalid.\n if (\n (this._tabsConstrained && event.source !== this) ||\n zone === 'invalid'\n ) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory mime type has invalid data.\n let mimeData = event.mimeData;\n let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n if (typeof factory !== 'function') {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory does not produce a widget.\n let widget = factory();\n if (!(widget instanceof Widget)) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the widget is an ancestor of the dock panel.\n if (widget.contains(this)) {\n event.dropAction = 'none';\n return;\n }\n\n // Find the reference widget for the drop target.\n let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n // Add the widget according to the indicated drop zone.\n switch (zone) {\n case 'root-all':\n this.addWidget(widget);\n break;\n case 'root-top':\n this.addWidget(widget, { mode: 'split-top' });\n break;\n case 'root-left':\n this.addWidget(widget, { mode: 'split-left' });\n break;\n case 'root-right':\n this.addWidget(widget, { mode: 'split-right' });\n break;\n case 'root-bottom':\n this.addWidget(widget, { mode: 'split-bottom' });\n break;\n case 'widget-all':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n case 'widget-top':\n this.addWidget(widget, { mode: 'split-top', ref });\n break;\n case 'widget-left':\n this.addWidget(widget, { mode: 'split-left', ref });\n break;\n case 'widget-right':\n this.addWidget(widget, { mode: 'split-right', ref });\n break;\n case 'widget-bottom':\n this.addWidget(widget, { mode: 'split-bottom', ref });\n break;\n case 'widget-tab':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n default:\n throw 'unreachable';\n }\n\n // Accept the proposed drop action.\n event.dropAction = event.proposedAction;\n\n // Stop propagation if we have not bailed so far.\n event.stopPropagation();\n\n // Activate the dropped widget.\n this.activateWidget(widget);\n }\n\n /**\n * Handle the `'keydown'` event for the dock panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the dock panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the left mouse button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the mouse target, if any.\n let layout = this.layout as DockLayout;\n let target = event.target as HTMLElement;\n let handle = find(layout.handles(), handle => handle.contains(target));\n if (!handle) {\n return;\n }\n\n // Stop the event when a handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n this._document.addEventListener('keydown', this, true);\n this._document.addEventListener('pointerup', this, true);\n this._document.addEventListener('pointermove', this, true);\n this._document.addEventListener('contextmenu', this, true);\n\n // Compute the offset deltas for the handle press.\n let rect = handle.getBoundingClientRect();\n let deltaX = event.clientX - rect.left;\n let deltaY = event.clientY - rect.top;\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!, this._document);\n this._pressData = { handle, deltaX, deltaY, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the dock panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event when dragging a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let rect = this.node.getBoundingClientRect();\n let xPos = event.clientX - rect.left - this._pressData.deltaX;\n let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n // Set the handle as close to the desired position as possible.\n let layout = this.layout as DockLayout;\n layout.moveHandle(this._pressData.handle, xPos, yPos);\n }\n\n /**\n * Handle the `'pointerup'` event for the dock panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the left mouse button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Release the mouse grab for the dock panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra document listeners.\n this._document.removeEventListener('keydown', this, true);\n this._document.removeEventListener('pointerup', this, true);\n this._document.removeEventListener('pointermove', this, true);\n this._document.removeEventListener('contextmenu', this, true);\n }\n\n /**\n * Show the overlay indicator at the given client position.\n *\n * Returns the drop zone at the specified client position.\n *\n * #### Notes\n * If the position is not over a valid zone, the overlay is hidden.\n */\n private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n // Find the dock target for the given client position.\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // If the drop zone is invalid, hide the overlay and bail.\n if (zone === 'invalid') {\n this.overlay.hide(100);\n return zone;\n }\n\n // Setup the variables needed to compute the overlay geometry.\n let top: number;\n let left: number;\n let right: number;\n let bottom: number;\n let box = ElementExt.boxSizing(this.node); // TODO cache this?\n let rect = this.node.getBoundingClientRect();\n\n // Compute the overlay geometry based on the dock zone.\n switch (zone) {\n case 'root-all':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-top':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = rect.height * Private.GOLDEN_RATIO;\n break;\n case 'root-left':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = rect.width * Private.GOLDEN_RATIO;\n bottom = box.paddingBottom;\n break;\n case 'root-right':\n top = box.paddingTop;\n left = rect.width * Private.GOLDEN_RATIO;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-bottom':\n top = rect.height * Private.GOLDEN_RATIO;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'widget-all':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-top':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height / 2;\n break;\n case 'widget-left':\n top = target!.top;\n left = target!.left;\n right = target!.right + target!.width / 2;\n bottom = target!.bottom;\n break;\n case 'widget-right':\n top = target!.top;\n left = target!.left + target!.width / 2;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-bottom':\n top = target!.top + target!.height / 2;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-tab': {\n const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height - tabHeight;\n break;\n }\n default:\n throw 'unreachable';\n }\n\n // Show the overlay with the computed geometry.\n this.overlay.show({ top, left, right, bottom });\n\n // Finally, return the computed drop zone.\n return zone;\n }\n\n /**\n * Create a new tab bar for use by the panel.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar.\n let tabBar = this._renderer.createTabBar(this._document);\n\n // Set the generated tab bar property for the tab bar.\n Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n // Hide the tab bar when in single document mode.\n if (this._mode === 'single-document') {\n tabBar.hide();\n }\n\n // Enforce necessary tab bar behavior.\n // TODO do we really want to enforce *all* of these?\n tabBar.tabsMovable = this._tabsMovable;\n tabBar.allowDeselect = false;\n tabBar.addButtonEnabled = this._addButtonEnabled;\n tabBar.removeBehavior = 'select-previous-tab';\n tabBar.insertBehavior = 'select-tab-if-needed';\n\n // Connect the signal handlers for the tab bar.\n tabBar.tabMoved.connect(this._onTabMoved, this);\n tabBar.currentChanged.connect(this._onCurrentChanged, this);\n tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for use by the panel.\n */\n private _createHandle(): HTMLDivElement {\n return this._renderer.createHandle();\n }\n\n /**\n * Handle the `tabMoved` signal from a tab bar.\n */\n private _onTabMoved(): void {\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `currentChanged` signal from a tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousTitle, currentTitle } = args;\n\n // Hide the previous widget.\n if (previousTitle) {\n previousTitle.owner.hide();\n }\n\n // Show the current widget.\n if (currentTitle) {\n currentTitle.owner.show();\n }\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `addRequested` signal from a tab bar.\n */\n private _onTabAddRequested(sender: TabBar): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from a tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from a tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabDetachRequested` signal from a tab bar.\n */\n private _onTabDetachRequested(\n sender: TabBar,\n args: TabBar.ITabDetachRequestedArgs\n ): void {\n // Do nothing if a drag is already in progress.\n if (this._drag) {\n return;\n }\n\n // Release the tab bar's hold on the mouse.\n sender.releaseMouse();\n\n // Extract the data from the args.\n let { title, tab, clientX, clientY, offset } = args;\n\n // Setup the mime data for the drag operation.\n let mimeData = new MimeData();\n let factory = () => title.owner;\n mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n // Create the drag image for the drag operation.\n let dragImage = tab.cloneNode(true) as HTMLElement;\n if (offset) {\n dragImage.style.top = `-${offset.y}px`;\n dragImage.style.left = `-${offset.x}px`;\n }\n\n // Create the drag object to manage the drag-drop operation.\n this._drag = new Drag({\n document: this._document,\n mimeData,\n dragImage,\n proposedAction: 'move',\n supportedActions: 'move',\n source: this\n });\n\n // Hide the tab node in the original tab.\n tab.classList.add('lm-mod-hidden');\n let cleanup = () => {\n this._drag = null;\n tab.classList.remove('lm-mod-hidden');\n };\n\n // Start the drag operation and cleanup when done.\n this._drag.start(clientX, clientY).then(cleanup);\n }\n\n private _edges: DockPanel.IEdges;\n private _document: Document | ShadowRoot;\n private _mode: DockPanel.Mode;\n private _drag: Drag | null = null;\n private _renderer: DockPanel.IRenderer;\n private _tabsMovable: boolean = true;\n private _tabsConstrained: boolean = false;\n private _addButtonEnabled: boolean = false;\n private _pressData: Private.IPressData | null = null;\n private _layoutModified = new Signal(this);\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n /**\n * An options object for creating a dock panel.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n /**\n * The overlay to use with the dock panel.\n *\n * The default is a new `Overlay` instance.\n */\n overlay?: IOverlay;\n\n /**\n * The renderer to use for the dock panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The spacing between the items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The mode for the dock panel.\n *\n * The default is `'multiple-document'`.\n */\n mode?: DockPanel.Mode;\n\n /**\n * The sizes of the edge drop zones, in pixels.\n * If not given, default values will be used.\n */\n edges?: IEdges;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * Allow tabs to be draggable / movable by user.\n *\n * The default is `'true'`.\n */\n tabsMovable?: boolean;\n\n /**\n * Constrain tabs to this dock panel\n *\n * The default is `'false'`.\n */\n tabsConstrained?: boolean;\n\n /**\n * Enable add buttons in each of the dock panel's tab bars.\n *\n * The default is `'false'`.\n */\n addButtonEnabled?: boolean;\n }\n\n /**\n * The sizes of the edge drop zones, in pixels.\n */\n export interface IEdges {\n /**\n * The size of the top edge drop zone.\n */\n top: number;\n\n /**\n * The size of the right edge drop zone.\n */\n right: number;\n\n /**\n * The size of the bottom edge drop zone.\n */\n bottom: number;\n\n /**\n * The size of the left edge drop zone.\n */\n left: number;\n }\n\n /**\n * A type alias for the supported dock panel modes.\n */\n export type Mode =\n | /**\n * The single document mode.\n *\n * In this mode, only a single widget is visible at a time, and that\n * widget fills the available layout space. No tab bars are visible.\n */\n 'single-document'\n\n /**\n * The multiple document mode.\n *\n * In this mode, multiple documents are displayed in separate tab\n * areas, and those areas can be individually resized by the user.\n */\n | 'multiple-document';\n\n /**\n * A type alias for a layout configuration object.\n */\n export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n /**\n * A type alias for the supported insertion modes.\n */\n export type InsertMode = DockLayout.InsertMode;\n\n /**\n * A type alias for the add widget options.\n */\n export type IAddOptions = DockLayout.IAddOptions;\n\n /**\n * An object which holds the geometry for overlay positioning.\n */\n export interface IOverlayGeometry {\n /**\n * The distance between the overlay and parent top edges.\n */\n top: number;\n\n /**\n * The distance between the overlay and parent left edges.\n */\n left: number;\n\n /**\n * The distance between the overlay and parent right edges.\n */\n right: number;\n\n /**\n * The distance between the overlay and parent bottom edges.\n */\n bottom: number;\n }\n\n /**\n * An object which manages the overlay node for a dock panel.\n */\n export interface IOverlay {\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n *\n * #### Notes\n * The given geometry values assume the node will use absolute\n * positioning.\n *\n * This is called on every mouse move event during a drag in order\n * to update the position of the overlay. It should be efficient.\n */\n show(geo: IOverlayGeometry): void;\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 should hide the overlay immediately.\n *\n * #### Notes\n * This is called whenever the overlay node should been hidden.\n */\n hide(delay: number): void;\n }\n\n /**\n * A concrete implementation of `IOverlay`.\n *\n * This is the default overlay implementation for a dock panel.\n */\n export class Overlay implements IOverlay {\n /**\n * Construct a new overlay.\n */\n constructor() {\n this.node = document.createElement('div');\n this.node.classList.add('lm-DockPanel-overlay');\n this.node.classList.add('lm-mod-hidden');\n this.node.style.position = 'absolute';\n this.node.style.contain = 'strict';\n }\n\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n */\n show(geo: IOverlayGeometry): void {\n // Update the position of the overlay.\n let style = this.node.style;\n style.top = `${geo.top}px`;\n style.left = `${geo.left}px`;\n style.right = `${geo.right}px`;\n style.bottom = `${geo.bottom}px`;\n\n // Clear any pending hide timer.\n clearTimeout(this._timer);\n this._timer = -1;\n\n // If the overlay is already visible, we're done.\n if (!this._hidden) {\n return;\n }\n\n // Clear the hidden flag.\n this._hidden = false;\n\n // Finally, show the overlay.\n this.node.classList.remove('lm-mod-hidden');\n }\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 will hide the overlay immediately.\n */\n hide(delay: number): void {\n // Do nothing if the overlay is already hidden.\n if (this._hidden) {\n return;\n }\n\n // Hide immediately if the delay is <= 0.\n if (delay <= 0) {\n clearTimeout(this._timer);\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n return;\n }\n\n // Do nothing if a hide is already pending.\n if (this._timer !== -1) {\n return;\n }\n\n // Otherwise setup the hide timer.\n this._timer = window.setTimeout(() => {\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n }, delay);\n }\n\n private _timer = -1;\n private _hidden = true;\n }\n\n /**\n * A type alias for a dock panel renderer;\n */\n export type IRenderer = DockLayout.IRenderer;\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new tab bar for use with a dock panel.\n *\n * @returns A new tab bar for a dock panel.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar {\n let bar = new TabBar({ document });\n bar.addClass('lm-DockPanel-tabBar');\n return bar;\n }\n\n /**\n * Create a new handle node for use with a dock panel.\n *\n * @returns A new handle node for a dock panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-DockPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * The default sizes for the edge drop zones, in pixels.\n */\n export const DEFAULT_EDGES = {\n /**\n * The size of the top edge dock zone for the root panel, in pixels.\n * This is different from the others to distinguish between the top\n * tab bar and the top root zone.\n */\n top: 12,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n right: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n bottom: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n left: 40\n };\n\n /**\n * A singleton `'layout-modified'` conflatable message.\n */\n export const LayoutModified = new ConflatableMessage('layout-modified');\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The handle which was pressed.\n */\n handle: HTMLDivElement;\n\n /**\n * The X offset of the press in handle coordinates.\n */\n deltaX: number;\n\n /**\n * The Y offset of the press in handle coordinates.\n */\n deltaY: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * A type alias for a drop zone.\n */\n export type DropZone =\n | /**\n * An invalid drop zone.\n */\n 'invalid'\n\n /**\n * The entirety of the root dock area.\n */\n | 'root-all'\n\n /**\n * The top portion of the root dock area.\n */\n | 'root-top'\n\n /**\n * The left portion of the root dock area.\n */\n | 'root-left'\n\n /**\n * The right portion of the root dock area.\n */\n | 'root-right'\n\n /**\n * The bottom portion of the root dock area.\n */\n | 'root-bottom'\n\n /**\n * The entirety of a tabbed widget area.\n */\n | 'widget-all'\n\n /**\n * The top portion of tabbed widget area.\n */\n | 'widget-top'\n\n /**\n * The left portion of tabbed widget area.\n */\n | 'widget-left'\n\n /**\n * The right portion of tabbed widget area.\n */\n | 'widget-right'\n\n /**\n * The bottom portion of tabbed widget area.\n */\n | 'widget-bottom'\n\n /**\n * The the bar of a tabbed widget area.\n */\n | 'widget-tab';\n\n /**\n * An object which holds the drop target zone and widget.\n */\n export interface IDropTarget {\n /**\n * The semantic zone for the mouse position.\n */\n zone: DropZone;\n\n /**\n * The tab area geometry for the drop zone, or `null`.\n */\n target: DockLayout.ITabAreaGeometry | null;\n }\n\n /**\n * An attached property used to track generated tab bars.\n */\n export const isGeneratedTabBarProperty = new AttachedProperty<\n Widget,\n boolean\n >({\n name: 'isGeneratedTabBar',\n create: () => false\n });\n\n /**\n * Create a single document config for the widgets in a dock panel.\n */\n export function createSingleDocumentConfig(\n panel: DockPanel\n ): DockPanel.ILayoutConfig {\n // Return an empty config if the panel is empty.\n if (panel.isEmpty) {\n return { main: null };\n }\n\n // Get a flat array of the widgets in the panel.\n let widgets = Array.from(panel.widgets());\n\n // Get the first selected widget in the panel.\n let selected = panel.selectedWidgets().next().value;\n\n // Compute the current index for the new config.\n let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n // Return the single document config.\n return { main: { type: 'tab-area', widgets, currentIndex } };\n }\n\n /**\n * Find the drop target at the given client position.\n */\n export function findDropTarget(\n panel: DockPanel,\n clientX: number,\n clientY: number,\n edges: DockPanel.IEdges\n ): IDropTarget {\n // Bail if the mouse is not over the dock panel.\n if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n return { zone: 'invalid', target: null };\n }\n\n // Look up the layout for the panel.\n let layout = panel.layout as DockLayout;\n\n // If the layout is empty, indicate the entire root drop zone.\n if (layout.isEmpty) {\n return { zone: 'root-all', target: null };\n }\n\n // Test the edge zones when in multiple document mode.\n if (panel.mode === 'multiple-document') {\n // Get the client rect for the dock panel.\n let panelRect = panel.node.getBoundingClientRect();\n\n // Compute the distance to each edge of the panel.\n let pl = clientX - panelRect.left + 1;\n let pt = clientY - panelRect.top + 1;\n let pr = panelRect.right - clientX;\n let pb = panelRect.bottom - clientY;\n\n // Find the minimum distance to an edge.\n let pd = Math.min(pt, pr, pb, pl);\n\n // Return a root zone if the mouse is within an edge.\n switch (pd) {\n case pt:\n if (pt < edges.top) {\n return { zone: 'root-top', target: null };\n }\n break;\n case pr:\n if (pr < edges.right) {\n return { zone: 'root-right', target: null };\n }\n break;\n case pb:\n if (pb < edges.bottom) {\n return { zone: 'root-bottom', target: null };\n }\n break;\n case pl:\n if (pl < edges.left) {\n return { zone: 'root-left', target: null };\n }\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Hit test the dock layout at the given client position.\n let target = layout.hitTestTabAreas(clientX, clientY);\n\n // Bail if no target area was found.\n if (!target) {\n return { zone: 'invalid', target: null };\n }\n\n // Return the whole tab area when in single document mode.\n if (panel.mode === 'single-document') {\n return { zone: 'widget-all', target };\n }\n\n // Compute the distance to each edge of the tab area.\n let al = target.x - target.left + 1;\n let at = target.y - target.top + 1;\n let ar = target.left + target.width - target.x;\n let ab = target.top + target.height - target.y;\n\n const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n if (at < tabHeight) {\n return { zone: 'widget-tab', target };\n }\n\n // Get the X and Y edge sizes for the area.\n let rx = Math.round(target.width / 3);\n let ry = Math.round(target.height / 3);\n\n // If the mouse is not within an edge, indicate the entire area.\n if (al > rx && ar > rx && at > ry && ab > ry) {\n return { zone: 'widget-all', target };\n }\n\n // Scale the distances by the slenderness ratio.\n al /= rx;\n at /= ry;\n ar /= rx;\n ab /= ry;\n\n // Find the minimum distance to the area edge.\n let ad = Math.min(al, at, ar, ab);\n\n // Find the widget zone for the area edge.\n let zone: DropZone;\n switch (ad) {\n case al:\n zone = 'widget-left';\n break;\n case at:\n zone = 'widget-top';\n break;\n case ar:\n zone = 'widget-right';\n break;\n case ab:\n zone = 'widget-bottom';\n break;\n default:\n throw 'unreachable';\n }\n\n // Return the final drop target.\n return { zone, target };\n }\n\n /**\n * Get the drop reference widget for a tab bar.\n */\n export function getDropRef(tabBar: TabBar): Widget | null {\n if (tabBar.titles.length === 0) {\n return null;\n }\n if (tabBar.currentTitle) {\n return tabBar.currentTitle.owner;\n }\n return tabBar.titles[tabBar.titles.length - 1].owner;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker implements IDisposable {\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose(): void {\n // Do nothing if the tracker is already disposed.\n if (this._counter < 0) {\n return;\n }\n\n // Mark the tracker as disposed.\n this._counter = -1;\n\n // Clear the connections for the tracker.\n Signal.clearData(this);\n\n // Remove all event listeners.\n for (const widget of this._widgets) {\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n }\n\n // Clear the internal data structures.\n this._activeWidget = null;\n this._currentWidget = null;\n this._nodes.clear();\n this._numbers.clear();\n this._widgets.length = 0;\n }\n\n /**\n * A signal emitted when the current widget has changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when the active widget has changed.\n */\n get activeChanged(): ISignal> {\n return this._activeChanged;\n }\n\n /**\n * A flag indicating whether the tracker is disposed.\n */\n get isDisposed(): boolean {\n return this._counter < 0;\n }\n\n /**\n * The current widget in the tracker.\n *\n * #### Notes\n * The current widget is the widget among the tracked widgets which\n * has the *descendant node* which has most recently been focused.\n *\n * The current widget will not be updated if the node loses focus. It\n * will only be updated when a different tracked widget gains focus.\n *\n * If the current widget is removed from the tracker, the previous\n * current widget will be restored.\n *\n * This behavior is intended to follow a user's conceptual model of\n * a semantically \"current\" widget, where the \"last thing of type X\"\n * to be interacted with is the \"current instance of X\", regardless\n * of whether that instance still has focus.\n */\n get currentWidget(): T | null {\n return this._currentWidget;\n }\n\n /**\n * The active widget in the tracker.\n *\n * #### Notes\n * The active widget is the widget among the tracked widgets which\n * has the *descendant node* which is currently focused.\n */\n get activeWidget(): T | null {\n return this._activeWidget;\n }\n\n /**\n * A read only array of the widgets being tracked.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Get the focus number for a particular widget in the tracker.\n *\n * @param widget - The widget of interest.\n *\n * @returns The focus number for the given widget, or `-1` if the\n * widget has not had focus since being added to the tracker, or\n * is not contained by the tracker.\n *\n * #### Notes\n * The focus number indicates the relative order in which the widgets\n * have gained focus. A widget with a larger number has gained focus\n * more recently than a widget with a smaller number.\n *\n * The `currentWidget` will always have the largest focus number.\n *\n * All widgets start with a focus number of `-1`, which indicates that\n * the widget has not been focused since being added to the tracker.\n */\n focusNumber(widget: T): number {\n let n = this._numbers.get(widget);\n return n === undefined ? -1 : n;\n }\n\n /**\n * Test whether the focus tracker contains a given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns `true` if the widget is tracked, `false` otherwise.\n */\n has(widget: T): boolean {\n return this._numbers.has(widget);\n }\n\n /**\n * Add a widget to the focus tracker.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is already tracked, this is a no-op.\n */\n add(widget: T): void {\n // Do nothing if the widget is already tracked.\n if (this._numbers.has(widget)) {\n return;\n }\n\n // Test whether the widget has focus.\n let focused = widget.node.contains(document.activeElement);\n\n // Set up the initial focus number.\n let n = focused ? this._counter++ : -1;\n\n // Add the widget to the internal data structures.\n this._widgets.push(widget);\n this._numbers.set(widget, n);\n this._nodes.set(widget.node, widget);\n\n // Set up the event listeners. The capturing phase must be used\n // since the 'focus' and 'blur' events don't bubble and Firefox\n // doesn't support the 'focusin' or 'focusout' events.\n widget.node.addEventListener('focus', this, true);\n widget.node.addEventListener('blur', this, true);\n\n // Connect the disposed signal handler.\n widget.disposed.connect(this._onWidgetDisposed, this);\n\n // Set the current and active widgets if needed.\n if (focused) {\n this._setWidgets(widget, widget);\n }\n }\n\n /**\n * Remove a widget from the focus tracker.\n *\n * #### Notes\n * If the widget is the `currentWidget`, the previous current widget\n * will become the new `currentWidget`.\n *\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is not tracked, this is a no-op.\n */\n remove(widget: T): void {\n // Bail early if the widget is not tracked.\n if (!this._numbers.has(widget)) {\n return;\n }\n\n // Disconnect the disposed signal handler.\n widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n // Remove the event listeners.\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n\n // Remove the widget from the internal data structures.\n ArrayExt.removeFirstOf(this._widgets, widget);\n this._nodes.delete(widget.node);\n this._numbers.delete(widget);\n\n // Bail early if the widget is not the current widget.\n if (this._currentWidget !== widget) {\n return;\n }\n\n // Filter the widgets for those which have had focus.\n let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n // Get the valid widget with the max focus number.\n let previous =\n max(valid, (first, second) => {\n let a = this._numbers.get(first)!;\n let b = this._numbers.get(second)!;\n return a - b;\n }) || null;\n\n // Set the current and active widgets.\n this._setWidgets(previous, null);\n }\n\n /**\n * Handle the DOM events for the focus tracker.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tracked nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n }\n }\n\n /**\n * Set the current and active widgets for the tracker.\n */\n private _setWidgets(current: T | null, active: T | null): void {\n // Swap the current widget.\n let oldCurrent = this._currentWidget;\n this._currentWidget = current;\n\n // Swap the active widget.\n let oldActive = this._activeWidget;\n this._activeWidget = active;\n\n // Emit the `currentChanged` signal if needed.\n if (oldCurrent !== current) {\n this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n }\n\n // Emit the `activeChanged` signal if needed.\n if (oldActive !== active) {\n this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n }\n }\n\n /**\n * Handle the `'focus'` event for a tracked widget.\n */\n private _evtFocus(event: FocusEvent): void {\n // Find the widget which gained focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Update the focus number if necessary.\n if (widget !== this._currentWidget) {\n this._numbers.set(widget, this._counter++);\n }\n\n // Set the current and active widgets.\n this._setWidgets(widget, widget);\n }\n\n /**\n * Handle the `'blur'` event for a tracked widget.\n */\n private _evtBlur(event: FocusEvent): void {\n // Find the widget which lost focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Get the node which being focused after this blur.\n let focusTarget = event.relatedTarget as HTMLElement;\n\n // If no other node is being focused, clear the active widget.\n if (!focusTarget) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n\n // Bail if the focus widget is not changing.\n if (widget.node.contains(focusTarget)) {\n return;\n }\n\n // If no tracked widget is being focused, clear the active widget.\n if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n }\n\n /**\n * Handle the `disposed` signal for a tracked widget.\n */\n private _onWidgetDisposed(sender: T): void {\n this.remove(sender);\n }\n\n private _counter = 0;\n private _widgets: T[] = [];\n private _activeWidget: T | null = null;\n private _currentWidget: T | null = null;\n private _numbers = new Map();\n private _nodes = new Map();\n private _activeChanged = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n /**\n * An arguments object for the changed signals.\n */\n export interface IChangedArgs {\n /**\n * The old value for the widget.\n */\n oldValue: T | null;\n\n /**\n * The new value for the widget.\n */\n newValue: T | null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n /**\n * Construct a new grid layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: GridLayout.IOptions = {}) {\n super(options);\n if (options.rowCount !== undefined) {\n Private.reallocSizers(this._rowSizers, options.rowCount);\n }\n if (options.columnCount !== undefined) {\n Private.reallocSizers(this._columnSizers, options.columnCount);\n }\n if (options.rowSpacing !== undefined) {\n this._rowSpacing = Private.clampValue(options.rowSpacing);\n }\n if (options.columnSpacing !== undefined) {\n this._columnSpacing = Private.clampValue(options.columnSpacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the widgets and layout items.\n for (const item of this._items) {\n let widget = item.widget;\n item.dispose();\n widget.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._rowStarts.length = 0;\n this._rowSizers.length = 0;\n this._columnStarts.length = 0;\n this._columnSizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the number of rows in the layout.\n */\n get rowCount(): number {\n return this._rowSizers.length;\n }\n\n /**\n * Set the number of rows in the layout.\n *\n * #### Notes\n * The minimum row count is `1`.\n */\n set rowCount(value: number) {\n // Do nothing if the row count does not change.\n if (value === this.rowCount) {\n return;\n }\n\n // Reallocate the row sizers.\n Private.reallocSizers(this._rowSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the number of columns in the layout.\n */\n get columnCount(): number {\n return this._columnSizers.length;\n }\n\n /**\n * Set the number of columns in the layout.\n *\n * #### Notes\n * The minimum column count is `1`.\n */\n set columnCount(value: number) {\n // Do nothing if the column count does not change.\n if (value === this.columnCount) {\n return;\n }\n\n // Reallocate the column sizers.\n Private.reallocSizers(this._columnSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the row spacing for the layout.\n */\n get rowSpacing(): number {\n return this._rowSpacing;\n }\n\n /**\n * Set the row spacing for the layout.\n */\n set rowSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._rowSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._rowSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the column spacing for the layout.\n */\n get columnSpacing(): number {\n return this._columnSpacing;\n }\n\n /**\n * Set the col spacing for the layout.\n */\n set columnSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._columnSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._columnSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @returns The stretch factor for the row.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n rowStretch(index: number): number {\n let sizer = this._rowSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @param value - The stretch factor for the row.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setRowStretch(index: number, value: number): void {\n // Look up the row sizer.\n let sizer = this._rowSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Get the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @returns The stretch factor for the column.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n columnStretch(index: number): number {\n let sizer = this._columnSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @param value - The stretch factor for the column.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setColumnStretch(index: number, value: number): void {\n // Look up the column sizer.\n let sizer = this._columnSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n for (const item of this._items) {\n yield item.widget;\n }\n }\n\n /**\n * Add a widget to the grid layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, this is no-op.\n */\n addWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is already in the layout.\n if (i !== -1) {\n return;\n }\n\n // Add the widget to the layout.\n this._items.push(new LayoutItem(widget));\n\n // Attach the widget to the parent.\n if (this.parent) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Remove a widget from the grid layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is not in the layout.\n if (i === -1) {\n return;\n }\n\n // Remove the widget from the layout.\n let item = ArrayExt.removeAt(this._items, i)!;\n\n // Detach the widget from the parent.\n if (this.parent) {\n this.detachWidget(widget);\n }\n\n // Dispose the layout item.\n item.dispose();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Reset the min sizes of the sizers.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n this._rowSizers[i].minSize = 0;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n this._columnSizers[i].minSize = 0;\n }\n\n // Filter for the visible layout items.\n let items = this._items.filter(it => !it.isHidden);\n\n // Fit the layout items.\n for (let i = 0, n = items.length; i < n; ++i) {\n items[i].fit();\n }\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Sort the items by row span.\n items.sort(Private.rowSpanCmp);\n\n // Update the min sizes of the row sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the row bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n // Distribute the minimum height to the sizers as needed.\n Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n }\n\n // Sort the items by column span.\n items.sort(Private.columnSpanCmp);\n\n // Update the min sizes of the column sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the column bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let c1 = Math.min(config.column, maxCol);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Distribute the minimum width to the sizers as needed.\n Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n }\n\n // If no size constraint is needed, just update the parent.\n if (this.fitPolicy === 'set-no-constraint') {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n return;\n }\n\n // Set up the computed min size.\n let minH = maxRow * this._rowSpacing;\n let minW = maxCol * this._columnSpacing;\n\n // Add the sizer minimums to the computed min size.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n minH += this._rowSizers[i].minSize;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n minW += this._columnSizers[i].minSize;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Compute the total fixed row and column space.\n let fixedRowSpace = maxRow * this._rowSpacing;\n let fixedColSpace = maxCol * this._columnSpacing;\n\n // Distribute the available space to the box sizers.\n BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n // Update the row start positions.\n for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n this._rowStarts[i] = pos;\n pos += this._rowSizers[i].size + this._rowSpacing;\n }\n\n // Update the column start positions.\n for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n this._columnStarts[i] = pos;\n pos += this._columnSizers[i].size + this._columnSpacing;\n }\n\n // Update the geometry of the layout items.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the cell bounds for the widget.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let c1 = Math.min(config.column, maxCol);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Compute the cell geometry.\n let x = this._columnStarts[c1];\n let y = this._rowStarts[r1];\n let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n // Update the geometry of the layout item.\n item.update(x, y, w, h);\n }\n }\n\n private _dirty = false;\n private _rowSpacing = 4;\n private _columnSpacing = 4;\n private _items: LayoutItem[] = [];\n private _rowStarts: number[] = [];\n private _columnStarts: number[] = [];\n private _rowSizers: BoxSizer[] = [new BoxSizer()];\n private _columnSizers: BoxSizer[] = [new BoxSizer()];\n private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n /**\n * An options object for initializing a grid layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The initial row count for the layout.\n *\n * The default is `1`.\n */\n rowCount?: number;\n\n /**\n * The initial column count for the layout.\n *\n * The default is `1`.\n */\n columnCount?: number;\n\n /**\n * The spacing between rows in the layout.\n *\n * The default is `4`.\n */\n rowSpacing?: number;\n\n /**\n * The spacing between columns in the layout.\n *\n * The default is `4`.\n */\n columnSpacing?: number;\n }\n\n /**\n * An object which holds the cell configuration for a widget.\n */\n export interface ICellConfig {\n /**\n * The row index for the widget.\n */\n readonly row: number;\n\n /**\n * The column index for the widget.\n */\n readonly column: number;\n\n /**\n * The row span for the widget.\n */\n readonly rowSpan: number;\n\n /**\n * The column span for the widget.\n */\n readonly columnSpan: number;\n }\n\n /**\n * Get the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The cell config for the widget.\n */\n export function getCellConfig(widget: Widget): ICellConfig {\n return Private.cellConfigProperty.get(widget);\n }\n\n /**\n * Set the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the cell config.\n */\n export function setCellConfig(\n widget: Widget,\n value: Partial\n ): void {\n Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for the widget cell config.\n */\n export const cellConfigProperty = new AttachedProperty<\n Widget,\n GridLayout.ICellConfig\n >({\n name: 'cellConfig',\n create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n changed: onChildCellConfigChanged\n });\n\n /**\n * Normalize a partial cell config object.\n */\n export function normalizeConfig(\n config: Partial\n ): GridLayout.ICellConfig {\n let row = Math.max(0, Math.floor(config.row || 0));\n let column = Math.max(0, Math.floor(config.column || 0));\n let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n return { row, column, rowSpan, columnSpan };\n }\n\n /**\n * Clamp a value to an integer >= 0.\n */\n export function clampValue(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * A sort comparison function for row spans.\n */\n export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.rowSpan - c2.rowSpan;\n }\n\n /**\n * A sort comparison function for column spans.\n */\n export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.columnSpan - c2.columnSpan;\n }\n\n /**\n * Reallocate the box sizers for the given grid dimensions.\n */\n export function reallocSizers(sizers: BoxSizer[], count: number): void {\n // Coerce the count to the valid range.\n count = Math.max(1, Math.floor(count));\n\n // Add the missing sizers.\n while (sizers.length < count) {\n sizers.push(new BoxSizer());\n }\n\n // Remove the extra sizers.\n if (sizers.length > count) {\n sizers.length = count;\n }\n }\n\n /**\n * Distribute a min size constraint across a range of sizers.\n */\n export function distributeMin(\n sizers: BoxSizer[],\n i1: number,\n i2: number,\n minSize: number\n ): void {\n // Sanity check the indices.\n if (i2 < i1) {\n return;\n }\n\n // Handle the simple case of no cell span.\n if (i1 === i2) {\n let sizer = sizers[i1];\n sizer.minSize = Math.max(sizer.minSize, minSize);\n return;\n }\n\n // Compute the total current min size of the span.\n let totalMin = 0;\n for (let i = i1; i <= i2; ++i) {\n totalMin += sizers[i].minSize;\n }\n\n // Do nothing if the total is greater than the required.\n if (totalMin >= minSize) {\n return;\n }\n\n // Compute the portion of the space to allocate to each sizer.\n let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n // Add the portion to each sizer.\n for (let i = i1; i <= i2; ++i) {\n sizers[i].minSize += portion;\n }\n }\n\n /**\n * The change handler for the child cell config property.\n */\n function onChildCellConfigChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof GridLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n */\nexport class MenuBar extends Widget {\n /**\n * Construct a new menu bar.\n *\n * @param options - The options for initializing the menu bar.\n */\n constructor(options: MenuBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-MenuBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.renderer = options.renderer || MenuBar.defaultRenderer;\n this._forceItemsPosition = options.forceItemsPosition || {\n forceX: true,\n forceY: true\n };\n this._overflowMenuOptions = options.overflowMenuOptions || {\n isVisible: true\n };\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._closeChildMenu();\n this._menus.length = 0;\n super.dispose();\n }\n\n /**\n * The renderer used by the menu bar.\n */\n readonly renderer: MenuBar.IRenderer;\n\n /**\n * The child menu of the menu bar.\n *\n * #### Notes\n * This will be `null` if the menu bar does not have an open menu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The overflow index of the menu bar.\n */\n get overflowIndex(): number {\n return this._overflowIndex;\n }\n\n /**\n * The overflow menu of the menu bar.\n */\n get overflowMenu(): Menu | null {\n return this._overflowMenu;\n }\n\n /**\n * Get the menu bar content node.\n *\n * #### Notes\n * This is the node which holds the menu title nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-MenuBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu.\n */\n get activeMenu(): Menu | null {\n return this._menus[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu.\n *\n * #### Notes\n * If the menu does not exist, the menu will be set to `null`.\n */\n set activeMenu(value: Menu | null) {\n this.activeIndex = value ? this._menus.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu.\n *\n * #### Notes\n * This will be `-1` if no menu is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu.\n *\n * #### Notes\n * If the menu cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._menus.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menus in the menu bar.\n */\n get menus(): ReadonlyArray {\n return this._menus;\n }\n\n /**\n * Open the active menu and activate its first menu item.\n *\n * #### Notes\n * If there is no active menu, this is a no-op.\n */\n openActiveMenu(): void {\n // Bail early if there is no active item.\n if (this._activeIndex === -1) {\n return;\n }\n\n // Open the child menu.\n this._openChildMenu();\n\n // Activate the first item in the child menu.\n if (this._childMenu) {\n this._childMenu.activeIndex = -1;\n this._childMenu.activateNextItem();\n }\n }\n\n /**\n * Add a menu to the end of the menu bar.\n *\n * @param menu - The menu to add to the menu bar.\n *\n * #### Notes\n * If the menu is already added to the menu bar, it will be moved.\n */\n addMenu(menu: Menu, update: boolean = true): void {\n this.insertMenu(this._menus.length, menu, update);\n }\n\n /**\n * Insert a menu into the menu bar at the specified index.\n *\n * @param index - The index at which to insert the menu.\n *\n * @param menu - The menu to insert into the menu bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the menus.\n *\n * If the menu is already added to the menu bar, it will be moved.\n */\n insertMenu(index: number, menu: Menu, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Look up the index of the menu.\n let i = this._menus.indexOf(menu);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._menus.length));\n\n // If the menu is not in the array, insert it.\n if (i === -1) {\n // Insert the menu into the array.\n ArrayExt.insert(this._menus, j, menu);\n\n // Add the styling class to the menu.\n menu.addClass('lm-MenuBar-menu');\n\n // Connect to the menu signals.\n menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n menu.menuRequested.connect(this._onMenuMenuRequested, this);\n menu.title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the menu exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._menus.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the menu to the new locations.\n ArrayExt.move(this._menus, i, j);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove a menu from the menu bar.\n *\n * @param menu - The menu to remove from the menu bar.\n *\n * #### Notes\n * This is a no-op if the menu is not in the menu bar.\n */\n removeMenu(menu: Menu, update: boolean = true): void {\n this.removeMenuAt(this._menus.indexOf(menu), update);\n }\n\n /**\n * Remove the menu at a given index from the menu bar.\n *\n * @param index - The index of the menu to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeMenuAt(index: number, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Remove the menu from the array.\n let menu = ArrayExt.removeAt(this._menus, index);\n\n // Bail if the index is out of range.\n if (!menu) {\n return;\n }\n\n // Disconnect from the menu signals.\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n\n // Remove the styling class from the menu.\n menu.removeClass('lm-MenuBar-menu');\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove all menus from the menu bar.\n */\n clearMenus(): void {\n // Bail if there is nothing to remove.\n if (this._menus.length === 0) {\n return;\n }\n\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Disconnect from the menu signals and remove the styling class.\n for (let menu of this._menus) {\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n menu.removeClass('lm-MenuBar-menu');\n }\n\n // Clear the menus array.\n this._menus.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Handle the DOM events for the menu bar.\n *\n * @param event - The DOM event sent to the menu bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu bar's DOM nodes. It\n * should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'focusout':\n this._evtFocusOut(event as FocusEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mousedown', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('focusout', this);\n this.node.addEventListener('contextmenu', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mousedown', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('focusout', this);\n this.node.removeEventListener('contextmenu', this);\n this._closeChildMenu();\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this._focusItemAt(0);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n this.update();\n super.onResize(msg);\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let menus = this._menus;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let tabFocusIndex =\n this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n ? this._tabFocusIndex\n : 0;\n let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n let totalMenuSize = 0;\n let isVisible = false;\n\n // Check that the overflow menu doesn't count\n length = this._overflowMenu !== null ? length - 1 : length;\n let content = new Array(length);\n\n // Render visible menus\n for (let i = 0; i < length; ++i) {\n content[i] = renderer.renderItem({\n title: menus[i].title,\n active: i === activeIndex,\n tabbable: i === tabFocusIndex,\n disabled: menus[i].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = i;\n this.activeIndex = i;\n }\n });\n // Calculate size of current menu\n totalMenuSize += this._menuItemSizes[i];\n // Check if overflow menu is already rendered\n if (menus[i].title.label === this._overflowMenuOptions.title) {\n isVisible = true;\n length--;\n }\n }\n // Render overflow menu if needed and active\n if (this._overflowMenuOptions.isVisible) {\n if (this._overflowIndex > -1 && !isVisible) {\n // Create overflow menu\n if (this._overflowMenu === null) {\n const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n this._overflowMenu.title.label = overflowMenuTitle;\n this._overflowMenu.title.mnemonic = 0;\n this.addMenu(this._overflowMenu, false);\n }\n // Move menus to overflow menu\n for (let i = menus.length - 2; i >= length; i--) {\n const submenu = this.menus[i];\n submenu.title.mnemonic = 0;\n this._overflowMenu.insertItem(0, {\n type: 'submenu',\n submenu: submenu\n });\n this.removeMenu(submenu, false);\n }\n content[length] = renderer.renderItem({\n title: this._overflowMenu.title,\n active: length === activeIndex && menus[length].items.length !== 0,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n } else if (this._overflowMenu !== null) {\n // Remove submenus from overflow menu\n let overflowMenuItems = this._overflowMenu.items;\n let screenSize = this.node.offsetWidth;\n let n = this._overflowMenu.items.length;\n for (let i = 0; i < n; ++i) {\n let index = menus.length - 1 - i;\n if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n let menu = overflowMenuItems[0].submenu as Menu;\n this._overflowMenu.removeItemAt(0);\n this.insertMenu(length, menu, false);\n content[length] = renderer.renderItem({\n title: menu.title,\n active: false,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n }\n }\n if (this._overflowMenu.items.length === 0) {\n this.removeMenu(this._overflowMenu, false);\n content.pop();\n this._overflowMenu = null;\n this._overflowIndex = -1;\n }\n }\n }\n VirtualDOM.render(content, this.contentNode);\n this._updateOverflowIndex();\n }\n\n /**\n * Calculate and update the current overflow index.\n */\n private _updateOverflowIndex(): void {\n if (!this._overflowMenuOptions.isVisible) {\n return;\n }\n\n // Get elements visible in the main menu bar\n const itemMenus = this.contentNode.childNodes;\n let screenSize = this.node.offsetWidth;\n let totalMenuSize = 0;\n let index = -1;\n let n = itemMenus.length;\n\n if (this._menuItemSizes.length == 0) {\n // Check if it is the first resize and get info about menu items sizes\n for (let i = 0; i < n; i++) {\n let item = itemMenus[i] as HTMLLIElement;\n // Add sizes to array\n totalMenuSize += item.offsetWidth;\n this._menuItemSizes.push(item.offsetWidth);\n if (totalMenuSize > screenSize && index === -1) {\n index = i;\n }\n }\n } else {\n // Calculate current menu size\n for (let i = 0; i < this._menuItemSizes.length; i++) {\n totalMenuSize += this._menuItemSizes[i];\n if (totalMenuSize > screenSize) {\n index = i;\n break;\n }\n }\n }\n this._overflowIndex = index;\n }\n\n /**\n * Handle the `'keydown'` event for the menu bar.\n *\n * #### Notes\n * All keys are trapped except the tab key that is ignored.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Reset the active index on tab, but do not trap the tab key.\n if (kc === 9) {\n this.activeIndex = -1;\n return;\n }\n\n // A menu bar handles all other keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Enter, Space, Up Arrow, Down Arrow\n if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n // The active index may have changed (for example, user hovers over an\n // item with the mouse), so be sure to use the focus index.\n this.activeIndex = this._tabFocusIndex;\n if (this.activeIndex !== this._tabFocusIndex) {\n // Bail if the setter refused to set activeIndex to tabFocusIndex\n // because it means that the item at tabFocusIndex cannot be opened (for\n // example, it has an empty menu)\n return;\n }\n this.openActiveMenu();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this._closeChildMenu();\n this._focusItemAt(this.activeIndex);\n return;\n }\n\n // Left or Right Arrow\n if (kc === 37 || kc === 39) {\n let direction = kc === 37 ? -1 : 1;\n let start = this._tabFocusIndex + direction;\n let n = this._menus.length;\n for (let i = 0; i < n; i++) {\n let index = (n + start + direction * i) % n;\n if (this._menus[index].items.length) {\n this._focusItemAt(index);\n return;\n }\n }\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._menus, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that menu is opened.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.openActiveMenu();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n this._focusItemAt(this.activeIndex);\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n this._focusItemAt(this.activeIndex);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the menu bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the mouse press was not on the menu bar. This can occur\n // when the document listener is installed for an active menu bar.\n if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n return;\n }\n\n // Stop the propagation of the event. Immediate propagation is\n // also stopped so that an open menu does not handle the event.\n event.stopPropagation();\n event.stopImmediatePropagation();\n\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // If the press was not on an item, close the child menu.\n if (index === -1) {\n this._closeChildMenu();\n return;\n }\n\n // If the press was not the left mouse button, do nothing further.\n if (event.button !== 0) {\n return;\n }\n\n // Otherwise, toggle the open state of the child menu.\n if (this._childMenu) {\n this._closeChildMenu();\n this.activeIndex = index;\n } else {\n // If we don't call preventDefault() here, then the item in the menu\n // bar will take focus over the menu that is being opened.\n event.preventDefault();\n const position = this._positionForMenu(index);\n Menu.saveWindowData();\n // Begin DOM modifications.\n this.activeIndex = index;\n this._openChildMenu(position);\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the menu bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the active index will not change.\n if (index === this._activeIndex) {\n return;\n }\n\n // Bail early if a child menu is open and the mouse is not over\n // an item. This allows the child menu to be kept open when the\n // mouse is over the empty part of the menu bar.\n if (index === -1 && this._childMenu) {\n return;\n }\n\n // Get position for the new menu >before< updating active index.\n const position =\n index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n // Before any modification, update window data.\n Menu.saveWindowData();\n\n // Begin DOM modifications.\n\n // Update the active index to the hovered item.\n this.activeIndex = index;\n\n // Open the new menu if a menu is already open.\n if (position) {\n this._openChildMenu(position);\n }\n }\n\n /**\n * Find initial position for the menu based on menubar item position.\n *\n * NOTE: this should be called before updating active index to avoid\n * an additional layout and style invalidation as changing active\n * index modifies DOM.\n */\n private _positionForMenu(index: number): Private.IPosition {\n let itemNode = this.contentNode.children[index];\n let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n return {\n top: bottom,\n left\n };\n }\n\n /**\n * Handle the `'focusout'` event for the menu bar.\n */\n private _evtFocusOut(event: FocusEvent): void {\n // Reset the active index if there is no open menu and the menubar is losing focus.\n if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n this.activeIndex = -1;\n }\n }\n\n /**\n * Focus an item in the menu bar.\n *\n * #### Notes\n * Does not open the associated menu.\n */\n private _focusItemAt(index: number): void {\n const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n if (itemNode) {\n itemNode.focus();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if there is no active menu.\n */\n private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n // If there is no active menu, close the current menu.\n let newMenu = this.activeMenu;\n if (!newMenu) {\n this._closeChildMenu();\n return;\n }\n\n // Bail if there is no effective menu change.\n let oldMenu = this._childMenu;\n if (oldMenu === newMenu) {\n return;\n }\n\n // Swap the internal menu reference.\n this._childMenu = newMenu;\n\n // Close the current menu, or setup for the new menu.\n if (oldMenu) {\n oldMenu.close();\n } else {\n document.addEventListener('mousedown', this, true);\n }\n\n // Update the tab focus index and ensure the menu bar is updated.\n this._tabFocusIndex = this.activeIndex;\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n // Get the positioning data for the new menu.\n let { left, top } = options;\n if (typeof left === 'undefined' || typeof top === 'undefined') {\n ({ left, top } = this._positionForMenu(this._activeIndex));\n }\n // Begin DOM modifications\n\n if (!oldMenu) {\n // Continue setup for new menu\n this.addClass('lm-mod-active');\n }\n\n // Open the new menu at the computed location.\n if (newMenu.items.length > 0) {\n newMenu.open(left, top, this._forceItemsPosition);\n }\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n // Bail if no child menu is open.\n if (!this._childMenu) {\n return;\n }\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n let menu = this._childMenu;\n this._childMenu = null;\n\n // Close the menu.\n menu.close();\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `aboutToClose` signal of a menu.\n */\n private _onMenuAboutToClose(sender: Menu): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n this._childMenu = null;\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `menuRequested` signal of a child menu.\n */\n private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Look up the active index and menu count.\n let i = this._activeIndex;\n let n = this._menus.length;\n\n // Active the next requested index.\n switch (args) {\n case 'next':\n this.activeIndex = i === n - 1 ? 0 : i + 1;\n break;\n case 'previous':\n this.activeIndex = i === 0 ? n - 1 : i - 1;\n break;\n }\n\n // Open the active menu.\n this.openActiveMenu();\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(): void {\n this.update();\n }\n\n // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n private _activeIndex = -1;\n // Track which item can be focused using the TAB key. Unlike _activeIndex will\n // always point to a menuitem. Whenever you update this value, it's important\n // to follow it with an \"update-request\" message so that the `tabindex`\n // attribute on each menubar item gets properly updated.\n private _tabFocusIndex = 0;\n private _forceItemsPosition: Menu.IOpenOptions;\n private _overflowMenuOptions: IOverflowMenuOptions;\n private _menus: Menu[] = [];\n private _childMenu: Menu | null = null;\n private _overflowMenu: Menu | null = null;\n private _menuItemSizes: number[] = [];\n private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n /**\n * An options object for creating a menu bar.\n */\n export interface IOptions {\n /**\n * A custom renderer for creating menu bar content.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n /**\n * Whether to force the position of the menu. The MenuBar forces the\n * coordinates of its menus by default. With this option you can disable it.\n *\n * Setting to `false` will enable the logic which repositions the\n * coordinates of the menu if it will not fit entirely on screen.\n *\n * The default is `true`.\n */\n forceItemsPosition?: Menu.IOpenOptions;\n /**\n * Whether to add a overflow menu if there's overflow.\n *\n * Setting to `true` will enable the logic that creates an overflow menu\n * to show the menu items that don't fit entirely on the screen.\n *\n * The default is `true`.\n */\n overflowMenuOptions?: IOverflowMenuOptions;\n }\n\n /**\n * An object which holds the data to render a menu bar item.\n */\n export interface IRenderData {\n /**\n * The title to be rendered.\n */\n readonly title: Title;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the user can tab to the item.\n */\n readonly tabbable: boolean;\n\n /**\n * Whether the item is disabled.\n *\n * #### Notes\n * A disabled item cannot be active.\n * A disabled item cannot be focussed.\n */\n readonly disabled?: boolean;\n\n readonly onfocus?: (event: FocusEvent) => void;\n }\n\n /**\n * A renderer for use with a menu bar.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n\n /**\n * Render the icon element for a menu bar item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.title.icon is undefined, it will be ignored.\n return h.div({ className }, data.title.icon!, data.title.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n }\n\n /**\n * Create the class name for the menu bar item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n let name = 'lm-MenuBar-item';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.active && !data.disabled) {\n name += ' lm-mod-active';\n }\n return name;\n }\n\n /**\n * Create the dataset for a menu bar item.\n *\n * @param data - The data to use for the item.\n *\n * @returns The dataset for the menu bar item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the aria attributes for menu bar item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n return {\n role: 'menuitem',\n 'aria-haspopup': 'true',\n 'aria-disabled': data.disabled ? 'true' : 'false'\n };\n }\n\n /**\n * Create the class name for the menu bar item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-MenuBar-itemIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.title;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n /**\n * Determines if a overflow menu appears when the menu items overflow.\n *\n * Defaults to `true`.\n */\n isVisible: boolean;\n /**\n * Determines the title of the overflow menu.\n *\n * Default: `...`.\n */\n title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a menu bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-MenuBar-content';\n node.appendChild(content);\n content.setAttribute('role', 'menubar');\n return node;\n }\n\n /**\n * Position for the menu relative to top-left screen corner.\n */\n export interface IPosition {\n /**\n * Pixels right from screen origin.\n */\n left: number;\n /**\n * Pixels down from screen origin.\n */\n top: number;\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n menus: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = menus.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Look up the menu title.\n let title = menus[k].title;\n\n // Ignore titles with an empty label.\n if (title.label.length === 0) {\n continue;\n }\n\n // Look up the mnemonic index for the label.\n let mn = title.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < title.label.length) {\n if (title.label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n /**\n * Construct a new scroll bar.\n *\n * @param options - The options for initializing the scroll bar.\n */\n constructor(options: ScrollBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-ScrollBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n\n // Set the orientation.\n this._orientation = options.orientation || 'vertical';\n this.dataset['orientation'] = this._orientation;\n\n // Parse the rest of the options.\n if (options.maximum !== undefined) {\n this._maximum = Math.max(0, options.maximum);\n }\n if (options.page !== undefined) {\n this._page = Math.max(0, options.page);\n }\n if (options.value !== undefined) {\n this._value = Math.max(0, Math.min(options.value, this._maximum));\n }\n }\n\n /**\n * A signal emitted when the user moves the scroll thumb.\n *\n * #### Notes\n * The payload is the current value of the scroll bar.\n */\n get thumbMoved(): ISignal {\n return this._thumbMoved;\n }\n\n /**\n * A signal emitted when the user clicks a step button.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get stepRequested(): ISignal {\n return this._stepRequested;\n }\n\n /**\n * A signal emitted when the user clicks the scroll track.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get pageRequested(): ISignal {\n return this._pageRequested;\n }\n\n /**\n * Get the orientation of the scroll bar.\n */\n get orientation(): ScrollBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the scroll bar.\n */\n set orientation(value: ScrollBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making changes.\n this._releaseMouse();\n\n // Update the internal orientation.\n this._orientation = value;\n this.dataset['orientation'] = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the current value of the scroll bar.\n */\n get value(): number {\n return this._value;\n }\n\n /**\n * Set the current value of the scroll bar.\n *\n * #### Notes\n * The value will be clamped to the range `[0, maximum]`.\n */\n set value(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Do nothing if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the page size of the scroll bar.\n *\n * #### Notes\n * The page size is the amount of visible content in the scrolled\n * region, expressed in data units. It determines the size of the\n * scroll bar thumb.\n */\n get page(): number {\n return this._page;\n }\n\n /**\n * Set the page size of the scroll bar.\n *\n * #### Notes\n * The page size will be clamped to the range `[0, Infinity]`.\n */\n set page(value: number) {\n // Clamp the page size to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._page === value) {\n return;\n }\n\n // Update the internal page size.\n this._page = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the maximum value of the scroll bar.\n */\n get maximum(): number {\n return this._maximum;\n }\n\n /**\n * Set the maximum value of the scroll bar.\n *\n * #### Notes\n * The max size will be clamped to the range `[0, Infinity]`.\n */\n set maximum(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._maximum === value) {\n return;\n }\n\n // Update the internal values.\n this._maximum = value;\n\n // Clamp the current value to the new range.\n this._value = Math.min(this._value, value);\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * The scroll bar decrement button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get decrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar increment button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get incrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[1] as HTMLDivElement;\n }\n\n /**\n * The scroll bar track node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get trackNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-track'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar thumb node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get thumbNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-thumb'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Handle the DOM events for the scroll bar.\n *\n * @param event - The DOM event sent to the scroll bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the scroll bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A method invoked on a 'before-attach' message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('mousedown', this);\n this.update();\n }\n\n /**\n * A method invoked on an 'after-detach' message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n }\n\n /**\n * A method invoked on an 'update-request' message.\n */\n protected onUpdateRequest(msg: Message): void {\n // Convert the value and page into percentages.\n let value = (this._value * 100) / this._maximum;\n let page = (this._page * 100) / (this._page + this._maximum);\n\n // Clamp the value and page to the relevant range.\n value = Math.max(0, Math.min(value, 100));\n page = Math.max(0, Math.min(page, 100));\n\n // Fetch the thumb style.\n let thumbStyle = this.thumbNode.style;\n\n // Update the thumb style for the current orientation.\n if (this._orientation === 'horizontal') {\n thumbStyle.top = '';\n thumbStyle.height = '';\n thumbStyle.left = `${value}%`;\n thumbStyle.width = `${page}%`;\n thumbStyle.transform = `translate(${-value}%, 0%)`;\n } else {\n thumbStyle.left = '';\n thumbStyle.width = '';\n thumbStyle.top = `${value}%`;\n thumbStyle.height = `${page}%`;\n thumbStyle.transform = `translate(0%, ${-value}%)`;\n }\n }\n\n /**\n * Handle the `'keydown'` event for the scroll bar.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Ignore anything except the `Escape` key.\n if (event.keyCode !== 27) {\n return;\n }\n\n // Fetch the previous scroll value.\n let value = this._pressData ? this._pressData.value : -1;\n\n // Release the mouse.\n this._releaseMouse();\n\n // Restore the old scroll value if possible.\n if (value !== -1) {\n this._moveThumb(value);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the scroll bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Do nothing if it's not a left mouse press.\n if (event.button !== 0) {\n return;\n }\n\n // Send an activate request to the scroll bar. This can be\n // used by message hooks to activate something relevant.\n this.activate();\n\n // Do nothing if the mouse is already captured.\n if (this._pressData) {\n return;\n }\n\n // Find the pressed scroll bar part.\n let part = Private.findPart(this, event.target as HTMLElement);\n\n // Do nothing if the part is not of interest.\n if (!part) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Override the mouse cursor.\n let override = Drag.overrideCursor('default');\n\n // Set up the press data.\n this._pressData = {\n part,\n override,\n delta: -1,\n value: -1,\n mouseX: event.clientX,\n mouseY: event.clientY\n };\n\n // Add the extra event listeners.\n document.addEventListener('mousemove', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Handle a thumb press.\n if (part === 'thumb') {\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Update the press data delta for the current orientation.\n if (this._orientation === 'horizontal') {\n this._pressData.delta = event.clientX - thumbRect.left;\n } else {\n this._pressData.delta = event.clientY - thumbRect.top;\n }\n\n // Add the active class to the thumb node.\n thumbNode.classList.add('lm-mod-active');\n\n // Store the current value in the press data.\n this._pressData.value = this._value;\n\n // Finished.\n return;\n }\n\n // Handle a track press.\n if (part === 'track') {\n // Fetch the client rect for the thumb.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n\n // Handle a decrement button press.\n if (part === 'decrement') {\n // Add the active class to the decrement node.\n this.decrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button press.\n if (part === 'increment') {\n // Add the active class to the increment node.\n this.incrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the scroll bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Do nothing if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Update the mouse position.\n this._pressData.mouseX = event.clientX;\n this._pressData.mouseY = event.clientY;\n\n // Bail if the thumb is not being dragged.\n if (this._pressData.part !== 'thumb') {\n return;\n }\n\n // Get the client rect for the thumb and track.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n let trackRect = this.trackNode.getBoundingClientRect();\n\n // Fetch the scroll geometry based on the orientation.\n let trackPos: number;\n let trackSpan: number;\n if (this._orientation === 'horizontal') {\n trackPos = event.clientX - trackRect.left - this._pressData.delta;\n trackSpan = trackRect.width - thumbRect.width;\n } else {\n trackPos = event.clientY - trackRect.top - this._pressData.delta;\n trackSpan = trackRect.height - thumbRect.height;\n }\n\n // Compute the desired value from the scroll geometry.\n let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n // Move the thumb to the computed value.\n this._moveThumb(value);\n }\n\n /**\n * Handle the `'mouseup'` event for the scroll bar.\n */\n private _evtMouseUp(event: MouseEvent): void {\n // Do nothing if it's not a left mouse release.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse and restore the node states.\n */\n private _releaseMouse(): void {\n // Bail if there is no press data.\n if (!this._pressData) {\n return;\n }\n\n // Clear the repeat timer.\n clearTimeout(this._repeatTimer);\n this._repeatTimer = -1;\n\n // Clear the press data.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra event listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n\n // Remove the active classes from the nodes.\n this.thumbNode.classList.remove('lm-mod-active');\n this.decrementNode.classList.remove('lm-mod-active');\n this.incrementNode.classList.remove('lm-mod-active');\n }\n\n /**\n * Move the thumb to the specified position.\n */\n private _moveThumb(value: number): void {\n // Clamp the value to the allowed range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Bail if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update of the scroll bar.\n this.update();\n\n // Emit the thumb moved signal.\n this._thumbMoved.emit(value);\n }\n\n /**\n * A timeout callback for repeating the mouse press.\n */\n private _onRepeat = () => {\n // Clear the repeat timer id.\n this._repeatTimer = -1;\n\n // Bail if the mouse has been released.\n if (!this._pressData) {\n return;\n }\n\n // Look up the part that was pressed.\n let part = this._pressData.part;\n\n // Bail if the thumb was pressed.\n if (part === 'thumb') {\n return;\n }\n\n // Schedule the timer for another repeat.\n this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n // Get the current mouse position.\n let mouseX = this._pressData.mouseX;\n let mouseY = this._pressData.mouseY;\n\n // Handle a decrement button repeat.\n if (part === 'decrement') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button repeat.\n if (part === 'increment') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n\n // Handle a track repeat.\n if (part === 'track') {\n // Bail if the mouse is not over the track.\n if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Bail if the mouse is over the thumb.\n if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n };\n\n private _value = 0;\n private _page = 10;\n private _maximum = 100;\n private _repeatTimer = -1;\n private _orientation: ScrollBar.Orientation;\n private _pressData: Private.IPressData | null = null;\n private _thumbMoved = new Signal(this);\n private _stepRequested = new Signal(this);\n private _pageRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n /**\n * A type alias for a scroll bar orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * An options object for creating a scroll bar.\n */\n export interface IOptions {\n /**\n * The orientation of the scroll bar.\n *\n * The default is `'vertical'`.\n */\n orientation?: Orientation;\n\n /**\n * The value for the scroll bar.\n *\n * The default is `0`.\n */\n value?: number;\n\n /**\n * The page size for the scroll bar.\n *\n * The default is `10`.\n */\n page?: number;\n\n /**\n * The maximum value for the scroll bar.\n *\n * The default is `100`.\n */\n maximum?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A type alias for the parts of a scroll bar.\n */\n export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The scroll bar part which was pressed.\n */\n part: ScrollBarPart;\n\n /**\n * The offset of the press in thumb coordinates, or -1.\n */\n delta: number;\n\n /**\n * The scroll value at the time the thumb was pressed, or -1.\n */\n value: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n\n /**\n * The current X position of the mouse.\n */\n mouseX: number;\n\n /**\n * The current Y position of the mouse.\n */\n mouseY: number;\n }\n\n /**\n * Create the DOM node for a scroll bar.\n */\n export function createNode(): HTMLElement {\n let node = document.createElement('div');\n let decrement = document.createElement('div');\n let increment = document.createElement('div');\n let track = document.createElement('div');\n let thumb = document.createElement('div');\n decrement.className = 'lm-ScrollBar-button';\n increment.className = 'lm-ScrollBar-button';\n decrement.dataset['action'] = 'decrement';\n increment.dataset['action'] = 'increment';\n track.className = 'lm-ScrollBar-track';\n thumb.className = 'lm-ScrollBar-thumb';\n track.appendChild(thumb);\n node.appendChild(decrement);\n node.appendChild(track);\n node.appendChild(increment);\n return node;\n }\n\n /**\n * Find the scroll bar part which contains the given target.\n */\n export function findPart(\n scrollBar: ScrollBar,\n target: HTMLElement\n ): ScrollBarPart | null {\n // Test the thumb.\n if (scrollBar.thumbNode.contains(target)) {\n return 'thumb';\n }\n\n // Test the track.\n if (scrollBar.trackNode.contains(target)) {\n return 'track';\n }\n\n // Test the decrement button.\n if (scrollBar.decrementNode.contains(target)) {\n return 'decrement';\n }\n\n // Test the increment button.\n if (scrollBar.incrementNode.contains(target)) {\n return 'increment';\n }\n\n // Indicate no match.\n return null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this._widget) {\n let widget = this._widget;\n this._widget = null;\n widget.dispose();\n }\n super.dispose();\n }\n\n /**\n * Get the child widget for the layout.\n */\n get widget(): Widget | null {\n return this._widget;\n }\n\n /**\n * Set the child widget for the layout.\n *\n * #### Notes\n * Setting the child widget will cause the old child widget to be\n * automatically disposed. If that is not desired, set the parent\n * of the old child to `null` before assigning a new child.\n */\n set widget(widget: Widget | null) {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n if (widget) {\n widget.parent = this.parent;\n }\n\n // Bail early if the widget does not change.\n if (this._widget === widget) {\n return;\n }\n\n // Dispose of the old child widget.\n if (this._widget) {\n this._widget.dispose();\n }\n\n // Update the internal widget.\n this._widget = widget;\n\n // Attach the new child widget if needed.\n if (this.parent && widget) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n if (this._widget) {\n yield this._widget;\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Bail early if the widget does not exist in the layout.\n if (this._widget !== widget) {\n return;\n }\n\n // Clear the internal widget.\n this._widget = null;\n\n // If the layout is parented, detach the widget from the DOM.\n if (this.parent) {\n this.detachWidget(widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n constructor(options: StackedLayout.IOptions = {}) {\n super(options);\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n if (this.widgets.length > 1) {\n this.widgets.forEach(w => {\n w.hiddenMode = this._hiddenMode;\n });\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n this._items.length > 0\n ) {\n if (this._items.length === 1) {\n this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n }\n widget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n widget.hiddenMode = Widget.HiddenMode.Display;\n }\n\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Reset the z-index for the widget.\n item!.widget.node.style.zIndex = '';\n\n // Reset the hidden mode for the widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n widget.hiddenMode = Widget.HiddenMode.Display;\n\n // Reset the hidden mode for the first widget if necessary.\n if (this._items.length === 1) {\n this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n }\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the computed minimum size.\n minW = Math.max(minW, item.minWidth);\n minH = Math.max(minH, item.minHeight);\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the widget stacking order and layout geometry.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Set the z-index for the widget.\n item.widget.node.style.zIndex = `${i}`;\n\n // Update the item geometry.\n item.update(left, top, width, height);\n }\n }\n\n private _dirty = false;\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n /**\n * An options object for initializing a stacked layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n /**\n * Construct a new stacked panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: StackedPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-StackedPanel');\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as StackedLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as StackedLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when a widget is removed from a stacked panel.\n */\n get widgetRemoved(): ISignal {\n return this._widgetRemoved;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-StackedPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-StackedPanel-child');\n this._widgetRemoved.emit(msg.child);\n }\n\n private _widgetRemoved = new Signal(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n /**\n * An options object for creating a stacked panel.\n */\n export interface IOptions {\n /**\n * The stacked layout to use for the stacked panel.\n *\n * The default is a new `StackedLayout`.\n */\n layout?: StackedLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a stacked layout for the given panel options.\n */\n export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n return options.layout || new StackedLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n constructor(options: TabPanel.IOptions = {}) {\n super();\n this.addClass('lm-TabPanel');\n\n // Create the tab bar and stacked panel.\n this.tabBar = new TabBar(options);\n this.tabBar.addClass('lm-TabPanel-tabBar');\n this.stackedPanel = new StackedPanel();\n this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n // Connect the tab bar signal handlers.\n this.tabBar.tabMoved.connect(this._onTabMoved, this);\n this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n this.tabBar.tabActivateRequested.connect(\n this._onTabActivateRequested,\n this\n );\n this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Connect the stacked panel signal handlers.\n this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n // Get the data related to the placement.\n this._tabPlacement = options.tabPlacement || 'top';\n let direction = Private.directionFromPlacement(this._tabPlacement);\n let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = this._tabPlacement;\n\n // Create the box layout.\n let layout = new BoxLayout({ direction, spacing: 0 });\n\n // Set the stretch factors for the child widgets.\n BoxLayout.setStretch(this.tabBar, 0);\n BoxLayout.setStretch(this.stackedPanel, 1);\n\n // Add the child widgets to the layout.\n layout.addWidget(this.tabBar);\n layout.addWidget(this.stackedPanel);\n\n // Install the layout on the tab panel.\n this.layout = layout;\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal {\n return this._currentChanged;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this.tabBar.currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `-1`.\n */\n set currentIndex(value: number) {\n this.tabBar.currentIndex = value;\n }\n\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get currentWidget(): Widget | null {\n let title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n }\n\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set currentWidget(value: Widget | null) {\n this.tabBar.currentTitle = value ? value.title : null;\n }\n\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get tabsMovable(): boolean {\n return this.tabBar.tabsMovable;\n }\n\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set tabsMovable(value: boolean) {\n this.tabBar.tabsMovable = value;\n }\n\n /**\n * Get the whether the add button is enabled.\n *\n */\n get addButtonEnabled(): boolean {\n return this.tabBar.addButtonEnabled;\n }\n\n /**\n * Set the whether the add button is enabled.\n *\n */\n set addButtonEnabled(value: boolean) {\n this.tabBar.addButtonEnabled = value;\n }\n\n /**\n * Get the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n get tabPlacement(): TabPanel.TabPlacement {\n return this._tabPlacement;\n }\n\n /**\n * Set the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n set tabPlacement(value: TabPanel.TabPlacement) {\n // Bail if the placement does not change.\n if (this._tabPlacement === value) {\n return;\n }\n\n // Update the internal value.\n this._tabPlacement = value;\n\n // Get the values related to the placement.\n let direction = Private.directionFromPlacement(value);\n let orientation = Private.orientationFromPlacement(value);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = value;\n\n // Update the layout direction.\n (this.layout as BoxLayout).direction = direction;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The tab bar used by the tab panel.\n *\n * #### Notes\n * Modifying the tab bar directly can lead to undefined behavior.\n */\n readonly tabBar: TabBar;\n\n /**\n * The stacked panel used by the tab panel.\n *\n * #### Notes\n * Modifying the panel directly can lead to undefined behavior.\n */\n readonly stackedPanel: StackedPanel;\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return this.stackedPanel.widgets;\n }\n\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this.widgets.length, widget);\n }\n\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n insertWidget(index: number, widget: Widget): void {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.stackedPanel.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n\n widget.node.setAttribute('role', 'tabpanel');\n\n let renderer = this.tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n // Extract the widgets from the titles.\n let previousWidget = previousTitle ? previousTitle.owner : null;\n let currentWidget = currentTitle ? currentTitle.owner : null;\n\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex,\n previousWidget,\n currentIndex,\n currentWidget\n });\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n }\n\n /**\n * Handle the `tabAddRequested` signal from the tab bar.\n */\n private _onTabAddRequested(sender: TabBar, args: void): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n private _onTabMoved(\n sender: TabBar,\n args: TabBar.ITabMovedArgs\n ): void {\n this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n }\n\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n this.tabBar.removeTab(widget.title);\n }\n\n private _tabPlacement: TabPanel.TabPlacement;\n private _currentChanged = new Signal(\n this\n );\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n /**\n * A type alias for tab placement in a tab bar.\n */\n export type TabPlacement =\n | /**\n * The tabs are placed as a row above the content.\n */\n 'top'\n\n /**\n * The tabs are placed as a column to the left of the content.\n */\n | 'left'\n\n /**\n * The tabs are placed as a column to the right of the content.\n */\n | 'right'\n\n /**\n * The tabs are placed as a row below the content.\n */\n | 'bottom';\n\n /**\n * An options object for initializing a tab panel.\n */\n export interface IOptions {\n /**\n * The document to use with the tab panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether the button to add new tabs is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The placement of the tab bar relative to the content.\n *\n * The default is `'top'`.\n */\n tabPlacement?: TabPlacement;\n\n /**\n * The renderer for the panel's tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: TabBar.IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n previousIndex: number;\n\n /**\n * The previously selected widget.\n */\n previousWidget: Widget | null;\n\n /**\n * The currently selected index.\n */\n currentIndex: number;\n\n /**\n * The currently selected widget.\n */\n currentWidget: Widget | null;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Convert a tab placement to tab bar orientation.\n */\n export function orientationFromPlacement(\n plc: TabPanel.TabPlacement\n ): TabBar.Orientation {\n return placementToOrientationMap[plc];\n }\n\n /**\n * Convert a tab placement to a box layout direction.\n */\n export function directionFromPlacement(\n plc: TabPanel.TabPlacement\n ): BoxLayout.Direction {\n return placementToDirectionMap[plc];\n }\n\n /**\n * A mapping of tab placement to tab bar orientation.\n */\n const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n top: 'horizontal',\n left: 'vertical',\n right: 'vertical',\n bottom: 'horizontal'\n };\n\n /**\n * A mapping of tab placement to box layout direction.\n */\n const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n top: 'top-to-bottom',\n left: 'left-to-right',\n right: 'right-to-left',\n bottom: 'bottom-to-top'\n };\n}\n"],"names":["Private","Utils"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;;;;;;AAM+E;AAE/E;;;;;;;;;AASG;MACU,QAAQ,CAAA;AAArB,IAAA,WAAA,GAAA;AACE;;;;;;;;;;;;AAYG;QACH,IAAQ,CAAA,QAAA,GAAG,CAAC,CAAC;AAEb;;;;;;;;;;;;AAYG;QACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;AAEZ;;;;;;;;;;;;AAYG;QACH,IAAO,CAAA,OAAA,GAAG,QAAQ,CAAC;AAEnB;;;;;;;;;;;;;;;AAeG;QACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;AAEZ;;;;;;;;;;;AAWG;QACH,IAAI,CAAA,IAAA,GAAG,CAAC,CAAC;AAET;;;;;;;AAOG;QACH,IAAI,CAAA,IAAA,GAAG,KAAK,CAAC;KACd;AAAA,CAAA;AAED;;AAEG;AACG,IAAW,UA0XhB;AA1XD,CAAA,UAAiB,SAAS,EAAA;AACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DG;AACH,IAAA,SAAgB,IAAI,CAAC,MAA2B,EAAE,KAAa,EAAA;;AAE7D,QAAA,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;QAC1B,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AA,OAAO,yBAAyB,CAAC,GAAG,CAAC,CAAC;KACvC;AAJe,IAAA,OAAA,CAAA,wBAAwB,2BAIvC,CAAA;AAED;;AAEG;IACH,SAAgB,sBAAsB,CACpC,GAA0B,EAAA;AAE1B,QAAA,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC;KACrC;AAJe,IAAA,OAAA,CAAA,sBAAsB,yBAIrC,CAAA;AAED;;AAEG;AACH,IAAA,MAAM,yBAAyB,GAA0C;AACvE,QAAA,GAAG,EAAE,YAAY;AACjB,QAAA,IAAI,EAAE,UAAU;AAChB,QAAA,KAAK,EAAE,UAAU;AACjB,QAAA,MAAM,EAAE,YAAY;KACrB,CAAC;AAEF;;AAEG;AACH,IAAA,MAAM,uBAAuB,GAA2C;AACtE,QAAA,GAAG,EAAE,eAAe;AACpB,QAAA,IAAI,EAAE,eAAe;AACrB,QAAA,KAAK,EAAE,eAAe;AACtB,QAAA,MAAM,EAAE,eAAe;KACxB,CAAC;AACJ,CAAC,EAtCS,OAAO,KAAP,OAAO,GAsChB,EAAA,CAAA,CAAA;;;;"} +\ No newline at end of file +diff --git a/node_modules/@lumino/widgets/dist/index.js b/node_modules/@lumino/widgets/dist/index.js +index 89799d1..f50f43a 100644 +--- a/node_modules/@lumino/widgets/dist/index.js ++++ b/node_modules/@lumino/widgets/dist/index.js +@@ -6521,7 +6521,7 @@ + this.node.addEventListener('mouseenter', this); + this.node.addEventListener('mouseleave', this); + this.node.addEventListener('contextmenu', this); +- document.addEventListener('mousedown', this, true); ++ this.node.ownerDocument.addEventListener('mousedown', this, true); + } + /** + * A message handler invoked on an `'after-detach'` message. +@@ -6533,7 +6533,7 @@ + this.node.removeEventListener('mouseenter', this); + this.node.removeEventListener('mouseleave', this); + this.node.removeEventListener('contextmenu', this); +- document.removeEventListener('mousedown', this, true); ++ this.node.ownerDocument.removeEventListener('mousedown', this, true); + } + /** + * A message handler invoked on an `'activate-request'` message. +@@ -7299,7 +7299,7 @@ + style.opacity = '0'; + style.maxHeight = `${maxHeight}px`; + // Attach the menu to the document. +- Widget.attach(submenu, document.body); ++ Widget.attach(submenu, itemNode.ownerDocument.body); + // Measure the size of the menu. + let { width, height } = node.getBoundingClientRect(); + // Compute the box sizing for the menu. +@@ -13192,10 +13192,6 @@ + if (value < 0 || value >= this._menus.length) { + value = -1; + } +- // An empty menu cannot be active +- if (value > -1 && this._menus[value].items.length === 0) { +- value = -1; +- } + // Bail early if the index will not change. + if (this._activeIndex === value) { + return; +diff --git a/node_modules/@lumino/widgets/dist/index.js.map b/node_modules/@lumino/widgets/dist/index.js.map +index 47394ea..105a520 100644 +--- a/node_modules/@lumino/widgets/dist/index.js.map ++++ b/node_modules/@lumino/widgets/dist/index.js.map +@@ -1 +1 @@ +-{"version":3,"file":"index.js","sources":["../src/boxengine.ts","../src/title.ts","../src/widget.ts","../src/layout.ts","../src/panellayout.ts","../src/utils.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/focustracker.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/stackedpanel.ts","../src/tabpanel.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n /**\n * The preferred size for the sizer.\n *\n * #### Notes\n * The sizer will be given this initial size subject to its size\n * bounds. The sizer will not deviate from this size unless such\n * deviation is required to fit into the available layout space.\n *\n * There is no limit to this value, but it will be clamped to the\n * bounds defined by {@link minSize} and {@link maxSize}.\n *\n * The default value is `0`.\n */\n sizeHint = 0;\n\n /**\n * The minimum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized less than this value, even if\n * it means the sizer will overflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity)`\n * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `0`.\n */\n minSize = 0;\n\n /**\n * The maximum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized greater than this value, even if\n * it means the sizer will underflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity]`\n * and that it is `>=` to {@link minSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `Infinity`.\n */\n maxSize = Infinity;\n\n /**\n * The stretch factor for the sizer.\n *\n * #### Notes\n * This controls how much the sizer stretches relative to its sibling\n * sizers when layout space is distributed. A stretch factor of zero\n * is special and will cause the sizer to only be resized after all\n * other sizers with a stretch factor greater than zero have been\n * resized to their limits.\n *\n * It is assumed that this value is an integer that lies in the range\n * `[0, Infinity)`. Failure to adhere to this constraint will yield\n * undefined results.\n *\n * The default value is `1`.\n */\n stretch = 1;\n\n /**\n * The computed size of the sizer.\n *\n * #### Notes\n * This value is the output of a call to {@link BoxEngine.calc}. It represents\n * the computed size for the object along the layout orientation,\n * and will always lie in the range `[minSize, maxSize]`.\n *\n * This value is output only.\n *\n * Changing this value will have no effect.\n */\n size = 0;\n\n /**\n * An internal storage property for the layout algorithm.\n *\n * #### Notes\n * This value is used as temporary storage by the layout algorithm.\n *\n * Changing this value will have no effect.\n */\n done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n /**\n * Calculate the optimal layout sizes for a sequence of box sizers.\n *\n * This distributes the available layout space among the box sizers\n * according to the following algorithm:\n *\n * 1. Initialize the sizers's size to its size hint and compute the\n * sums for each of size hint, min size, and max size.\n *\n * 2. If the total size hint equals the available space, return.\n *\n * 3. If the available space is less than the total min size, set all\n * sizers to their min size and return.\n *\n * 4. If the available space is greater than the total max size, set\n * all sizers to their max size and return.\n *\n * 5. If the layout space is less than the total size hint, distribute\n * the negative delta as follows:\n *\n * a. Shrink each sizer with a stretch factor greater than zero by\n * an amount proportional to the negative space and the sum of\n * stretch factors. If the sizer reaches its min size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains negative\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its min size,\n * remove it from the computation.\n *\n * 6. If the layout space is greater than the total size hint,\n * distribute the positive delta as follows:\n *\n * a. Expand each sizer with a stretch factor greater than zero by\n * an amount proportional to the postive space and the sum of\n * stretch factors. If the sizer reaches its max size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains positive\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its max size,\n * remove it from the computation.\n *\n * 7. return\n *\n * @param sizers - The sizers for a particular layout line.\n *\n * @param space - The available layout space for the sizers.\n *\n * @returns The delta between the provided available space and the\n * actual consumed space. This value will be zero if the sizers\n * can be adjusted to fit, negative if the available space is too\n * small, and positive if the available space is too large.\n *\n * #### Notes\n * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n *\n * This function can be called at any time to recompute the layout for\n * an existing sequence of sizers. The previously computed results will\n * have no effect on the new output. It is therefore not necessary to\n * create new sizer objects on each resize event.\n */\n export function calc(sizers: ArrayLike, space: number): number {\n // Bail early if there is nothing to do.\n let count = sizers.length;\n if (count === 0) {\n return space;\n }\n\n // Setup the size and stretch counters.\n let totalMin = 0;\n let totalMax = 0;\n let totalSize = 0;\n let totalStretch = 0;\n let stretchCount = 0;\n\n // Setup the sizers and compute the totals.\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n let min = sizer.minSize;\n let max = sizer.maxSize;\n let hint = sizer.sizeHint;\n sizer.done = false;\n sizer.size = Math.max(min, Math.min(hint, max));\n totalSize += sizer.size;\n totalMin += min;\n totalMax += max;\n if (sizer.stretch > 0) {\n totalStretch += sizer.stretch;\n stretchCount++;\n }\n }\n\n // If the space is equal to the total size, return early.\n if (space === totalSize) {\n return 0;\n }\n\n // If the space is less than the total min, minimize each sizer.\n if (space <= totalMin) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.minSize;\n }\n return space - totalMin;\n }\n\n // If the space is greater than the total max, maximize each sizer.\n if (space >= totalMax) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.maxSize;\n }\n return space - totalMax;\n }\n\n // The loops below perform sub-pixel precision sizing. A near zero\n // value is used for compares instead of zero to ensure that the\n // loop terminates when the subdivided space is reasonably small.\n let nearZero = 0.01;\n\n // A counter which is decremented each time a sizer is resized to\n // its limit. This ensures the loops terminate even if there is\n // space remaining to distribute.\n let notDoneCount = count;\n\n // Distribute negative delta space.\n if (space < totalSize) {\n // Shrink each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its min size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = totalSize - space;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n }\n // Distribute positive delta space.\n else {\n // Expand each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its max size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = space - totalSize;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n }\n\n // Indicate that the consumed space equals the available space.\n return 0;\n }\n\n /**\n * Adjust a sizer by a delta and update its neighbors accordingly.\n *\n * @param sizers - The sizers which should be adjusted.\n *\n * @param index - The index of the sizer to grow.\n *\n * @param delta - The amount to adjust the sizer, positive or negative.\n *\n * #### Notes\n * This will adjust the indicated sizer by the specified amount, along\n * with the sizes of the appropriate neighbors, subject to the limits\n * specified by each of the sizers.\n *\n * This is useful when implementing box layouts where the boundaries\n * between the sizers are interactively adjustable by the user.\n */\n export function adjust(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Bail early when there is nothing to do.\n if (sizers.length === 0 || delta === 0) {\n return;\n }\n\n // Dispatch to the proper implementation.\n if (delta > 0) {\n growSizer(sizers, index, delta);\n } else {\n shrinkSizer(sizers, index, -delta);\n }\n }\n\n /**\n * Grow a sizer by a positive delta and adjust neighbors.\n */\n function growSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the left can expand.\n let growLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the right can shrink.\n let shrinkLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the left by the delta.\n let grow = delta;\n for (let i = index; i >= 0 && grow > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the right by the delta.\n let shrink = delta;\n for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n\n /**\n * Shrink a sizer by a positive delta and adjust neighbors.\n */\n function shrinkSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the right can expand.\n let growLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the left can shrink.\n let shrinkLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the right by the delta.\n let grow = delta;\n for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the left by the delta.\n let shrink = delta;\n for (let i = index; i >= 0 && shrink > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title implements IDisposable {\n /**\n * Construct a new title.\n *\n * @param options - The options for initializing the title.\n */\n constructor(options: Title.IOptions) {\n this.owner = options.owner;\n if (options.label !== undefined) {\n this._label = options.label;\n }\n if (options.mnemonic !== undefined) {\n this._mnemonic = options.mnemonic;\n }\n if (options.icon !== undefined) {\n this._icon = options.icon;\n }\n\n if (options.iconClass !== undefined) {\n this._iconClass = options.iconClass;\n }\n if (options.iconLabel !== undefined) {\n this._iconLabel = options.iconLabel;\n }\n if (options.caption !== undefined) {\n this._caption = options.caption;\n }\n if (options.className !== undefined) {\n this._className = options.className;\n }\n if (options.closable !== undefined) {\n this._closable = options.closable;\n }\n this._dataset = options.dataset || {};\n }\n\n /**\n * A signal emitted when the state of the title changes.\n */\n get changed(): ISignal {\n return this._changed;\n }\n\n /**\n * The object which owns the title.\n */\n readonly owner: T;\n\n /**\n * Get the label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get label(): string {\n return this._label;\n }\n\n /**\n * Set the label for the title.\n */\n set label(value: string) {\n if (this._label === value) {\n return;\n }\n this._label = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the mnemonic index for the title.\n *\n * #### Notes\n * The default value is `-1`.\n */\n get mnemonic(): number {\n return this._mnemonic;\n }\n\n /**\n * Set the mnemonic index for the title.\n */\n set mnemonic(value: number) {\n if (this._mnemonic === value) {\n return;\n }\n this._mnemonic = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon renderer for the title.\n *\n * #### Notes\n * The default value is undefined.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._icon;\n }\n\n /**\n * Set the icon renderer for the title.\n *\n * #### Notes\n * A renderer is an object that supplies a render and unrender function.\n */\n set icon(value: VirtualElement.IRenderer | undefined) {\n if (this._icon === value) {\n return;\n }\n this._icon = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconClass(): string {\n return this._iconClass;\n }\n\n /**\n * Set the icon class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconClass(value: string) {\n if (this._iconClass === value) {\n return;\n }\n this._iconClass = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconLabel(): string {\n return this._iconLabel;\n }\n\n /**\n * Set the icon label for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconLabel(value: string) {\n if (this._iconLabel === value) {\n return;\n }\n this._iconLabel = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the caption for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get caption(): string {\n return this._caption;\n }\n\n /**\n * Set the caption for the title.\n */\n set caption(value: string) {\n if (this._caption === value) {\n return;\n }\n this._caption = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the extra class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get className(): string {\n return this._className;\n }\n\n /**\n * Set the extra class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set className(value: string) {\n if (this._className === value) {\n return;\n }\n this._className = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the closable state for the title.\n *\n * #### Notes\n * The default value is `false`.\n */\n get closable(): boolean {\n return this._closable;\n }\n\n /**\n * Set the closable state for the title.\n *\n * #### Notes\n * This controls the presence of a close icon when applicable.\n */\n set closable(value: boolean) {\n if (this._closable === value) {\n return;\n }\n this._closable = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the dataset for the title.\n *\n * #### Notes\n * The default value is an empty dataset.\n */\n get dataset(): Title.Dataset {\n return this._dataset;\n }\n\n /**\n * Set the dataset for the title.\n *\n * #### Notes\n * This controls the data attributes when applicable.\n */\n set dataset(value: Title.Dataset) {\n if (this._dataset === value) {\n return;\n }\n this._dataset = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Test whether the title has been disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the title.\n *\n * #### Notes\n * It is the responsibility of the owner to call the title disposal.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n\n Signal.clearData(this);\n }\n\n private _label = '';\n private _caption = '';\n private _mnemonic = -1;\n private _icon: VirtualElement.IRenderer | undefined = undefined;\n private _iconClass = '';\n private _iconLabel = '';\n private _className = '';\n private _closable = false;\n private _dataset: Title.Dataset;\n private _changed = new Signal(this);\n private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n /**\n * A type alias for a simple immutable string dataset.\n */\n export type Dataset = { readonly [key: string]: string };\n\n /**\n * An options object for initializing a title.\n */\n export interface IOptions {\n /**\n * The object which owns the title.\n */\n owner: T;\n\n /**\n * The label for the title.\n */\n label?: string;\n\n /**\n * The mnemonic index for the title.\n */\n mnemonic?: number;\n\n /**\n * The icon renderer for the title.\n */\n icon?: VirtualElement.IRenderer;\n\n /**\n * The icon class name for the title.\n */\n iconClass?: string;\n\n /**\n * The icon label for the title.\n */\n iconLabel?: string;\n\n /**\n * The caption for the title.\n */\n caption?: string;\n\n /**\n * The extra class name for the title.\n */\n className?: string;\n\n /**\n * The closable state for the title.\n */\n closable?: boolean;\n\n /**\n * The dataset for the title.\n */\n dataset?: Dataset;\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n ConflatableMessage,\n IMessageHandler,\n Message,\n MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n /**\n * Construct a new widget.\n *\n * @param options - The options for initializing the widget.\n */\n constructor(options: Widget.IOptions = {}) {\n this.node = Private.createNode(options);\n this.addClass('lm-Widget');\n }\n\n /**\n * Dispose of the widget and its descendant widgets.\n *\n * #### Notes\n * It is unsafe to use the widget after it has been disposed.\n *\n * All calls made to this method after the first are a no-op.\n */\n dispose(): void {\n // Do nothing if the widget is already disposed.\n if (this.isDisposed) {\n return;\n }\n\n // Set the disposed flag and emit the disposed signal.\n this.setFlag(Widget.Flag.IsDisposed);\n this._disposed.emit(undefined);\n\n // Remove or detach the widget if necessary.\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n\n // Dispose of the widget layout.\n if (this._layout) {\n this._layout.dispose();\n this._layout = null;\n }\n\n // Dispose the title\n this.title.dispose();\n\n // Clear the extra data associated with the widget.\n Signal.clearData(this);\n MessageLoop.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * A signal emitted when the widget is disposed.\n */\n get disposed(): ISignal {\n return this._disposed;\n }\n\n /**\n * Get the DOM node owned by the widget.\n */\n readonly node: HTMLElement;\n\n /**\n * Test whether the widget has been disposed.\n */\n get isDisposed(): boolean {\n return this.testFlag(Widget.Flag.IsDisposed);\n }\n\n /**\n * Test whether the widget's node is attached to the DOM.\n */\n get isAttached(): boolean {\n return this.testFlag(Widget.Flag.IsAttached);\n }\n\n /**\n * Test whether the widget is explicitly hidden.\n */\n get isHidden(): boolean {\n return this.testFlag(Widget.Flag.IsHidden);\n }\n\n /**\n * Test whether the widget is visible.\n *\n * #### Notes\n * A widget is visible when it is attached to the DOM, is not\n * explicitly hidden, and has no explicitly hidden ancestors.\n */\n get isVisible(): boolean {\n return this.testFlag(Widget.Flag.IsVisible);\n }\n\n /**\n * The title object for the widget.\n *\n * #### Notes\n * The title object is used by some container widgets when displaying\n * the widget alongside some title, such as a tab panel or side bar.\n *\n * Since not all widgets will use the title, it is created on demand.\n *\n * The `owner` property of the title is set to this widget.\n */\n get title(): Title {\n return Private.titleProperty.get(this);\n }\n\n /**\n * Get the id of the widget's DOM node.\n */\n get id(): string {\n return this.node.id;\n }\n\n /**\n * Set the id of the widget's DOM node.\n */\n set id(value: string) {\n this.node.id = value;\n }\n\n /**\n * The dataset for the widget's DOM node.\n */\n get dataset(): DOMStringMap {\n return this.node.dataset;\n }\n\n /**\n * Get the method for hiding the widget.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding the widget.\n */\n set hiddenMode(value: Widget.HiddenMode) {\n if (this._hiddenMode === value) {\n return;\n }\n\n if (this.isHidden) {\n // Reset styles set by previous mode.\n this._toggleHidden(false);\n }\n\n if (value == Widget.HiddenMode.Scale) {\n this.node.style.willChange = 'transform';\n } else {\n this.node.style.willChange = 'auto';\n }\n\n this._hiddenMode = value;\n\n if (this.isHidden) {\n // Set styles for new mode.\n this._toggleHidden(true);\n }\n }\n\n /**\n * Get the parent of the widget.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent of the widget.\n *\n * #### Notes\n * Children are typically added to a widget by using a layout, which\n * means user code will not normally set the parent widget directly.\n *\n * The widget will be automatically removed from its old parent.\n *\n * This is a no-op if there is no effective parent change.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (value && this.contains(value)) {\n throw new Error('Invalid parent widget.');\n }\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-removed', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n this._parent = value;\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-added', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n if (!this.isDisposed) {\n MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n }\n }\n\n /**\n * Get the layout for the widget.\n */\n get layout(): Layout | null {\n return this._layout;\n }\n\n /**\n * Set the layout for the widget.\n *\n * #### Notes\n * The layout is single-use only. It cannot be changed after the\n * first assignment.\n *\n * The layout is disposed automatically when the widget is disposed.\n */\n set layout(value: Layout | null) {\n if (this._layout === value) {\n return;\n }\n if (this.testFlag(Widget.Flag.DisallowLayout)) {\n throw new Error('Cannot set widget layout.');\n }\n if (this._layout) {\n throw new Error('Cannot change widget layout.');\n }\n if (value!.parent) {\n throw new Error('Cannot change layout parent.');\n }\n this._layout = value;\n value!.parent = this;\n }\n\n /**\n * Create an iterator over the widget's children.\n *\n * @returns A new iterator over the children of the widget.\n *\n * #### Notes\n * The widget must have a populated layout in order to have children.\n *\n * If a layout is not installed, the returned iterator will be empty.\n */\n *children(): IterableIterator {\n if (this._layout) {\n yield* this._layout;\n }\n }\n\n /**\n * Test whether a widget is a descendant of this widget.\n *\n * @param widget - The descendant widget of interest.\n *\n * @returns `true` if the widget is a descendant, `false` otherwise.\n */\n contains(widget: Widget): boolean {\n for (let value: Widget | null = widget; value; value = value._parent) {\n if (value === this) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Test whether the widget's DOM node has the given class name.\n *\n * @param name - The class name of interest.\n *\n * @returns `true` if the node has the class, `false` otherwise.\n */\n hasClass(name: string): boolean {\n return this.node.classList.contains(name);\n }\n\n /**\n * Add a class name to the widget's DOM node.\n *\n * @param name - The class name to add to the node.\n *\n * #### Notes\n * If the class name is already added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n addClass(name: string): void {\n this.node.classList.add(name);\n }\n\n /**\n * Remove a class name from the widget's DOM node.\n *\n * @param name - The class name to remove from the node.\n *\n * #### Notes\n * If the class name is not yet added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n removeClass(name: string): void {\n this.node.classList.remove(name);\n }\n\n /**\n * Toggle a class name on the widget's DOM node.\n *\n * @param name - The class name to toggle on the node.\n *\n * @param force - Whether to force add the class (`true`) or force\n * remove the class (`false`). If not provided, the presence of\n * the class will be toggled from its current state.\n *\n * @returns `true` if the class is now present, `false` otherwise.\n *\n * #### Notes\n * The class name must not contain whitespace.\n */\n toggleClass(name: string, force?: boolean): boolean {\n if (force === true) {\n this.node.classList.add(name);\n return true;\n }\n if (force === false) {\n this.node.classList.remove(name);\n return false;\n }\n return this.node.classList.toggle(name);\n }\n\n /**\n * Post an `'update-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n update(): void {\n MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n }\n\n /**\n * Post a `'fit-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n fit(): void {\n MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n }\n\n /**\n * Post an `'activate-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n activate(): void {\n MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n }\n\n /**\n * Send a `'close-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for sending the message.\n */\n close(): void {\n MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n }\n\n /**\n * Show the widget and make it visible to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `false`.\n *\n * If the widget is not explicitly hidden, this is a no-op.\n */\n show(): void {\n if (!this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n }\n this.clearFlag(Widget.Flag.IsHidden);\n this._toggleHidden(false);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-shown', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Hide the widget and make it hidden to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `true`.\n *\n * If the widget is explicitly hidden, this is a no-op.\n */\n hide(): void {\n if (this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n }\n this.setFlag(Widget.Flag.IsHidden);\n this._toggleHidden(true);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-hidden', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Show or hide the widget according to a boolean value.\n *\n * @param hidden - `true` to hide the widget, or `false` to show it.\n *\n * #### Notes\n * This is a convenience method for `hide()` and `show()`.\n */\n setHidden(hidden: boolean): void {\n if (hidden) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Test whether the given widget flag is set.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n testFlag(flag: Widget.Flag): boolean {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * Set the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n setFlag(flag: Widget.Flag): void {\n this._flags |= flag;\n }\n\n /**\n * Clear the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n clearFlag(flag: Widget.Flag): void {\n this._flags &= ~flag;\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n *\n * #### Notes\n * Subclasses may reimplement this method as needed.\n */\n processMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.notifyLayout(msg);\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.notifyLayout(msg);\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.notifyLayout(msg);\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.notifyLayout(msg);\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.setFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.notifyLayout(msg);\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.clearFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.notifyLayout(msg);\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n this.setFlag(Widget.Flag.IsVisible);\n }\n this.setFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.notifyLayout(msg);\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.clearFlag(Widget.Flag.IsVisible);\n this.clearFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterDetach(msg);\n break;\n case 'activate-request':\n this.notifyLayout(msg);\n this.onActivateRequest(msg);\n break;\n case 'close-request':\n this.notifyLayout(msg);\n this.onCloseRequest(msg);\n break;\n case 'child-added':\n this.notifyLayout(msg);\n this.onChildAdded(msg as Widget.ChildMessage);\n break;\n case 'child-removed':\n this.notifyLayout(msg);\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n default:\n this.notifyLayout(msg);\n break;\n }\n }\n\n /**\n * Invoke the message processing routine of the widget's layout.\n *\n * @param msg - The message to dispatch to the layout.\n *\n * #### Notes\n * This is a no-op if the widget does not have a layout.\n *\n * This will not typically be called directly by user code.\n */\n protected notifyLayout(msg: Message): void {\n if (this._layout) {\n this._layout.processParentMessage(msg);\n }\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n *\n * #### Notes\n * The default implementation unparents or detaches the widget.\n */\n protected onCloseRequest(msg: Message): void {\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onResize(msg: Widget.ResizeMessage): void {}\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onUpdateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onActivateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeShow(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterShow(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeHide(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterHide(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-added'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n private _toggleHidden(hidden: boolean) {\n if (hidden) {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.addClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = 'scale(0)';\n this.node.setAttribute('aria-hidden', 'true');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = 'hidden';\n this.node.style.zIndex = '-1';\n break;\n }\n } else {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.removeClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = '';\n this.node.removeAttribute('aria-hidden');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = '';\n this.node.style.zIndex = '';\n break;\n }\n }\n }\n\n private _flags = 0;\n private _layout: Layout | null = null;\n private _parent: Widget | null = null;\n private _disposed = new Signal(this);\n private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n /**\n * An options object for initializing a widget.\n */\n export interface IOptions {\n /**\n * The optional node to use for the widget.\n *\n * If a node is provided, the widget will assume full ownership\n * and control of the node, as if it had created the node itself.\n *\n * The default is a new `
`.\n */\n node?: HTMLElement;\n\n /**\n * The optional element tag, used for constructing the widget's node.\n *\n * If a pre-constructed node is provided via the `node` arg, this\n * value is ignored.\n */\n tag?: keyof HTMLElementTagNameMap;\n }\n\n /**\n * The method for hiding the widget.\n *\n * The default is Display.\n *\n * Using `Scale` will often increase performance as most browsers will not\n * trigger style computation for the `transform` action. This should be used\n * sparingly and tested, since increasing the number of composition layers\n * may slow things down.\n *\n * To ensure the transformation does not trigger style recomputation, you\n * may need to set the widget CSS style `will-change: transform`. This\n * should be used only when needed as it may overwhelm the browser with a\n * high number of layers. See\n * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n */\n export enum HiddenMode {\n /**\n * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n * CSS from the standard Lumino CSS.\n */\n Display = 0,\n\n /**\n * Hide the widget by setting the `transform` to `'scale(0)'`.\n */\n Scale,\n\n /**\n *Hide the widget by setting the `content-visibility` to `'hidden'`.\n */\n ContentVisibility\n }\n\n /**\n * An enum of widget bit flags.\n */\n export enum Flag {\n /**\n * The widget has been disposed.\n */\n IsDisposed = 0x1,\n\n /**\n * The widget is attached to the DOM.\n */\n IsAttached = 0x2,\n\n /**\n * The widget is hidden.\n */\n IsHidden = 0x4,\n\n /**\n * The widget is visible.\n */\n IsVisible = 0x8,\n\n /**\n * A layout cannot be set on the widget.\n */\n DisallowLayout = 0x10\n }\n\n /**\n * A collection of stateless messages related to widgets.\n */\n export namespace Msg {\n /**\n * A singleton `'before-show'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const BeforeShow = new Message('before-show');\n\n /**\n * A singleton `'after-show'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const AfterShow = new Message('after-show');\n\n /**\n * A singleton `'before-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const BeforeHide = new Message('before-hide');\n\n /**\n * A singleton `'after-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const AfterHide = new Message('after-hide');\n\n /**\n * A singleton `'before-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is attached.\n */\n export const BeforeAttach = new Message('before-attach');\n\n /**\n * A singleton `'after-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is attached.\n */\n export const AfterAttach = new Message('after-attach');\n\n /**\n * A singleton `'before-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is detached.\n */\n export const BeforeDetach = new Message('before-detach');\n\n /**\n * A singleton `'after-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is detached.\n */\n export const AfterDetach = new Message('after-detach');\n\n /**\n * A singleton `'parent-changed'` message.\n *\n * #### Notes\n * This message is sent to a widget when its parent has changed.\n */\n export const ParentChanged = new Message('parent-changed');\n\n /**\n * A singleton conflatable `'update-request'` message.\n *\n * #### Notes\n * This message can be dispatched to supporting widgets in order to\n * update their content based on the current widget state. Not all\n * widgets will respond to messages of this type.\n *\n * For widgets with a layout, this message will inform the layout to\n * update the position and size of its child widgets.\n */\n export const UpdateRequest = new ConflatableMessage('update-request');\n\n /**\n * A singleton conflatable `'fit-request'` message.\n *\n * #### Notes\n * For widgets with a layout, this message will inform the layout to\n * recalculate its size constraints to fit the space requirements of\n * its child widgets, and to update their position and size. Not all\n * layouts will respond to messages of this type.\n */\n export const FitRequest = new ConflatableMessage('fit-request');\n\n /**\n * A singleton conflatable `'activate-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should\n * perform the actions necessary to activate the widget, which\n * may include focusing its node or descendant node.\n */\n export const ActivateRequest = new ConflatableMessage('activate-request');\n\n /**\n * A singleton conflatable `'close-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should close\n * and remove itself from the widget hierarchy.\n */\n export const CloseRequest = new ConflatableMessage('close-request');\n }\n\n /**\n * A message class for child related messages.\n */\n export class ChildMessage extends Message {\n /**\n * Construct a new child message.\n *\n * @param type - The message type.\n *\n * @param child - The child widget for the message.\n */\n constructor(type: string, child: Widget) {\n super(type);\n this.child = child;\n }\n\n /**\n * The child widget for the message.\n */\n readonly child: Widget;\n }\n\n /**\n * A message class for `'resize'` messages.\n */\n export class ResizeMessage extends Message {\n /**\n * Construct a new resize message.\n *\n * @param width - The **offset width** of the widget, or `-1` if\n * the width is not known.\n *\n * @param height - The **offset height** of the widget, or `-1` if\n * the height is not known.\n */\n constructor(width: number, height: number) {\n super('resize');\n this.width = width;\n this.height = height;\n }\n\n /**\n * The offset width of the widget.\n *\n * #### Notes\n * This will be `-1` if the width is unknown.\n */\n readonly width: number;\n\n /**\n * The offset height of the widget.\n *\n * #### Notes\n * This will be `-1` if the height is unknown.\n */\n readonly height: number;\n }\n\n /**\n * The namespace for the `ResizeMessage` class statics.\n */\n export namespace ResizeMessage {\n /**\n * A singleton `'resize'` message with an unknown size.\n */\n export const UnknownSize = new ResizeMessage(-1, -1);\n }\n\n /**\n * Attach a widget to a host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * @param host - The DOM node to use as the widget's host.\n *\n * @param ref - The child of `host` to use as the reference element.\n * If this is provided, the widget will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * widget to be added as the last child of the host.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget, if\n * the widget is already attached, or if the host is not attached\n * to the DOM.\n */\n export function attach(\n widget: Widget,\n host: HTMLElement,\n ref: HTMLElement | null = null\n ): void {\n if (widget.parent) {\n throw new Error('Cannot attach a child widget.');\n }\n if (widget.isAttached || widget.node.isConnected) {\n throw new Error('Widget is already attached.');\n }\n if (!host.isConnected) {\n throw new Error('Host is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n host.insertBefore(widget.node, ref);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n /**\n * Detach the widget from its host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget,\n * or if the widget is not attached to the DOM.\n */\n export function detach(widget: Widget): void {\n if (widget.parent) {\n throw new Error('Cannot detach a child widget.');\n }\n if (!widget.isAttached || !widget.node.isConnected) {\n throw new Error('Widget is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n widget.node.parentNode!.removeChild(widget.node);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An attached property for the widget title object.\n */\n export const titleProperty = new AttachedProperty>({\n name: 'title',\n create: owner => new Title({ owner })\n });\n\n /**\n * Create a DOM node for the given widget options.\n */\n export function createNode(options: Widget.IOptions): HTMLElement {\n return options.node || document.createElement(options.tag || 'div');\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable, IDisposable {\n /**\n * Construct a new layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: Layout.IOptions = {}) {\n this._fitPolicy = options.fitPolicy || 'set-min-size';\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This should be reimplemented to clear and dispose of the widgets.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n this._parent = null;\n this._disposed = true;\n Signal.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * Test whether the layout is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Get the parent widget of the layout.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent widget of the layout.\n *\n * #### Notes\n * This is set automatically when installing the layout on the parent\n * widget. The parent widget should not be set directly by user code.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (this._parent) {\n throw new Error('Cannot change parent widget.');\n }\n if (value!.layout !== this) {\n throw new Error('Invalid parent widget.');\n }\n this._parent = value;\n this.init();\n }\n\n /**\n * Get the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n get fitPolicy(): Layout.FitPolicy {\n return this._fitPolicy;\n }\n\n /**\n * Set the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n *\n * Changing the fit policy will clear the current size constraint\n * for the parent widget and then re-fit the parent.\n */\n set fitPolicy(value: Layout.FitPolicy) {\n // Bail if the policy does not change\n if (this._fitPolicy === value) {\n return;\n }\n\n // Update the internal policy.\n this._fitPolicy = value;\n\n // Clear the size constraints and schedule a fit of the parent.\n if (this._parent) {\n let style = this._parent.node.style;\n style.minWidth = '';\n style.minHeight = '';\n style.maxWidth = '';\n style.maxHeight = '';\n this._parent.fit();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This abstract method must be implemented by a subclass.\n */\n abstract [Symbol.iterator](): IterableIterator;\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method should *not* modify the widget's `parent`.\n */\n abstract removeWidget(widget: Widget): void;\n\n /**\n * Process a message sent to the parent widget.\n *\n * @param msg - The message sent to the parent widget.\n *\n * #### Notes\n * This method is called by the parent widget to process a message.\n *\n * Subclasses may reimplement this method as needed.\n */\n processParentMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.onAfterDetach(msg);\n break;\n case 'child-removed':\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n case 'child-shown':\n this.onChildShown(msg as Widget.ChildMessage);\n break;\n case 'child-hidden':\n this.onChildHidden(msg as Widget.ChildMessage);\n break;\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n *\n * #### Notes\n * This method is invoked immediately after the layout is installed\n * on the parent widget.\n *\n * The default implementation reparents all of the widgets to the\n * layout parent widget.\n *\n * Subclasses should reimplement this method and attach the child\n * widget nodes to the parent widget's node.\n */\n protected init(): void {\n for (const widget of this) {\n widget.parent = this.parent;\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the specified layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the available layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onUpdateRequest(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * This will remove the child widget from the layout.\n *\n * Subclasses should **not** typically reimplement this method.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n this.removeWidget(msg.child);\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n private _disposed = false;\n private _fitPolicy: Layout.FitPolicy;\n private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n /**\n * A type alias for the layout fit policy.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n export type FitPolicy =\n | /**\n * No size constraint will be applied to the parent widget.\n */\n 'set-no-constraint'\n\n /**\n * The computed min size will be applied to the parent widget.\n */\n | 'set-min-size';\n\n /**\n * An options object for initializing a layout.\n */\n export interface IOptions {\n /**\n * The fit policy for the layout.\n *\n * The default is `'set-min-size'`.\n */\n fitPolicy?: FitPolicy;\n }\n\n /**\n * A type alias for the horizontal alignment of a widget.\n */\n export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n /**\n * A type alias for the vertical alignment of a widget.\n */\n export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n /**\n * Get the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The horizontal alignment for the widget.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n */\n export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n return Private.horizontalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the horizontal alignment.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setHorizontalAlignment(\n widget: Widget,\n value: HorizontalAlignment\n ): void {\n Private.horizontalAlignmentProperty.set(widget, value);\n }\n\n /**\n * Get the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The vertical alignment for the widget.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n */\n export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n return Private.verticalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the vertical alignment.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setVerticalAlignment(\n widget: Widget,\n value: VerticalAlignment\n ): void {\n Private.verticalAlignmentProperty.set(widget, value);\n }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n /**\n * Construct a new layout item.\n *\n * @param widget - The widget to be managed by the item.\n *\n * #### Notes\n * The widget will be set to absolute positioning.\n * The widget will use strict CSS containment.\n */\n constructor(widget: Widget) {\n this.widget = widget;\n this.widget.node.style.position = 'absolute';\n this.widget.node.style.contain = 'strict';\n }\n\n /**\n * Dispose of the the layout item.\n *\n * #### Notes\n * This will reset the positioning of the widget.\n */\n dispose(): void {\n // Do nothing if the item is already disposed.\n if (this._disposed) {\n return;\n }\n\n // Mark the item as disposed.\n this._disposed = true;\n\n // Reset the widget style.\n let style = this.widget.node.style;\n style.position = '';\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n style.contain = '';\n }\n\n /**\n * The widget managed by the layout item.\n */\n readonly widget: Widget;\n\n /**\n * The computed minimum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minWidth(): number {\n return this._minWidth;\n }\n\n /**\n * The computed minimum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minHeight(): number {\n return this._minHeight;\n }\n\n /**\n * The computed maximum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxWidth(): number {\n return this._maxWidth;\n }\n\n /**\n * The computed maximum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxHeight(): number {\n return this._maxHeight;\n }\n\n /**\n * Whether the layout item is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Whether the managed widget is hidden.\n */\n get isHidden(): boolean {\n return this.widget.isHidden;\n }\n\n /**\n * Whether the managed widget is visible.\n */\n get isVisible(): boolean {\n return this.widget.isVisible;\n }\n\n /**\n * Whether the managed widget is attached.\n */\n get isAttached(): boolean {\n return this.widget.isAttached;\n }\n\n /**\n * Update the computed size limits of the managed widget.\n */\n fit(): void {\n let limits = ElementExt.sizeLimits(this.widget.node);\n this._minWidth = limits.minWidth;\n this._minHeight = limits.minHeight;\n this._maxWidth = limits.maxWidth;\n this._maxHeight = limits.maxHeight;\n }\n\n /**\n * Update the position and size of the managed widget.\n *\n * @param left - The left edge position of the layout box.\n *\n * @param top - The top edge position of the layout box.\n *\n * @param width - The width of the layout box.\n *\n * @param height - The height of the layout box.\n */\n update(left: number, top: number, width: number, height: number): void {\n // Clamp the size to the computed size limits.\n let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n // Adjust the left edge for the horizontal alignment, if needed.\n if (clampW < width) {\n switch (Layout.getHorizontalAlignment(this.widget)) {\n case 'left':\n break;\n case 'center':\n left += (width - clampW) / 2;\n break;\n case 'right':\n left += width - clampW;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Adjust the top edge for the vertical alignment, if needed.\n if (clampH < height) {\n switch (Layout.getVerticalAlignment(this.widget)) {\n case 'top':\n break;\n case 'center':\n top += (height - clampH) / 2;\n break;\n case 'bottom':\n top += height - clampH;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Set up the resize variables.\n let resized = false;\n let style = this.widget.node.style;\n\n // Update the top edge of the widget if needed.\n if (this._top !== top) {\n this._top = top;\n style.top = `${top}px`;\n }\n\n // Update the left edge of the widget if needed.\n if (this._left !== left) {\n this._left = left;\n style.left = `${left}px`;\n }\n\n // Update the width of the widget if needed.\n if (this._width !== clampW) {\n resized = true;\n this._width = clampW;\n style.width = `${clampW}px`;\n }\n\n // Update the height of the widget if needed.\n if (this._height !== clampH) {\n resized = true;\n this._height = clampH;\n style.height = `${clampH}px`;\n }\n\n // Send a resize message to the widget if needed.\n if (resized) {\n let msg = new Widget.ResizeMessage(clampW, clampH);\n MessageLoop.sendMessage(this.widget, msg);\n }\n }\n\n private _top = NaN;\n private _left = NaN;\n private _width = NaN;\n private _height = NaN;\n private _minWidth = 0;\n private _minHeight = 0;\n private _maxWidth = Infinity;\n private _maxHeight = Infinity;\n private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The attached property for a widget horizontal alignment.\n */\n export const horizontalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.HorizontalAlignment\n >({\n name: 'horizontalAlignment',\n create: () => 'center',\n changed: onAlignmentChanged\n });\n\n /**\n * The attached property for a widget vertical alignment.\n */\n export const verticalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.VerticalAlignment\n >({\n name: 'verticalAlignment',\n create: () => 'top',\n changed: onAlignmentChanged\n });\n\n /**\n * The change handler for the attached alignment properties.\n */\n function onAlignmentChanged(child: Widget): void {\n if (child.parent && child.parent.layout) {\n child.parent.update();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n while (this._widgets.length > 0) {\n this._widgets.pop()!.dispose();\n }\n super.dispose();\n }\n\n /**\n * A read-only array of the widgets in the layout.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n yield* this._widgets;\n }\n\n /**\n * Add a widget to the end of the layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, it will be moved.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this._widgets.length, widget);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n widget.parent = this.parent;\n\n // Look up the current index of the widget.\n let i = this._widgets.indexOf(widget);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._widgets.length));\n\n // If the widget is not in the array, insert it.\n if (i === -1) {\n // Insert the widget into the array.\n ArrayExt.insert(this._widgets, j, widget);\n\n // If the layout is parented, attach the widget to the DOM.\n if (this.parent) {\n this.attachWidget(j, widget);\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the widget exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._widgets.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the widget to the new location.\n ArrayExt.move(this._widgets, i, j);\n\n // If the layout is parented, move the widget in the DOM.\n if (this.parent) {\n this.moveWidget(i, j, widget);\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n this.removeWidgetAt(this._widgets.indexOf(widget));\n }\n\n /**\n * Remove the widget at a given index from the layout.\n *\n * @param index - The index of the widget to remove.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n removeWidgetAt(index: number): void {\n // Remove the widget from the array.\n let widget = ArrayExt.removeAt(this._widgets, index);\n\n // If the layout is parented, detach the widget from the DOM.\n if (widget && this.parent) {\n this.detachWidget(index, widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n let index = 0;\n for (const widget of this) {\n this.attachWidget(index++, widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[index];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation moves the widget's node to the proper\n * location in the parent's node and sends the appropriate attach and\n * detach messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is moved in the parent's node.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` and message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[toIndex];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widgets: Widget[] = [];\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n /**\n * Clamp a dimension value to an integer >= 0.\n */\n export function clampDimension(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n /**\n * Construct a new split layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: SplitLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.orientation !== undefined) {\n this._orientation = options.orientation;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n this._handles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the split layout.\n */\n readonly renderer: SplitLayout.IRenderer;\n\n /**\n * Get the layout orientation for the split layout.\n */\n get orientation(): SplitLayout.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the layout orientation for the split layout.\n */\n set orientation(value: SplitLayout.Orientation) {\n if (this._orientation === value) {\n return;\n }\n this._orientation = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['orientation'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n get alignment(): SplitLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n set alignment(value: SplitLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the split layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the split layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the split handles in the layout.\n */\n get handles(): ReadonlyArray {\n return this._handles;\n }\n\n /**\n * Get the absolute sizes of the widgets in the layout.\n *\n * @returns A new array of the absolute sizes of the widgets.\n *\n * This method **does not** measure the DOM nodes.\n */\n absoluteSizes(): number[] {\n return this._sizers.map(sizer => sizer.size);\n }\n\n /**\n * Get the relative sizes of the widgets in the layout.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return Private.normalize(this._sizers.map(sizer => sizer.size));\n }\n\n /**\n * Set the relative sizes for the widgets in the layout.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n // Copy the sizes and pad with zeros as needed.\n let n = this._sizers.length;\n let temp = sizes.slice(0, n);\n while (temp.length < n) {\n temp.push(0);\n }\n\n // Normalize the padded sizes.\n let normed = Private.normalize(temp);\n\n // Apply the normalized sizes to the sizers.\n for (let i = 0; i < n; ++i) {\n let sizer = this._sizers[i];\n sizer.sizeHint = normed[i];\n sizer.size = normed[i];\n }\n\n // Set the flag indicating the sizes are normalized.\n this._hasNormedSizes = true;\n\n // Trigger an update of the parent widget.\n if (update && this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Move the offset position of a split handle.\n *\n * @param index - The index of the handle of the interest.\n *\n * @param position - The desired offset position of the handle.\n *\n * #### Notes\n * The position is relative to the offset parent.\n *\n * This will move the handle as close as possible to the desired\n * position. The sibling widgets will be adjusted as necessary.\n */\n moveHandle(index: number, position: number): void {\n // Bail if the index is invalid or the handle is hidden.\n let handle = this._handles[index];\n if (!handle || handle.classList.contains('lm-mod-hidden')) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (this._orientation === 'horizontal') {\n delta = position - handle.offsetLeft;\n } else {\n delta = position - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent widget resizing unless needed.\n for (let sizer of this._sizers) {\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(this._sizers, index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['orientation'] = this.orientation;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create the item, handle, and sizer for the new widget.\n let item = new LayoutItem(widget);\n let handle = Private.createHandle(this.renderer);\n let average = Private.averageSize(this._sizers);\n let sizer = Private.createSizer(average);\n\n // Insert the item, handle, and sizer into the internal arrays.\n ArrayExt.insert(this._items, index, item);\n ArrayExt.insert(this._sizers, index, sizer);\n ArrayExt.insert(this._handles, index, handle);\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget and handle nodes to the parent.\n this.parent!.node.appendChild(widget.node);\n this.parent!.node.appendChild(handle);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the item, sizer, and handle for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n ArrayExt.move(this._handles, fromIndex, toIndex);\n\n // Post a fit request to the parent to show/hide last handle.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the item, handle, and sizer for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n let handle = ArrayExt.removeAt(this._handles, index);\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget and handle nodes from the parent.\n this.parent!.node.removeChild(widget.node);\n this.parent!.node.removeChild(handle!);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const item = this._items[i];\n if (item.isHidden) {\n return;\n }\n\n // Fetch the style for the handle.\n let handleStyle = this._handles[i].style;\n\n // Update the widget and handle, and advance the relevant edge.\n if (isHorizontal) {\n left += this.widgetOffset;\n item.update(left, top, size, height);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${this._spacing}px`;\n handleStyle.height = `${height}px`;\n } else {\n top += this.widgetOffset;\n item.update(left, top, width, size);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${this._spacing}px`;\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Update the handles and track the visible widget count.\n let nVisible = 0;\n let lastHandleIndex = -1;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n if (this._items[i].isHidden) {\n this._handles[i].classList.add('lm-mod-hidden');\n } else {\n this._handles[i].classList.remove('lm-mod-hidden');\n lastHandleIndex = i;\n nVisible++;\n }\n }\n\n // Hide the handle for the last visible widget.\n if (lastHandleIndex !== -1) {\n this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n }\n\n // Update the fixed space for the visible items.\n this._fixed =\n this._spacing * Math.max(0, nVisible - 1) +\n this.widgetOffset * this._items.length;\n\n // Setup the computed minimum size.\n let horz = this._orientation === 'horizontal';\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed size limits.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // Prevent resizing unless necessary.\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the stretch factor.\n sizer.stretch = SplitLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0 && this.widgetOffset === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Set up the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n let horz = this._orientation === 'horizontal';\n\n if (nVisible > 0) {\n // Compute the adjusted layout space.\n let space: number;\n if (horz) {\n // left += this.widgetOffset;\n space = Math.max(0, width - this._fixed);\n } else {\n // top += this.widgetOffset;\n space = Math.max(0, height - this._fixed);\n }\n\n // Scale the size hints if they are normalized.\n if (this._hasNormedSizes) {\n for (let sizer of this._sizers) {\n sizer.sizeHint *= space;\n }\n this._hasNormedSizes = false;\n }\n\n // Distribute the layout space to the box sizers.\n let delta = BoxEngine.calc(this._sizers, space);\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n const item = this._items[i];\n\n // Fetch the computed size for the widget.\n const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n this.updateItemPosition(\n i,\n horz,\n horz ? left + offset : left,\n horz ? top : top + offset,\n height,\n width,\n size\n );\n\n const fullOffset =\n this.widgetOffset +\n (this._handles[i].classList.contains('lm-mod-hidden')\n ? 0\n : this._spacing);\n\n if (horz) {\n left += size + fullOffset;\n } else {\n top += size + fullOffset;\n }\n }\n }\n\n protected widgetOffset = 0;\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _hasNormedSizes = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _handles: HTMLDivElement[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: SplitLayout.Alignment = 'start';\n private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n /**\n * A type alias for a split layout orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a split layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a split layout.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split layout.\n */\n renderer: IRenderer;\n\n /**\n * The orientation of the layout.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a split layout.\n */\n export interface IRenderer {\n /**\n * Create a new handle for use with a split layout.\n *\n * @returns A new handle element.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * Get the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Create a new box sizer with the given size hint.\n */\n export function createSizer(size: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = Math.floor(size);\n return sizer;\n }\n\n /**\n * Create a new split handle node using the given renderer.\n */\n export function createHandle(\n renderer: SplitLayout.IRenderer\n ): HTMLDivElement {\n let handle = renderer.createHandle();\n handle.style.position = 'absolute';\n // Do not use size containment to allow the handle to fill the available space\n handle.style.contain = 'style';\n return handle;\n }\n\n /**\n * Compute the average size of an array of box sizers.\n */\n export function averageSize(sizers: BoxSizer[]): number {\n return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n }\n\n /**\n * Normalize an array of values.\n */\n export function normalize(values: number[]): number[] {\n let n = values.length;\n if (n === 0) {\n return [];\n }\n let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof SplitLayout) {\n child.parent.fit();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n /**\n * Construct a new accordion layout.\n *\n * @param options - The options for initializing the layout.\n *\n * #### Notes\n * The default orientation will be vertical.\n *\n * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n */\n constructor(options: AccordionLayout.IOptions) {\n super({ ...options, orientation: options.orientation || 'vertical' });\n this.titleSpace = options.titleSpace || 22;\n }\n\n /**\n * The section title height or width depending on the orientation.\n */\n get titleSpace(): number {\n return this.widgetOffset;\n }\n set titleSpace(value: number) {\n value = Utils.clampDimension(value);\n if (this.widgetOffset === value) {\n return;\n }\n this.widgetOffset = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return this._titles;\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n\n // Clear the layout state.\n this._titles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the accordion layout.\n */\n readonly renderer: AccordionLayout.IRenderer;\n\n public updateTitle(index: number, widget: Widget): void {\n const oldTitle = this._titles[index];\n const expanded = oldTitle.classList.contains('lm-mod-expanded');\n const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n this._titles[index] = newTitle;\n\n // Add the title node to the parent before the widget.\n this.parent!.node.replaceChild(newTitle, oldTitle);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n if (!widget.id) {\n widget.id = `id-${UUID.uuid4()}`;\n }\n super.insertWidget(index, widget);\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(index: number, widget: Widget): void {\n const title = Private.createTitle(this.renderer, widget.title);\n\n ArrayExt.insert(this._titles, index, title);\n\n // Add the title node to the parent before the widget.\n this.parent!.node.appendChild(title);\n\n widget.node.setAttribute('role', 'region');\n widget.node.setAttribute('aria-labelledby', title.id);\n\n super.attachWidget(index, widget);\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n ArrayExt.move(this._titles, fromIndex, toIndex);\n super.moveWidget(fromIndex, toIndex, widget);\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n const title = ArrayExt.removeAt(this._titles, index);\n\n this.parent!.node.removeChild(title!);\n\n super.detachWidget(index, widget);\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const titleStyle = this._titles[i].style;\n\n // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n titleStyle.top = `${top}px`;\n titleStyle.left = `${left}px`;\n titleStyle.height = `${this.widgetOffset}px`;\n if (isHorizontal) {\n titleStyle.width = `${height}px`;\n } else {\n titleStyle.width = `${width}px`;\n }\n\n super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n }\n\n private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n /**\n * A type alias for a accordion layout orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion layout alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * An options object for initializing a accordion layout.\n */\n export interface IOptions extends SplitLayout.IOptions {\n /**\n * The renderer to use for the accordion layout.\n */\n renderer: IRenderer;\n\n /**\n * The section title height or width depending on the orientation.\n *\n * The default is `22`.\n */\n titleSpace?: number;\n }\n\n /**\n * A renderer for use with an accordion layout.\n */\n export interface IRenderer extends SplitLayout.IRenderer {\n /**\n * Common class name for all accordion titles.\n */\n readonly titleClassName: string;\n\n /**\n * Render the element for a section title.\n *\n * @param title - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(title: Title): HTMLElement;\n }\n}\n\nnamespace Private {\n /**\n * Create the title HTML element.\n *\n * @param renderer Accordion renderer\n * @param data Widget title\n * @returns Title HTML element\n */\n export function createTitle(\n renderer: AccordionLayout.IRenderer,\n data: Title,\n expanded: boolean = true\n ): HTMLElement {\n const title = renderer.createSectionTitle(data);\n title.style.position = 'absolute';\n title.style.contain = 'strict';\n title.setAttribute('aria-label', `${data.label} Section`);\n title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n title.setAttribute('aria-controls', data.owner.id);\n if (expanded) {\n title.classList.add('lm-mod-expanded');\n }\n return title;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n /**\n * Construct a new panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: Panel.IOptions = {}) {\n super();\n this.addClass('lm-Panel');\n this.layout = Private.createLayout(options);\n }\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return (this.layout as PanelLayout).widgets;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n (this.layout as PanelLayout).addWidget(widget);\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n (this.layout as PanelLayout).insertWidget(index, widget);\n }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n /**\n * An options object for creating a panel.\n */\n export interface IOptions {\n /**\n * The panel layout to use for the panel.\n *\n * The default is a new `PanelLayout`.\n */\n layout?: PanelLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a panel layout for the given panel options.\n */\n export function createLayout(options: Panel.IOptions): PanelLayout {\n return options.layout || new PanelLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n /**\n * Construct a new split panel.\n *\n * @param options - The options for initializing the split panel.\n */\n constructor(options: SplitPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-SplitPanel');\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n this._releaseMouse();\n super.dispose();\n }\n\n /**\n * Get the layout orientation for the split panel.\n */\n get orientation(): SplitPanel.Orientation {\n return (this.layout as SplitLayout).orientation;\n }\n\n /**\n * Set the layout orientation for the split panel.\n */\n set orientation(value: SplitPanel.Orientation) {\n (this.layout as SplitLayout).orientation = value;\n }\n\n /**\n * Get the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n get alignment(): SplitPanel.Alignment {\n return (this.layout as SplitLayout).alignment;\n }\n\n /**\n * Set the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n set alignment(value: SplitPanel.Alignment) {\n (this.layout as SplitLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the split panel.\n */\n get spacing(): number {\n return (this.layout as SplitLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the split panel.\n */\n set spacing(value: number) {\n (this.layout as SplitLayout).spacing = value;\n }\n\n /**\n * The renderer used by the split panel.\n */\n get renderer(): SplitPanel.IRenderer {\n return (this.layout as SplitLayout).renderer;\n }\n\n /**\n * A signal emitted when a split handle has moved.\n */\n get handleMoved(): ISignal {\n return this._handleMoved;\n }\n\n /**\n * A read-only array of the split handles in the panel.\n */\n get handles(): ReadonlyArray {\n return (this.layout as SplitLayout).handles;\n }\n\n /**\n * Get the relative sizes of the widgets in the panel.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return (this.layout as SplitLayout).relativeSizes();\n }\n\n /**\n * Set the relative sizes for the widgets in the panel.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n }\n\n /**\n * Handle the DOM events for the split panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * Handle the `'keydown'` event for the split panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n if (this._pressData) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the split panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the primary button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the target, if any.\n let layout = this.layout as SplitLayout;\n let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n return handle.contains(event.target as HTMLElement);\n });\n\n // Bail early if the mouse press was not on a handle.\n if (index === -1) {\n return;\n }\n\n // Stop the event when a split handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n document.addEventListener('pointerup', this, true);\n document.addEventListener('pointermove', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Compute the offset delta for the handle press.\n let delta: number;\n let handle = layout.handles[index];\n let rect = handle.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n delta = event.clientX - rect.left;\n } else {\n delta = event.clientY - rect.top;\n }\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!);\n this._pressData = { index, delta, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the split panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Stop the event when dragging a split handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let pos: number;\n let layout = this.layout as SplitLayout;\n let rect = this.node.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n pos = event.clientX - rect.left - this._pressData!.delta;\n } else {\n pos = event.clientY - rect.top - this._pressData!.delta;\n }\n\n // Move the handle as close to the desired position as possible.\n layout.moveHandle(this._pressData!.index, pos);\n }\n\n /**\n * Handle the `'pointerup'` event for the split panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the primary button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse grab for the split panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Emit the handle moved signal.\n this._handleMoved.emit();\n\n // Remove the extra document listeners.\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('pointerup', this, true);\n document.removeEventListener('pointermove', this, true);\n document.removeEventListener('contextmenu', this, true);\n }\n\n private _handleMoved = new Signal(this);\n private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n /**\n * A type alias for a split panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a split panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a split panel renderer.\n */\n export type IRenderer = SplitLayout.IRenderer;\n\n /**\n * An options object for initializing a split panel.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The layout orientation of the panel.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The split layout to use for the split panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `SplitLayout`.\n */\n layout?: SplitLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new handle for use with a split panel.\n *\n * @returns A new handle element for a split panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-SplitPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * Get the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return SplitLayout.getStretch(widget);\n }\n\n /**\n * Set the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n SplitLayout.setStretch(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The index of the pressed handle.\n */\n index: number;\n\n /**\n * The offset of the press in handle coordinates.\n */\n delta: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * Create a split layout for the given panel options.\n */\n export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n return (\n options.layout ||\n new SplitLayout({\n renderer: options.renderer || SplitPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n */\nexport class AccordionPanel extends SplitPanel {\n /**\n * Construct a new accordion panel.\n *\n * @param options - The options for initializing the accordion panel.\n */\n constructor(options: AccordionPanel.IOptions = {}) {\n super({ ...options, layout: Private.createLayout(options) });\n this.addClass('lm-AccordionPanel');\n }\n\n /**\n * The renderer used by the accordion panel.\n */\n get renderer(): AccordionPanel.IRenderer {\n return (this.layout as AccordionLayout).renderer;\n }\n\n /**\n * The section title space.\n *\n * This is the height if the panel is vertical and the width if it is\n * horizontal.\n */\n get titleSpace(): number {\n return (this.layout as AccordionLayout).titleSpace;\n }\n set titleSpace(value: number) {\n (this.layout as AccordionLayout).titleSpace = value;\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return (this.layout as AccordionLayout).titles;\n }\n\n /**\n * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n */\n get expansionToggled(): ISignal {\n return this._expansionToggled;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n super.addWidget(widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Collapse the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n collapse(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && !widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Expand the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n expand(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n super.insertWidget(index, widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Handle the DOM events for the accordion panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n super.handleEvent(event);\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._eventKeyDown(event as KeyboardEvent);\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n super.onBeforeAttach(msg);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n super.onAfterDetach(msg);\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n return widget.contains(sender.owner);\n });\n\n if (index >= 0) {\n (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n this.update();\n }\n }\n\n /**\n * Compute the size of widgets in this panel on the title click event.\n * On closing, the size of the widget is cached and we will try to expand\n * the last opened widget.\n * On opening, we will use the cached size if it is available to restore the\n * widget.\n * In both cases, if we can not compute the size of widgets, we will let\n * `SplitLayout` decide.\n *\n * @param index - The index of widget to be opened of closed\n *\n * @returns Relative size of widgets in this panel, if this size can\n * not be computed, return `undefined`\n */\n private _computeWidgetSize(index: number): number[] | undefined {\n const layout = this.layout as AccordionLayout;\n\n const widget = layout.widgets[index];\n if (!widget) {\n return undefined;\n }\n const isHidden = widget.isHidden;\n const widgetSizes = layout.absoluteSizes();\n const delta = (isHidden ? -1 : 1) * this.spacing;\n const totalSize = widgetSizes.reduce(\n (prev: number, curr: number) => prev + curr\n );\n\n let newSize = [...widgetSizes];\n\n if (!isHidden) {\n // Hide the widget\n const currentSize = widgetSizes[index];\n\n this._widgetSizesCache.set(widget, currentSize);\n newSize[index] = 0;\n\n const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // All widget are closed, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n\n newSize[widgetToCollapse] =\n widgetSizes[widgetToCollapse] + currentSize + delta;\n } else {\n // Show the widget\n const previousSize = this._widgetSizesCache.get(widget);\n if (!previousSize) {\n // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n newSize[index] += previousSize;\n\n const widgetToCollapse = newSize\n .map(sz => sz - previousSize > 0)\n .lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // Can not reduce the size of one widget, reduce all opened widgets\n // proportionally with its size.\n newSize.forEach((_, idx) => {\n if (idx !== index) {\n newSize[idx] -=\n (widgetSizes[idx] / totalSize) * (previousSize - delta);\n }\n });\n } else {\n newSize[widgetToCollapse] -= previousSize - delta;\n }\n }\n return newSize.map(sz => sz / (totalSize + delta));\n }\n /**\n * Handle the `'click'` event for the accordion panel\n */\n private _evtClick(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this._toggleExpansion(index);\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the accordion panel.\n */\n private _eventKeyDown(event: KeyboardEvent): void {\n if (event.defaultPrevented) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n let handled = false;\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n const keyCode = event.keyCode.toString();\n\n // If Space or Enter is pressed on title, emulate click event\n if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n target.click();\n handled = true;\n } else if (\n this.orientation === 'horizontal'\n ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n ) {\n // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n const direction =\n event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n ? -1\n : 1;\n const length = this.titles.length;\n const newIndex = (index + length + direction) % length;\n\n this.titles[newIndex].focus();\n handled = true;\n } else if (event.key === 'End' || keyCode === '35') {\n // If End is pressed on title, focus on the last title\n this.titles[this.titles.length - 1].focus();\n handled = true;\n } else if (event.key === 'Home' || keyCode === '36') {\n // If Home is pressed on title, focus on the first title\n this.titles[0].focus();\n handled = true;\n }\n }\n\n if (handled) {\n event.preventDefault();\n }\n }\n }\n\n private _toggleExpansion(index: number) {\n const title = this.titles[index];\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n const newSize = this._computeWidgetSize(index);\n if (newSize) {\n this.setRelativeSizes(newSize, false);\n }\n\n if (widget.isHidden) {\n title.classList.add('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'true');\n widget.show();\n } else {\n title.classList.remove('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'false');\n widget.hide();\n }\n\n // Emit the expansion state signal.\n this._expansionToggled.emit(index);\n }\n\n private _widgetSizesCache: WeakMap = new WeakMap();\n private _expansionToggled = new Signal(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n /**\n * A type alias for a accordion panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a accordion panel renderer.\n */\n export type IRenderer = AccordionLayout.IRenderer;\n\n /**\n * An options object for initializing a accordion panel.\n */\n export interface IOptions extends Partial {\n /**\n * The accordion layout to use for the accordion panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `AccordionLayout`.\n */\n layout?: AccordionLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer extends SplitPanel.Renderer implements IRenderer {\n constructor() {\n super();\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches any title node in the accordion.\n */\n readonly titleClassName = 'lm-AccordionPanel-title';\n\n /**\n * Render the collapse indicator for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the collapse indicator.\n */\n createCollapseIcon(data: Title): HTMLElement {\n return document.createElement('span');\n }\n\n /**\n * Render the element for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(data: Title): HTMLElement {\n const handle = document.createElement('h3');\n handle.setAttribute('tabindex', '0');\n handle.id = this.createTitleKey(data);\n handle.className = this.titleClassName;\n for (const aData in data.dataset) {\n handle.dataset[aData] = data.dataset[aData];\n }\n\n const collapser = handle.appendChild(this.createCollapseIcon(data));\n collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n const label = handle.appendChild(document.createElement('span'));\n label.className = 'lm-AccordionPanel-titleLabel';\n label.textContent = data.label;\n label.title = data.caption || data.label;\n\n return handle;\n }\n\n /**\n * Create a unique render key for the title.\n *\n * @param data - The data to use for the title.\n *\n * @returns The unique render key for the title.\n *\n * #### Notes\n * This method caches the key against the section title the first time\n * the key is generated.\n */\n createTitleKey(data: Title): string {\n let key = this._titleKeys.get(data);\n if (key === undefined) {\n key = `title-key-${this._uuid}-${this._titleID++}`;\n this._titleKeys.set(data, key);\n }\n return key;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _titleID = 0;\n private _titleKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n /**\n * Create an accordion layout for the given panel options.\n *\n * @param options Panel options\n * @returns Panel layout\n */\n export function createLayout(\n options: AccordionPanel.IOptions\n ): AccordionLayout {\n return (\n options.layout ||\n new AccordionLayout({\n renderer: options.renderer || AccordionPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing,\n titleSpace: options.titleSpace\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n /**\n * Construct a new box layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: BoxLayout.IOptions = {}) {\n super();\n if (options.direction !== undefined) {\n this._direction = options.direction;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the layout direction for the box layout.\n */\n get direction(): BoxLayout.Direction {\n return this._direction;\n }\n\n /**\n * Set the layout direction for the box layout.\n */\n set direction(value: BoxLayout.Direction) {\n if (this._direction === value) {\n return;\n }\n this._direction = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['direction'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the box layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the box layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['direction'] = this.direction;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Create and add a new sizer for the widget.\n ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Move the sizer for the widget.\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Remove the sizer for the widget.\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Update the fixed space for the visible items.\n this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n // Setup the computed minimum size.\n let horz = Private.isHorizontal(this._direction);\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the size basis and stretch factor.\n sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n sizer.stretch = BoxLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Distribute the layout space and adjust the start position.\n let delta: number;\n switch (this._direction) {\n case 'left-to-right':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n break;\n case 'top-to-bottom':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n break;\n case 'right-to-left':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n left += width;\n break;\n case 'bottom-to-top':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n top += height;\n break;\n default:\n throw 'unreachable';\n }\n\n // Setup the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the computed size for the widget.\n let size = this._sizers[i].size;\n\n // Update the widget geometry and advance the relevant edge.\n switch (this._direction) {\n case 'left-to-right':\n item.update(left + offset, top, size + extra, height);\n left += size + extra + this._spacing;\n break;\n case 'top-to-bottom':\n item.update(left, top + offset, width, size + extra);\n top += size + extra + this._spacing;\n break;\n case 'right-to-left':\n item.update(left - offset - size - extra, top, size + extra, height);\n left -= size + extra + this._spacing;\n break;\n case 'bottom-to-top':\n item.update(left, top - offset - size - extra, width, size + extra);\n top -= size + extra + this._spacing;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: BoxLayout.Alignment = 'start';\n private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n /**\n * A type alias for a box layout direction.\n */\n export type Direction =\n | 'left-to-right'\n | 'right-to-left'\n | 'top-to-bottom'\n | 'bottom-to-top';\n\n /**\n * A type alias for a box layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a box layout.\n */\n export interface IOptions {\n /**\n * The direction of the layout.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * Get the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n\n /**\n * Get the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return Private.sizeBasisProperty.get(widget);\n }\n\n /**\n * Set the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n Private.sizeBasisProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * The property descriptor for a widget size basis.\n */\n export const sizeBasisProperty = new AttachedProperty({\n name: 'sizeBasis',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Test whether a direction has horizontal orientation.\n */\n export function isHorizontal(dir: BoxLayout.Direction): boolean {\n return dir === 'left-to-right' || dir === 'right-to-left';\n }\n\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n export function clampSpacing(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof BoxLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n /**\n * Construct a new box panel.\n *\n * @param options - The options for initializing the box panel.\n */\n constructor(options: BoxPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-BoxPanel');\n }\n\n /**\n * Get the layout direction for the box panel.\n */\n get direction(): BoxPanel.Direction {\n return (this.layout as BoxLayout).direction;\n }\n\n /**\n * Set the layout direction for the box panel.\n */\n set direction(value: BoxPanel.Direction) {\n (this.layout as BoxLayout).direction = value;\n }\n\n /**\n * Get the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxPanel.Alignment {\n return (this.layout as BoxLayout).alignment;\n }\n\n /**\n * Set the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxPanel.Alignment) {\n (this.layout as BoxLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the box panel.\n */\n get spacing(): number {\n return (this.layout as BoxLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the box panel.\n */\n set spacing(value: number) {\n (this.layout as BoxLayout).spacing = value;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-BoxPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-BoxPanel-child');\n }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n /**\n * A type alias for a box panel direction.\n */\n export type Direction = BoxLayout.Direction;\n\n /**\n * A type alias for a box panel alignment.\n */\n export type Alignment = BoxLayout.Alignment;\n\n /**\n * An options object for initializing a box panel.\n */\n export interface IOptions {\n /**\n * The layout direction of the panel.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The box layout to use for the box panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `BoxLayout`.\n */\n layout?: BoxLayout;\n }\n\n /**\n * Get the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return BoxLayout.getStretch(widget);\n }\n\n /**\n * Set the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n BoxLayout.setStretch(widget, value);\n }\n\n /**\n * Get the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return BoxLayout.getSizeBasis(widget);\n }\n\n /**\n * Set the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n BoxLayout.setSizeBasis(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a box layout for the given panel options.\n */\n export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n return options.layout || new BoxLayout(options);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n /**\n * Construct a new command palette.\n *\n * @param options - The options for initializing the palette.\n */\n constructor(options: CommandPalette.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-CommandPalette');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || CommandPalette.defaultRenderer;\n this.commands.commandChanged.connect(this._onGenericChange, this);\n this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._items.length = 0;\n this._results = null;\n super.dispose();\n }\n\n /**\n * The command registry used by the command palette.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the command palette.\n */\n readonly renderer: CommandPalette.IRenderer;\n\n /**\n * The command palette search node.\n *\n * #### Notes\n * This is the node which contains the search-related elements.\n */\n get searchNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-search'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The command palette input node.\n *\n * #### Notes\n * This is the actual input node for the search area.\n */\n get inputNode(): HTMLInputElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-input'\n )[0] as HTMLInputElement;\n }\n\n /**\n * The command palette content node.\n *\n * #### Notes\n * This is the node which holds the command item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * A read-only array of the command items in the palette.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Add a command item to the command palette.\n *\n * @param options - The options for creating the command item.\n *\n * @returns The command item added to the palette.\n */\n addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n // Create a new command item for the options.\n let item = Private.createItem(this.commands, options);\n\n // Add the item to the array.\n this._items.push(item);\n\n // Refresh the search results.\n this.refresh();\n\n // Return the item added to the palette.\n return item;\n }\n\n /**\n * Adds command items to the command palette.\n *\n * @param items - An array of options for creating each command item.\n *\n * @returns The command items added to the palette.\n */\n addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n const newItems = items.map(item => Private.createItem(this.commands, item));\n newItems.forEach(item => this._items.push(item));\n this.refresh();\n return newItems;\n }\n\n /**\n * Remove an item from the command palette.\n *\n * @param item - The item to remove from the palette.\n *\n * #### Notes\n * This is a no-op if the item is not in the palette.\n */\n removeItem(item: CommandPalette.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the command palette.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Remove all items from the command palette.\n */\n clearItems(): void {\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the array of items.\n this._items.length = 0;\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Clear the search results and schedule an update.\n *\n * #### Notes\n * This should be called whenever the search results of the palette\n * should be updated.\n *\n * This is typically called automatically by the palette as needed,\n * but can be called manually if the input text is programatically\n * changed.\n *\n * The rendered results are updated asynchronously.\n */\n refresh(): void {\n this._results = null;\n if (this.inputNode.value !== '') {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'inherit';\n } else {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'none';\n }\n this.update();\n }\n\n /**\n * Handle the DOM events for the command palette.\n *\n * @param event - The DOM event sent to the command palette.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the command palette's DOM node.\n * It should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'input':\n this.refresh();\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('input', this);\n this.node.addEventListener('focus', this, true);\n this.node.addEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('input', this);\n this.node.removeEventListener('focus', this, true);\n this.node.removeEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n */\n protected onAfterShow(msg: Message): void {\n this.update();\n super.onAfterShow(msg);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n let input = this.inputNode;\n input.focus();\n input.select();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.isHidden) {\n return;\n }\n\n // Fetch the current query text and content node.\n let query = this.inputNode.value;\n let contentNode = this.contentNode;\n\n // Ensure the search results are generated.\n let results = this._results;\n if (!results) {\n // Generate and store the new search results.\n results = this._results = Private.search(this._items, query);\n\n // Reset the active index.\n this._activeIndex = query\n ? ArrayExt.findFirstIndex(results, Private.canActivate)\n : -1;\n }\n\n // If there is no query and no results, clear the content.\n if (!query && results.length === 0) {\n VirtualDOM.render(null, contentNode);\n return;\n }\n\n // If the is a query but no results, render the empty message.\n if (query && results.length === 0) {\n let content = this.renderer.renderEmptyMessage({ query });\n VirtualDOM.render(content, contentNode);\n return;\n }\n\n // Create the render content for the search results.\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let content = new Array(results.length);\n for (let i = 0, n = results.length; i < n; ++i) {\n let result = results[i];\n if (result.type === 'header') {\n let indices = result.indices;\n let category = result.category;\n content[i] = renderer.renderHeader({ category, indices });\n } else {\n let item = result.item;\n let indices = result.indices;\n let active = i === activeIndex;\n content[i] = renderer.renderItem({ item, indices, active });\n }\n }\n\n // Render the search result content.\n VirtualDOM.render(content, contentNode);\n\n // Adjust the scroll position as needed.\n if (activeIndex < 0 || activeIndex >= results.length) {\n contentNode.scrollTop = 0;\n } else {\n let element = contentNode.children[activeIndex];\n ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n }\n }\n\n /**\n * Handle the `'click'` event for the command palette.\n */\n private _evtClick(event: MouseEvent): void {\n // Bail if the click is not the left button.\n if (event.button !== 0) {\n return;\n }\n\n // Clear input if the target is clear button\n if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n this.inputNode.value = '';\n this.refresh();\n return;\n }\n\n // Find the index of the item which was clicked.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return node.contains(event.target as HTMLElement);\n });\n\n // Bail if the click was not on an item.\n if (index === -1) {\n return;\n }\n\n // Kill the event when a content item is clicked.\n event.preventDefault();\n event.stopPropagation();\n\n // Execute the item if possible.\n this._execute(index);\n }\n\n /**\n * Handle the `'keydown'` event for the command palette.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n return;\n }\n switch (event.keyCode) {\n case 13: // Enter\n event.preventDefault();\n event.stopPropagation();\n this._execute(this._activeIndex);\n break;\n case 38: // Up Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activatePreviousItem();\n break;\n case 40: // Down Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activateNextItem();\n break;\n }\n }\n\n /**\n * Activate the next enabled command item.\n */\n private _activateNextItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the next enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this._activeIndex = ArrayExt.findFirstIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Activate the previous enabled command item.\n */\n private _activatePreviousItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the previous enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this._activeIndex = ArrayExt.findLastIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Execute the command item at the given index, if possible.\n */\n private _execute(index: number): void {\n // Bail if there are no search results.\n if (!this._results) {\n return;\n }\n\n // Bail if the index is out of range.\n let part = this._results[index];\n if (!part) {\n return;\n }\n\n // Update the search text if the item is a header.\n if (part.type === 'header') {\n let input = this.inputNode;\n input.value = `${part.category.toLowerCase()} `;\n input.focus();\n this.refresh();\n return;\n }\n\n // Bail if item is not enabled.\n if (!part.item.isEnabled) {\n return;\n }\n\n // Execute the item.\n this.commands.execute(part.item.command, part.item.args);\n\n // Clear the query text.\n this.inputNode.value = '';\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Toggle the focused modifier based on the input node focus state.\n */\n private _toggleFocused(): void {\n let focused = document.activeElement === this.inputNode;\n this.toggleClass('lm-mod-focused', focused);\n }\n\n /**\n * A signal handler for generic command changes.\n */\n private _onGenericChange(): void {\n this.refresh();\n }\n\n private _activeIndex = -1;\n private _items: CommandPalette.IItem[] = [];\n private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n /**\n * An options object for creating a command palette.\n */\n export interface IOptions {\n /**\n * The command registry for use with the command palette.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the command palette.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for creating a command item.\n */\n export interface IItemOptions {\n /**\n * The category for the item.\n */\n category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n command: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n *\n * The rank is used as a tie-breaker when ordering command items\n * for display. Items are sorted in the following order:\n * 1. Text match (lower is better)\n * 2. Category (locale order)\n * 3. Rank (lower is better)\n * 4. Label (locale order)\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n\n /**\n * An object which represents an item in a command palette.\n *\n * #### Notes\n * Item objects are created automatically by a command palette.\n */\n export interface IItem {\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n readonly label: string;\n\n /**\n * The display caption for the command item.\n */\n readonly caption: string;\n\n /**\n * The icon renderer for the command item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the command item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the command item.\n */\n readonly iconLabel: string;\n\n /**\n * The extra class name for the command item.\n */\n readonly className: string;\n\n /**\n * The dataset for the command item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the command item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the command item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the command item is toggleable.\n */\n readonly isToggleable: boolean;\n\n /**\n * Whether the command item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the command item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * The render data for a command palette header.\n */\n export interface IHeaderRenderData {\n /**\n * The category of the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched characters in the category.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * The render data for a command palette item.\n */\n export interface IItemRenderData {\n /**\n * The command palette item to render.\n */\n readonly item: IItem;\n\n /**\n * The indices of the matched characters in the label.\n */\n readonly indices: ReadonlyArray | null;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n }\n\n /**\n * The render data for a command palette empty message.\n */\n export interface IEmptyMessageRenderData {\n /**\n * The query which failed to match any commands.\n */\n query: string;\n }\n\n /**\n * A renderer for use with a command palette.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement;\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n *\n * #### Notes\n * The command palette will not render invisible items.\n */\n renderItem(data: IItemRenderData): VirtualElement;\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement {\n let content = this.formatHeader(data);\n return h.li({ className: 'lm-CommandPalette-header' }, content);\n }\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IItemRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n if (data.item.isToggleable) {\n return h.li(\n {\n className,\n dataset,\n role: 'menuitemcheckbox',\n 'aria-checked': `${data.item.isToggled}`\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n return h.li(\n {\n className,\n dataset,\n role: 'menuitem'\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n let content = this.formatEmptyMessage(data);\n return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n }\n\n /**\n * Render the icon for a command palette item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the icon.\n */\n renderItemIcon(data: IItemRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the content for a command palette item.\n *\n * @param data - The data to use for rendering the content.\n *\n * @returns A virtual element representing the content.\n */\n renderItemContent(data: IItemRenderData): VirtualElement {\n return h.div(\n { className: 'lm-CommandPalette-itemContent' },\n this.renderItemLabel(data),\n this.renderItemCaption(data)\n );\n }\n\n /**\n * Render the label for a command palette item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the label.\n */\n renderItemLabel(data: IItemRenderData): VirtualElement {\n let content = this.formatItemLabel(data);\n return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n }\n\n /**\n * Render the caption for a command palette item.\n *\n * @param data - The data to use for rendering the caption.\n *\n * @returns A virtual element representing the caption.\n */\n renderItemCaption(data: IItemRenderData): VirtualElement {\n let content = this.formatItemCaption(data);\n return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n }\n\n /**\n * Render the shortcut for a command palette item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the shortcut.\n */\n renderItemShortcut(data: IItemRenderData): VirtualElement {\n let content = this.formatItemShortcut(data);\n return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n }\n\n /**\n * Create the class name for the command palette item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the command palette item.\n */\n createItemClass(data: IItemRenderData): string {\n // Set up the initial class name.\n let name = 'lm-CommandPalette-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the command palette item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the command palette item.\n */\n createItemDataset(data: IItemRenderData): ElementDataset {\n return { ...data.item.dataset, command: data.item.command };\n }\n\n /**\n * Create the class name for the command item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IItemRenderData): string {\n let name = 'lm-CommandPalette-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the header node.\n *\n * @param data - The data to use for the header content.\n *\n * @returns The content to add to the header node.\n */\n formatHeader(data: IHeaderRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.category;\n }\n return StringExt.highlight(data.category, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the empty message node.\n *\n * @param data - The data to use for the empty message content.\n *\n * @returns The content to add to the empty message node.\n */\n formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n return `No commands found that match '${data.query}'`;\n }\n\n /**\n * Create the render content for the item shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatItemShortcut(data: IItemRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n\n /**\n * Create the render content for the item label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatItemLabel(data: IItemRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.item.label;\n }\n return StringExt.highlight(data.item.label, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the item caption node.\n *\n * @param data - The data to use for the caption content.\n *\n * @returns The content to add to the caption node.\n */\n formatItemCaption(data: IItemRenderData): h.Child {\n return data.item.caption;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a command palette.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let search = document.createElement('div');\n let wrapper = document.createElement('div');\n let input = document.createElement('input');\n let content = document.createElement('ul');\n let clear = document.createElement('button');\n search.className = 'lm-CommandPalette-search';\n wrapper.className = 'lm-CommandPalette-wrapper';\n input.className = 'lm-CommandPalette-input';\n clear.className = 'lm-close-icon';\n\n content.className = 'lm-CommandPalette-content';\n content.setAttribute('role', 'menu');\n input.spellcheck = false;\n wrapper.appendChild(input);\n wrapper.appendChild(clear);\n search.appendChild(wrapper);\n node.appendChild(search);\n node.appendChild(content);\n return node;\n }\n\n /**\n * Create a new command item from a command registry and options.\n */\n export function createItem(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ): CommandPalette.IItem {\n return new CommandItem(commands, options);\n }\n\n /**\n * A search result object for a header label.\n */\n export interface IHeaderResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'header';\n\n /**\n * The category for the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched category characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A search result object for a command item.\n */\n export interface IItemResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'item';\n\n /**\n * The command item which was matched.\n */\n readonly item: CommandPalette.IItem;\n\n /**\n * The indices of the matched label characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A type alias for a search result item.\n */\n export type SearchResult = IHeaderResult | IItemResult;\n\n /**\n * Search an array of command items for fuzzy matches.\n */\n export function search(\n items: CommandPalette.IItem[],\n query: string\n ): SearchResult[] {\n // Fuzzy match the items for the query.\n let scores = matchItems(items, query);\n\n // Sort the items based on their score.\n scores.sort(scoreCmp);\n\n // Create the results for the search.\n return createResults(scores);\n }\n\n /**\n * Test whether a result item can be activated.\n */\n export function canActivate(result: SearchResult): boolean {\n return result.type === 'item' && result.item.isEnabled;\n }\n\n /**\n * Normalize a category for a command item.\n */\n function normalizeCategory(category: string): string {\n return category.trim().replace(/\\s+/g, ' ');\n }\n\n /**\n * Normalize the query text for a fuzzy search.\n */\n function normalizeQuery(text: string): string {\n return text.replace(/\\s+/g, '').toLowerCase();\n }\n\n /**\n * An enum of the supported match types.\n */\n const enum MatchType {\n Label,\n Category,\n Split,\n Default\n }\n\n /**\n * A text match score with associated command item.\n */\n interface IScore {\n /**\n * The numerical type for the text match.\n */\n matchType: MatchType;\n\n /**\n * The numerical score for the text match.\n */\n score: number;\n\n /**\n * The indices of the matched category characters.\n */\n categoryIndices: number[] | null;\n\n /**\n * The indices of the matched label characters.\n */\n labelIndices: number[] | null;\n\n /**\n * The command item associated with the match.\n */\n item: CommandPalette.IItem;\n }\n\n /**\n * Perform a fuzzy match on an array of command items.\n */\n function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n // Normalize the query text to lower case with no whitespace.\n query = normalizeQuery(query);\n\n // Create the array to hold the scores.\n let scores: IScore[] = [];\n\n // Iterate over the items and match against the query.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Ignore items which are not visible.\n let item = items[i];\n if (!item.isVisible) {\n continue;\n }\n\n // If the query is empty, all items are matched by default.\n if (!query) {\n scores.push({\n matchType: MatchType.Default,\n categoryIndices: null,\n labelIndices: null,\n score: 0,\n item\n });\n continue;\n }\n\n // Run the fuzzy search for the item and query.\n let score = fuzzySearch(item, query);\n\n // Ignore the item if it is not a match.\n if (!score) {\n continue;\n }\n\n // Penalize disabled items.\n // TODO - push disabled items all the way down in sort cmp?\n if (!item.isEnabled) {\n score.score += 1000;\n }\n\n // Add the score to the results.\n scores.push(score);\n }\n\n // Return the final array of scores.\n return scores;\n }\n\n /**\n * Perform a fuzzy search on a single command item.\n */\n function fuzzySearch(\n item: CommandPalette.IItem,\n query: string\n ): IScore | null {\n // Create the source text to be searched.\n let category = item.category.toLowerCase();\n let label = item.label.toLowerCase();\n let source = `${category} ${label}`;\n\n // Set up the match score and indices array.\n let score = Infinity;\n let indices: number[] | null = null;\n\n // The regex for search word boundaries\n let rgx = /\\b\\w/g;\n\n // Search the source by word boundary.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Find the next word boundary in the source.\n let rgxMatch = rgx.exec(source);\n\n // Break if there is no more source context.\n if (!rgxMatch) {\n break;\n }\n\n // Run the string match on the relevant substring.\n let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n // Break if there is no match.\n if (!match) {\n break;\n }\n\n // Update the match if the score is better.\n if (match.score <= score) {\n score = match.score;\n indices = match.indices;\n }\n }\n\n // Bail if there was no match.\n if (!indices || score === Infinity) {\n return null;\n }\n\n // Compute the pivot index between category and label text.\n let pivot = category.length + 1;\n\n // Find the slice index to separate matched indices.\n let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n // Extract the matched category and label indices.\n let categoryIndices = indices.slice(0, j);\n let labelIndices = indices.slice(j);\n\n // Adjust the label indices for the pivot offset.\n for (let i = 0, n = labelIndices.length; i < n; ++i) {\n labelIndices[i] -= pivot;\n }\n\n // Handle a pure label match.\n if (categoryIndices.length === 0) {\n return {\n matchType: MatchType.Label,\n categoryIndices: null,\n labelIndices,\n score,\n item\n };\n }\n\n // Handle a pure category match.\n if (labelIndices.length === 0) {\n return {\n matchType: MatchType.Category,\n categoryIndices,\n labelIndices: null,\n score,\n item\n };\n }\n\n // Handle a split match.\n return {\n matchType: MatchType.Split,\n categoryIndices,\n labelIndices,\n score,\n item\n };\n }\n\n /**\n * A sort comparison function for a match score.\n */\n function scoreCmp(a: IScore, b: IScore): number {\n // First compare based on the match type\n let m1 = a.matchType - b.matchType;\n if (m1 !== 0) {\n return m1;\n }\n\n // Otherwise, compare based on the match score.\n let d1 = a.score - b.score;\n if (d1 !== 0) {\n return d1;\n }\n\n // Find the match index based on the match type.\n let i1 = 0;\n let i2 = 0;\n switch (a.matchType) {\n case MatchType.Label:\n i1 = a.labelIndices![0];\n i2 = b.labelIndices![0];\n break;\n case MatchType.Category:\n case MatchType.Split:\n i1 = a.categoryIndices![0];\n i2 = b.categoryIndices![0];\n break;\n }\n\n // Compare based on the match index.\n if (i1 !== i2) {\n return i1 - i2;\n }\n\n // Otherwise, compare by category.\n let d2 = a.item.category.localeCompare(b.item.category);\n if (d2 !== 0) {\n return d2;\n }\n\n // Otherwise, compare by rank.\n let r1 = a.item.rank;\n let r2 = b.item.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity safe\n }\n\n // Finally, compare by label.\n return a.item.label.localeCompare(b.item.label);\n }\n\n /**\n * Create the results from an array of sorted scores.\n */\n function createResults(scores: IScore[]): SearchResult[] {\n // Set up the search results array.\n let results: SearchResult[] = [];\n\n // Iterate over each score in the array.\n for (let i = 0, n = scores.length; i < n; ++i) {\n // Extract the current item and indices.\n let { item, categoryIndices, labelIndices } = scores[i];\n\n // Extract the category for the current item.\n let category = item.category;\n\n // Is this the same category as the preceding result?\n if (i === 0 || category !== scores[i - 1].item.category) {\n // Add the header result for the category.\n results.push({ type: 'header', category, indices: categoryIndices });\n }\n\n // Create the item result for the score.\n results.push({ type: 'item', item, indices: labelIndices });\n }\n\n // Return the final results.\n return results;\n }\n\n /**\n * A concrete implementation of `CommandPalette.IItem`.\n */\n class CommandItem implements CommandPalette.IItem {\n /**\n * Construct a new command item.\n */\n constructor(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ) {\n this._commands = commands;\n this.category = normalizeCategory(options.category);\n this.command = options.command;\n this.args = options.args || JSONExt.emptyObject;\n this.rank = options.rank !== undefined ? options.rank : Infinity;\n }\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n get label(): string {\n return this._commands.label(this.command, this.args);\n }\n\n /**\n * The icon renderer for the command item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._commands.icon(this.command, this.args);\n }\n\n /**\n * The icon class for the command item.\n */\n get iconClass(): string {\n return this._commands.iconClass(this.command, this.args);\n }\n\n /**\n * The icon label for the command item.\n */\n get iconLabel(): string {\n return this._commands.iconLabel(this.command, this.args);\n }\n\n /**\n * The display caption for the command item.\n */\n get caption(): string {\n return this._commands.caption(this.command, this.args);\n }\n\n /**\n * The extra class name for the command item.\n */\n get className(): string {\n return this._commands.className(this.command, this.args);\n }\n\n /**\n * The dataset for the command item.\n */\n get dataset(): CommandRegistry.Dataset {\n return this._commands.dataset(this.command, this.args);\n }\n\n /**\n * Whether the command item is enabled.\n */\n get isEnabled(): boolean {\n return this._commands.isEnabled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggled.\n */\n get isToggled(): boolean {\n return this._commands.isToggled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggleable.\n */\n get isToggleable(): boolean {\n return this._commands.isToggleable(this.command, this.args);\n }\n\n /**\n * Whether the command item is visible.\n */\n get isVisible(): boolean {\n return this._commands.isVisible(this.command, this.args);\n }\n\n /**\n * The key binding for the command item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ARIAAttrNames,\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n pageXOffset: number;\n pageYOffset: number;\n clientWidth: number;\n clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n /**\n * Construct a new menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: Menu.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-Menu');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || Menu.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the menu.\n */\n dispose(): void {\n this.close();\n this._items.length = 0;\n super.dispose();\n }\n\n /**\n * A signal emitted just before the menu is closed.\n *\n * #### Notes\n * This signal is emitted when the menu receives a `'close-request'`\n * message, just before it removes itself from the DOM.\n *\n * This signal is not emitted if the menu is already detached from\n * the DOM when it receives the `'close-request'` message.\n */\n get aboutToClose(): ISignal {\n return this._aboutToClose;\n }\n\n /**\n * A signal emitted when a new menu is requested by the user.\n *\n * #### Notes\n * This signal is emitted whenever the user presses the right or left\n * arrow keys, and a submenu cannot be opened or closed in response.\n *\n * This signal is useful when implementing menu bars in order to open\n * the next or previous menu in response to a user key press.\n *\n * This signal is only emitted for the root menu in a hierarchy.\n */\n get menuRequested(): ISignal {\n return this._menuRequested;\n }\n\n /**\n * The command registry used by the menu.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the menu.\n */\n readonly renderer: Menu.IRenderer;\n\n /**\n * The parent menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu is an open submenu.\n */\n get parentMenu(): Menu | null {\n return this._parentMenu;\n }\n\n /**\n * The child menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu has an open submenu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The root menu of the menu hierarchy.\n */\n get rootMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._parentMenu) {\n menu = menu._parentMenu;\n }\n return menu;\n }\n\n /**\n * The leaf menu of the menu hierarchy.\n */\n get leafMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._childMenu) {\n menu = menu._childMenu;\n }\n return menu;\n }\n\n /**\n * The menu content node.\n *\n * #### Notes\n * This is the node which holds the menu item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-Menu-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu item.\n */\n get activeItem(): Menu.IItem | null {\n return this._items[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the item will be set to `null`.\n */\n set activeItem(value: Menu.IItem | null) {\n this.activeIndex = value ? this._items.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu item.\n *\n * #### Notes\n * This will be `-1` if no menu item is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._items.length) {\n value = -1;\n }\n\n // Ensure the item can be activated.\n if (value !== -1 && !Private.canActivate(this._items[value])) {\n value = -1;\n }\n\n // Bail if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Make active element in focus\n if (\n this._activeIndex >= 0 &&\n this.contentNode.childNodes[this._activeIndex]\n ) {\n (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n }\n\n // schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menu items in the menu.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Activate the next selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activateNextItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this.activeIndex = ArrayExt.findFirstIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Activate the previous selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activatePreviousItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this.activeIndex = ArrayExt.findLastIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Trigger the active menu item.\n *\n * #### Notes\n * If the active item is a submenu, it will be opened and the first\n * item will be activated.\n *\n * If the active item is a command, the command will be executed.\n *\n * If the menu is not attached, this is a no-op.\n *\n * If there is no active item, this is a no-op.\n */\n triggerActiveItem(): void {\n // Bail if the menu is not attached.\n if (!this.isAttached) {\n return;\n }\n\n // Bail if there is no active item.\n let item = this.activeItem;\n if (!item) {\n return;\n }\n\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // If the item is a submenu, open it.\n if (item.type === 'submenu') {\n this._openChildMenu(true);\n return;\n }\n\n // Close the root menu before executing the command.\n this.rootMenu.close();\n\n // Execute the command for the item.\n let { command, args } = item;\n if (this.commands.isEnabled(command, args)) {\n this.commands.execute(command, args);\n } else {\n console.log(`Command '${command}' is disabled.`);\n }\n }\n\n /**\n * Add a menu item to the end of the menu.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n */\n addItem(options: Menu.IItemOptions): Menu.IItem {\n return this.insertItem(this._items.length, options);\n }\n\n /**\n * Insert a menu item into the menu at the specified index.\n *\n * @param index - The index at which to insert the item.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n *\n * #### Notes\n * The index will be clamped to the bounds of the items.\n */\n insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Clamp the insert index to the array bounds.\n let i = Math.max(0, Math.min(index, this._items.length));\n\n // Create the item for the options.\n let item = Private.createItem(this, options);\n\n // Insert the item into the array.\n ArrayExt.insert(this._items, i, item);\n\n // Schedule an update of the items.\n this.update();\n\n // Return the item added to the menu.\n return item;\n }\n\n /**\n * Remove an item from the menu.\n *\n * @param item - The item to remove from the menu.\n *\n * #### Notes\n * This is a no-op if the item is not in the menu.\n */\n removeItem(item: Menu.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the menu.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Remove all menu items from the menu.\n */\n clearItems(): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the items.\n this._items.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Open the menu at the specified location.\n *\n * @param x - The client X coordinate of the menu location.\n *\n * @param y - The client Y coordinate of the menu location.\n *\n * @param options - The additional options for opening the menu.\n *\n * #### Notes\n * The menu will be opened at the given location unless it will not\n * fully fit on the screen. If it will not fit, it will be adjusted\n * to fit naturally on the screen.\n *\n * The menu will be attached under the `host` element in the DOM\n * (or `document.body` if `host` is `null`) and before the `ref`\n * element (or as the last child of `host` if `ref` is `null`).\n * The menu may be displayed outside of the `host` element\n * following the rules of CSS absolute positioning.\n *\n * This is a no-op if the menu is already attached to the DOM.\n */\n open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n // Bail early if the menu is already attached.\n if (this.isAttached) {\n return;\n }\n\n // Extract the menu options.\n let forceX = options.forceX || false;\n let forceY = options.forceY || false;\n const host = options.host ?? null;\n const ref = options.ref ?? null;\n\n // Open the menu as a root menu.\n Private.openRootMenu(this, x, y, forceX, forceY, host, ref);\n\n // Activate the menu to accept keyboard input.\n this.activate();\n }\n\n /**\n * Handle the DOM events for the menu.\n *\n * @param event - The DOM event sent to the menu.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu's DOM nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseenter':\n this._evtMouseEnter(event as MouseEvent);\n break;\n case 'mouseleave':\n this._evtMouseLeave(event as MouseEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mouseup', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseenter', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('contextmenu', this);\n document.addEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mouseup', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseenter', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('contextmenu', this);\n document.removeEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this.node.focus();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let items = this._items;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let collapsedFlags = Private.computeCollapsed(items);\n let content = new Array(items.length);\n for (let i = 0, n = items.length; i < n; ++i) {\n let item = items[i];\n let active = i === activeIndex;\n let collapsed = collapsedFlags[i];\n content[i] = renderer.renderItem({\n item,\n active,\n collapsed,\n onfocus: () => {\n this.activeIndex = i;\n }\n });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n */\n protected onCloseRequest(msg: Message): void {\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Close any open child menu.\n let childMenu = this._childMenu;\n if (childMenu) {\n this._childIndex = -1;\n this._childMenu = null;\n childMenu._parentMenu = null;\n childMenu.close();\n }\n\n // Remove this menu from its parent and activate the parent.\n let parentMenu = this._parentMenu;\n if (parentMenu) {\n this._parentMenu = null;\n parentMenu._childIndex = -1;\n parentMenu._childMenu = null;\n parentMenu.activate();\n }\n\n // Emit the `aboutToClose` signal if the menu is attached.\n if (this.isAttached) {\n this._aboutToClose.emit(undefined);\n }\n\n // Finish closing the menu.\n super.onCloseRequest(msg);\n }\n\n /**\n * Handle the `'keydown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // A menu handles all keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Enter\n if (kc === 13) {\n this.triggerActiveItem();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this.close();\n return;\n }\n\n // Left Arrow\n if (kc === 37) {\n if (this._parentMenu) {\n this.close();\n } else {\n this._menuRequested.emit('previous');\n }\n return;\n }\n\n // Up Arrow\n if (kc === 38) {\n this.activatePreviousItem();\n return;\n }\n\n // Right Arrow\n if (kc === 39) {\n let item = this.activeItem;\n if (item && item.type === 'submenu') {\n this.triggerActiveItem();\n } else {\n this.rootMenu._menuRequested.emit('next');\n }\n return;\n }\n\n // Down Arrow\n if (kc === 40) {\n this.activateNextItem();\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._items, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that item is triggered.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.triggerActiveItem();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n }\n }\n\n /**\n * Handle the `'mouseup'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseUp(event: MouseEvent): void {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.triggerActiveItem();\n }\n\n /**\n * Handle the `'mousemove'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Hit test the item nodes for the item under the mouse.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the mouse is already over the active index.\n if (index === this._activeIndex) {\n return;\n }\n\n // Update and coerce the active index.\n this.activeIndex = index;\n index = this.activeIndex;\n\n // If the index is the current child index, cancel the timers.\n if (index === this._childIndex) {\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n return;\n }\n\n // If a child menu is currently open, start the close timer.\n if (this._childIndex !== -1) {\n this._startCloseTimer();\n }\n\n // Cancel the open timer to give a full delay for opening.\n this._cancelOpenTimer();\n\n // Bail if the active item is not a valid submenu item.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n return;\n }\n\n // Start the open timer to open the active item submenu.\n this._startOpenTimer();\n }\n\n /**\n * Handle the `'mouseenter'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseEnter(event: MouseEvent): void {\n // Synchronize the active ancestor items.\n for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n menu._cancelOpenTimer();\n menu._cancelCloseTimer();\n menu.activeIndex = menu._childIndex;\n }\n }\n\n /**\n * Handle the `'mouseleave'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseLeave(event: MouseEvent): void {\n // Cancel any pending submenu opening.\n this._cancelOpenTimer();\n\n // If there is no open child menu, just reset the active index.\n if (!this._childMenu) {\n this.activeIndex = -1;\n return;\n }\n\n // If the mouse is over the child menu, cancel the close timer.\n let { clientX, clientY } = event;\n if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n this._cancelCloseTimer();\n return;\n }\n\n // Otherwise, reset the active index and start the close timer.\n this.activeIndex = -1;\n this._startCloseTimer();\n }\n\n /**\n * Handle the `'mousedown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the document node.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the menu is not a root menu.\n if (this._parentMenu) {\n return;\n }\n\n // The mouse button which is pressed is irrelevant. If the press\n // is not on a menu, the entire hierarchy is closed and the event\n // is allowed to propagate. This allows other code to act on the\n // event, such as focusing the clicked element.\n if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n event.preventDefault();\n event.stopPropagation();\n } else {\n this.close();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if the active item is not a valid submenu.\n */\n private _openChildMenu(activateFirst = false): void {\n // If the item is not a valid submenu, close the child menu.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n this._closeChildMenu();\n return;\n }\n\n // Do nothing if the child menu will not change.\n let submenu = item.submenu;\n if (submenu === this._childMenu) {\n return;\n }\n\n // Prior to any DOM modifications save window data\n Menu.saveWindowData();\n\n // Ensure the current child menu is closed.\n this._closeChildMenu();\n\n // Update the private child state.\n this._childMenu = submenu;\n this._childIndex = this._activeIndex;\n\n // Set the parent menu reference for the child.\n submenu._parentMenu = this;\n\n // Ensure the menu is updated and lookup the item node.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n let itemNode = this.contentNode.children[this._activeIndex];\n\n // Open the submenu at the active node.\n Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n // Activate the first item if desired.\n if (activateFirst) {\n submenu.activeIndex = -1;\n submenu.activateNextItem();\n }\n\n // Activate the child menu.\n submenu.activate();\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n if (this._childMenu) {\n this._childMenu.close();\n }\n }\n\n /**\n * Start the open timer, unless it is already pending.\n */\n private _startOpenTimer(): void {\n if (this._openTimerID === 0) {\n this._openTimerID = window.setTimeout(() => {\n this._openTimerID = 0;\n this._openChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Start the close timer, unless it is already pending.\n */\n private _startCloseTimer(): void {\n if (this._closeTimerID === 0) {\n this._closeTimerID = window.setTimeout(() => {\n this._closeTimerID = 0;\n this._closeChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Cancel the open timer, if the timer is pending.\n */\n private _cancelOpenTimer(): void {\n if (this._openTimerID !== 0) {\n clearTimeout(this._openTimerID);\n this._openTimerID = 0;\n }\n }\n\n /**\n * Cancel the close timer, if the timer is pending.\n */\n private _cancelCloseTimer(): void {\n if (this._closeTimerID !== 0) {\n clearTimeout(this._closeTimerID);\n this._closeTimerID = 0;\n }\n }\n\n /**\n * Save window data used for menu positioning in transient cache.\n *\n * In order to avoid layout trashing it is recommended to invoke this\n * method immediately prior to opening the menu and any DOM modifications\n * (like closing previously visible menu, or adding a class to menu widget).\n *\n * The transient cache will be released upon `open()` call.\n */\n static saveWindowData(): void {\n Private.saveWindowData();\n }\n\n private _childIndex = -1;\n private _activeIndex = -1;\n private _openTimerID = 0;\n private _closeTimerID = 0;\n private _items: Menu.IItem[] = [];\n private _childMenu: Menu | null = null;\n private _parentMenu: Menu | null = null;\n private _aboutToClose = new Signal(this);\n private _menuRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n /**\n * An options object for creating a menu.\n */\n export interface IOptions {\n /**\n * The command registry for use with the menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the menu.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for the `open` method on a menu.\n */\n export interface IOpenOptions {\n /**\n * Whether to force the X position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * X coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceX?: boolean;\n\n /**\n * Whether to force the Y position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * Y coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceY?: boolean;\n\n /**\n * The DOM node to use as the menu's host.\n *\n * If not specified then uses `document.body`.\n */\n host?: HTMLElement;\n\n /**\n * The child of `host` to use as the reference element.\n * If this is provided, the menu will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * menu to be added as the last child of the host.\n */\n ref?: HTMLElement;\n }\n\n /**\n * A type alias for a menu item type.\n */\n export type ItemType = 'command' | 'submenu' | 'separator';\n\n /**\n * An options object for creating a menu item.\n */\n export interface IItemOptions {\n /**\n * The type of the menu item.\n *\n * The default value is `'command'`.\n */\n type?: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n *\n * The default value is an empty string.\n */\n command?: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n *\n * The default value is `null`.\n */\n submenu?: Menu | null;\n }\n\n /**\n * An object which represents a menu item.\n *\n * #### Notes\n * Item objects are created automatically by a menu.\n */\n export interface IItem {\n /**\n * The type of the menu item.\n */\n readonly type: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n readonly label: string;\n\n /**\n * The mnemonic index for the menu item.\n */\n readonly mnemonic: number;\n\n /**\n * The icon renderer for the menu item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the menu item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the menu item.\n */\n readonly iconLabel: string;\n\n /**\n * The display caption for the menu item.\n */\n readonly caption: string;\n\n /**\n * The extra class name for the menu item.\n */\n readonly className: string;\n\n /**\n * The dataset for the menu item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the menu item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the menu item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the menu item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the menu item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * An object which holds the data to render a menu item.\n */\n export interface IRenderData {\n /**\n * The item to be rendered.\n */\n readonly item: IItem;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the item should be collapsed.\n */\n readonly collapsed: boolean;\n\n /**\n * Handler for when element is in focus.\n */\n readonly onfocus?: () => void;\n }\n\n /**\n * A renderer for use with a menu.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n tabindex: '0',\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderShortcut(data),\n this.renderSubmenu(data)\n );\n }\n\n /**\n * Render the icon element for a menu item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-Menu-itemLabel' }, content);\n }\n\n /**\n * Render the shortcut element for a menu item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the item shortcut.\n */\n renderShortcut(data: IRenderData): VirtualElement {\n let content = this.formatShortcut(data);\n return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n }\n\n /**\n * Render the submenu icon element for a menu item.\n *\n * @param data - The data to use for rendering the submenu icon.\n *\n * @returns A virtual element representing the submenu icon.\n */\n renderSubmenu(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n }\n\n /**\n * Create the class name for the menu item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n // Setup the initial class name.\n let name = 'lm-Menu-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (!data.item.isVisible) {\n name += ' lm-mod-hidden';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n if (data.collapsed) {\n name += ' lm-mod-collapsed';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the menu item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the menu item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n let result: ElementDataset;\n let { type, command, dataset } = data.item;\n if (type === 'command') {\n result = { ...dataset, type, command };\n } else {\n result = { ...dataset, type };\n }\n return result;\n }\n\n /**\n * Create the class name for the menu item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-Menu-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the aria attributes for menu item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n let aria: { [T in ARIAAttrNames]?: string } = {};\n switch (data.item.type) {\n case 'separator':\n aria.role = 'presentation';\n break;\n case 'submenu':\n aria['aria-haspopup'] = 'true';\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n break;\n default:\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n aria.role = 'menuitem';\n }\n return aria;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.item;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n\n /**\n * Create the render content for the shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatShortcut(data: IRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The ms delay for opening and closing a submenu.\n */\n export const TIMER_DELAY = 300;\n\n /**\n * The horizontal pixel overlap for an open submenu.\n */\n export const SUBMENU_OVERLAP = 3;\n\n let transientWindowDataCache: IWindowData | null = null;\n let transientCacheCounter: number = 0;\n\n function getWindowData(): IWindowData {\n // if transient cache is in use, take one from it\n if (transientCacheCounter > 0) {\n transientCacheCounter--;\n return transientWindowDataCache!;\n }\n return _getWindowData();\n }\n\n /**\n * Store window data in transient cache.\n *\n * The transient cache will be released upon `getWindowData()` call.\n * If this function is called multiple times, the cache will be\n * retained until as many calls to `getWindowData()` were made.\n *\n * Note: should be called before any DOM modifications.\n */\n export function saveWindowData(): void {\n transientWindowDataCache = _getWindowData();\n transientCacheCounter++;\n }\n\n /**\n * Create the DOM node for a menu.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-Menu-content';\n node.appendChild(content);\n content.setAttribute('role', 'menu');\n node.tabIndex = 0;\n return node;\n }\n\n /**\n * Test whether a menu item can be activated.\n */\n export function canActivate(item: Menu.IItem): boolean {\n return item.type !== 'separator' && item.isEnabled && item.isVisible;\n }\n\n /**\n * Create a new menu item for an owner menu.\n */\n export function createItem(\n owner: Menu,\n options: Menu.IItemOptions\n ): Menu.IItem {\n return new MenuItem(owner.commands, options);\n }\n\n /**\n * Hit test a menu hierarchy starting at the given root.\n */\n export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n if (ElementExt.hitTest(temp.node, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Compute which extra separator items should be collapsed.\n */\n export function computeCollapsed(\n items: ReadonlyArray\n ): boolean[] {\n // Allocate the return array and fill it with `false`.\n let result = new Array(items.length);\n ArrayExt.fill(result, false);\n\n // Collapse the leading separators.\n let k1 = 0;\n let n = items.length;\n for (; k1 < n; ++k1) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k1] = true;\n }\n\n // Hide the trailing separators.\n let k2 = n - 1;\n for (; k2 >= 0; --k2) {\n let item = items[k2];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k2] = true;\n }\n\n // Hide the remaining consecutive separators.\n let hide = false;\n while (++k1 < k2) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n hide = false;\n } else if (hide) {\n result[k1] = true;\n } else {\n hide = true;\n }\n }\n\n // Return the resulting flags.\n return result;\n }\n\n function _getWindowData(): IWindowData {\n return {\n pageXOffset: window.pageXOffset,\n pageYOffset: window.pageYOffset,\n clientWidth: document.documentElement.clientWidth,\n clientHeight: document.documentElement.clientHeight\n };\n }\n\n /**\n * Open a menu as a root menu at the target location.\n */\n export function openRootMenu(\n menu: Menu,\n x: number,\n y: number,\n forceX: boolean,\n forceY: boolean,\n host: HTMLElement | null,\n ref: HTMLElement | null\n ): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before attaching and measuring.\n MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch - (forceY ? y : 0);\n\n // Fetch common variables.\n let node = menu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(menu, host || document.body, ref);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Adjust the X position of the menu to fit on-screen.\n if (!forceX && x + width > px + cw) {\n x = px + cw - width;\n }\n\n // Adjust the Y position of the menu to fit on-screen.\n if (!forceY && y + height > py + ch) {\n if (y > py + ch) {\n y = py + ch - height;\n } else {\n y = y - height;\n }\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * Open a menu as a submenu using an item node for positioning.\n */\n export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before opening.\n MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch;\n\n // Fetch common variables.\n let node = submenu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(submenu, document.body);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Compute the box sizing for the menu.\n let box = ElementExt.boxSizing(submenu.node);\n\n // Get the bounding rect for the target item node.\n let itemRect = itemNode.getBoundingClientRect();\n\n // Compute the target X position.\n let x = itemRect.right - SUBMENU_OVERLAP;\n\n // Adjust the X position to fit on the screen.\n if (x + width > px + cw) {\n x = itemRect.left + SUBMENU_OVERLAP - width;\n }\n\n // Compute the target Y position.\n let y = itemRect.top - box.borderTop - box.paddingTop;\n\n // Adjust the Y position to fit on the screen.\n if (y + height > py + ch) {\n y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n items: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Lookup the item\n let item = items[k];\n\n // Ignore items which cannot be activated.\n if (!canActivate(item)) {\n continue;\n }\n\n // Ignore items with an empty label.\n let label = item.label;\n if (label.length === 0) {\n continue;\n }\n\n // Lookup the mnemonic index for the label.\n let mn = item.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < label.length) {\n if (label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n\n /**\n * A concrete implementation of `Menu.IItem`.\n */\n class MenuItem implements Menu.IItem {\n /**\n * Construct a new menu item.\n */\n constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n this._commands = commands;\n this.type = options.type || 'command';\n this.command = options.command || '';\n this.args = options.args || JSONExt.emptyObject;\n this.submenu = options.submenu || null;\n }\n\n /**\n * The type of the menu item.\n */\n readonly type: Menu.ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n get label(): string {\n if (this.type === 'command') {\n return this._commands.label(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.label;\n }\n return '';\n }\n\n /**\n * The mnemonic index for the menu item.\n */\n get mnemonic(): number {\n if (this.type === 'command') {\n return this._commands.mnemonic(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.mnemonic;\n }\n return -1;\n }\n\n /**\n * The icon renderer for the menu item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n if (this.type === 'command') {\n return this._commands.icon(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.icon;\n }\n return undefined;\n }\n\n /**\n * The icon class for the menu item.\n */\n get iconClass(): string {\n if (this.type === 'command') {\n return this._commands.iconClass(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconClass;\n }\n return '';\n }\n\n /**\n * The icon label for the menu item.\n */\n get iconLabel(): string {\n if (this.type === 'command') {\n return this._commands.iconLabel(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconLabel;\n }\n return '';\n }\n\n /**\n * The display caption for the menu item.\n */\n get caption(): string {\n if (this.type === 'command') {\n return this._commands.caption(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.caption;\n }\n return '';\n }\n\n /**\n * The extra class name for the menu item.\n */\n get className(): string {\n if (this.type === 'command') {\n return this._commands.className(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.className;\n }\n return '';\n }\n\n /**\n * The dataset for the menu item.\n */\n get dataset(): CommandRegistry.Dataset {\n if (this.type === 'command') {\n return this._commands.dataset(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.dataset;\n }\n return {};\n }\n\n /**\n * Whether the menu item is enabled.\n */\n get isEnabled(): boolean {\n if (this.type === 'command') {\n return this._commands.isEnabled(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * Whether the menu item is toggled.\n */\n get isToggled(): boolean {\n if (this.type === 'command') {\n return this._commands.isToggled(this.command, this.args);\n }\n return false;\n }\n\n /**\n * Whether the menu item is visible.\n */\n get isVisible(): boolean {\n if (this.type === 'command') {\n return this._commands.isVisible(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * The key binding for the menu item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n if (this.type === 'command') {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n return null;\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n /**\n * Construct a new context menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: ContextMenu.IOptions) {\n const { groupByTarget, sortBySelector, ...others } = options;\n this.menu = new Menu(others);\n this._groupByTarget = groupByTarget !== false;\n this._sortBySelector = sortBySelector !== false;\n }\n\n /**\n * The menu widget which displays the matched context items.\n */\n readonly menu: Menu;\n\n /**\n * Add an item to the context menu.\n *\n * @param options - The options for creating the item.\n *\n * @returns A disposable which will remove the item from the menu.\n */\n addItem(options: ContextMenu.IItemOptions): IDisposable {\n // Create an item from the given options.\n let item = Private.createItem(options, this._idTick++);\n\n // Add the item to the internal array.\n this._items.push(item);\n\n // Return a disposable which will remove the item.\n return new DisposableDelegate(() => {\n ArrayExt.removeFirstOf(this._items, item);\n });\n }\n\n /**\n * Open the context menu in response to a `'contextmenu'` event.\n *\n * @param event - The `'contextmenu'` event of interest.\n *\n * @returns `true` if the menu was opened, or `false` if no items\n * matched the event and the menu was not opened.\n *\n * #### Notes\n * This method will populate the context menu with items which match\n * the propagation path of the event, then open the menu at the mouse\n * position indicated by the event.\n */\n open(event: MouseEvent): boolean {\n // Prior to any DOM modifications update the window data.\n Menu.saveWindowData();\n\n // Clear the current contents of the context menu.\n this.menu.clearItems();\n\n // Bail early if there are no items to match.\n if (this._items.length === 0) {\n return false;\n }\n\n // Find the matching items for the event.\n let items = Private.matchItems(\n this._items,\n event,\n this._groupByTarget,\n this._sortBySelector\n );\n\n // Bail if there are no matching items.\n if (!items || items.length === 0) {\n return false;\n }\n\n // Add the filtered items to the menu.\n for (const item of items) {\n this.menu.addItem(item);\n }\n\n // Open the context menu at the current mouse position.\n this.menu.open(event.clientX, event.clientY);\n\n // Indicate success.\n return true;\n }\n\n private _groupByTarget: boolean = true;\n private _idTick = 0;\n private _items: Private.IItem[] = [];\n private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n /**\n * An options object for initializing a context menu.\n */\n export interface IOptions {\n /**\n * The command registry to use with the context menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the context menu.\n */\n renderer?: Menu.IRenderer;\n\n /**\n * Whether to sort by selector and rank or only rank.\n *\n * Default true.\n */\n sortBySelector?: boolean;\n\n /**\n * Whether to group items following the DOM hierarchy.\n *\n * Default true.\n *\n * #### Note\n * If true, when the mouse event occurs on element `span` within `div.top`,\n * the items matching `div.top` will be shown before the ones matching `body`.\n */\n groupByTarget?: boolean;\n }\n\n /**\n * An options object for creating a context menu item.\n */\n export interface IItemOptions extends Menu.IItemOptions {\n /**\n * The CSS selector for the context menu item.\n *\n * The context menu item will only be displayed in the context menu\n * when the selector matches a node on the propagation path of the\n * contextmenu event. This allows the menu item to be restricted to\n * user-defined contexts.\n *\n * The selector must not contain commas.\n */\n selector: string;\n\n /**\n * The rank for the item.\n *\n * The rank is used as a tie-breaker when ordering context menu\n * items for display. Items are sorted in the following order:\n * 1. Depth in the DOM tree (deeper is better)\n * 2. Selector specificity (higher is better)\n * 3. Rank (lower is better)\n * 4. Insertion order\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A normalized item for a context menu.\n */\n export interface IItem extends Menu.IItemOptions {\n /**\n * The selector for the item.\n */\n selector: string;\n\n /**\n * The rank for the item.\n */\n rank: number;\n\n /**\n * The tie-breaking id for the item.\n */\n id: number;\n }\n\n /**\n * Create a normalized context menu item from an options object.\n */\n export function createItem(\n options: ContextMenu.IItemOptions,\n id: number\n ): IItem {\n let selector = validateSelector(options.selector);\n let rank = options.rank !== undefined ? options.rank : Infinity;\n return { ...options, selector, rank, id };\n }\n\n /**\n * Find the items which match a context menu event.\n *\n * The results are sorted by DOM level, specificity, and rank.\n */\n export function matchItems(\n items: IItem[],\n event: MouseEvent,\n groupByTarget: boolean,\n sortBySelector: boolean\n ): IItem[] | null {\n // Look up the target of the event.\n let target = event.target as Element | null;\n\n // Bail if there is no target.\n if (!target) {\n return null;\n }\n\n // Look up the current target of the event.\n let currentTarget = event.currentTarget as Element | null;\n\n // Bail if there is no current target.\n if (!currentTarget) {\n return null;\n }\n\n // There are some third party libraries that cause the `target` to\n // be detached from the DOM before lumino can process the event.\n // If that happens, search for a new target node by point. If that\n // node is still dangling, bail.\n if (!currentTarget.contains(target)) {\n target = document.elementFromPoint(event.clientX, event.clientY);\n if (!target || !currentTarget.contains(target)) {\n return null;\n }\n }\n\n // Set up the result array.\n let result: IItem[] = [];\n\n // Copy the items array to allow in-place modification.\n let availableItems: Array = items.slice();\n\n // Walk up the DOM hierarchy searching for matches.\n while (target !== null) {\n // Set up the match array for this DOM level.\n let matches: IItem[] = [];\n\n // Search the remaining items for matches.\n for (let i = 0, n = availableItems.length; i < n; ++i) {\n // Fetch the item.\n let item = availableItems[i];\n\n // Skip items which are already consumed.\n if (!item) {\n continue;\n }\n\n // Skip items which do not match the element.\n if (!Selector.matches(target, item.selector)) {\n continue;\n }\n\n // Add the matched item to the result for this DOM level.\n matches.push(item);\n\n // Mark the item as consumed.\n availableItems[i] = null;\n }\n\n // Sort the matches for this level and add them to the results.\n if (matches.length !== 0) {\n if (groupByTarget) {\n matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n result.push(...matches);\n }\n\n // Stop searching at the limits of the DOM range.\n if (target === currentTarget) {\n break;\n }\n\n // Step to the parent DOM level.\n target = target.parentElement;\n }\n\n if (!groupByTarget) {\n result.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n\n // Return the matched and sorted results.\n return result;\n }\n\n /**\n * Validate the selector for a menu item.\n *\n * This returns the validated selector, or throws if the selector is\n * invalid or contains commas.\n */\n function validateSelector(selector: string): string {\n if (selector.indexOf(',') !== -1) {\n throw new Error(`Selector cannot contain commas: ${selector}`);\n }\n if (!Selector.isValid(selector)) {\n throw new Error(`Invalid selector: ${selector}`);\n }\n return selector;\n }\n\n /**\n * A sort comparison function for a context menu item by ranks.\n */\n function itemCmpRank(a: IItem, b: IItem): number {\n // Sort based on rank.\n let r1 = a.rank;\n let r2 = b.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity-safe\n }\n\n // When all else fails, sort by item id.\n return a.id - b.id;\n }\n\n /**\n * A sort comparison function for a context menu item by selectors and ranks.\n */\n function itemCmp(a: IItem, b: IItem): number {\n // Sort first based on selector specificity.\n let s1 = Selector.calculateSpecificity(a.selector);\n let s2 = Selector.calculateSpecificity(b.selector);\n if (s1 !== s2) {\n return s2 - s1;\n }\n\n // If specificities are equal\n return itemCmpRank(a, b);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ElementARIAAttrs,\n ElementBaseAttrs,\n ElementDataset,\n ElementInlineStyle,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n 'ArrowLeft',\n 'ArrowUp',\n 'ArrowRight',\n 'ArrowDown',\n 'Home',\n 'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar extends Widget {\n /**\n * Construct a new tab bar.\n *\n * @param options - The options for initializing the tab bar.\n */\n constructor(options: TabBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-TabBar');\n this.contentNode.setAttribute('role', 'tablist');\n this.setFlag(Widget.Flag.DisallowLayout);\n this._document = options.document || document;\n this.tabsMovable = options.tabsMovable || false;\n this.titlesEditable = options.titlesEditable || false;\n this.allowDeselect = options.allowDeselect || false;\n this.addButtonEnabled = options.addButtonEnabled || false;\n this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n this.name = options.name || '';\n this.orientation = options.orientation || 'horizontal';\n this.removeBehavior = options.removeBehavior || 'select-tab-after';\n this.renderer = options.renderer || TabBar.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._releaseMouse();\n this._titles.length = 0;\n this._previousTitle = null;\n super.dispose();\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when a tab is moved by the user.\n *\n * #### Notes\n * This signal is emitted when a tab is moved by user interaction.\n *\n * This signal is not emitted when a tab is moved programmatically.\n */\n get tabMoved(): ISignal> {\n return this._tabMoved;\n }\n\n /**\n * A signal emitted when a tab is clicked by the user.\n *\n * #### Notes\n * If the clicked tab is not the current tab, the clicked tab will be\n * made current and the `currentChanged` signal will be emitted first.\n *\n * This signal is emitted even if the clicked tab is the current tab.\n */\n get tabActivateRequested(): ISignal<\n this,\n TabBar.ITabActivateRequestedArgs\n > {\n return this._tabActivateRequested;\n }\n\n /**\n * A signal emitted when the tab bar add button is clicked.\n */\n get addRequested(): ISignal {\n return this._addRequested;\n }\n\n /**\n * A signal emitted when a tab close icon is clicked.\n *\n * #### Notes\n * This signal is not emitted unless the tab title is `closable`.\n */\n get tabCloseRequested(): ISignal> {\n return this._tabCloseRequested;\n }\n\n /**\n * A signal emitted when a tab is dragged beyond the detach threshold.\n *\n * #### Notes\n * This signal is emitted when the user drags a tab with the mouse,\n * and mouse is dragged beyond the detach threshold.\n *\n * The consumer of the signal should call `releaseMouse` and remove\n * the tab in order to complete the detach.\n *\n * This signal is only emitted once per drag cycle.\n */\n get tabDetachRequested(): ISignal> {\n return this._tabDetachRequested;\n }\n\n /**\n * The renderer used by the tab bar.\n */\n readonly renderer: TabBar.IRenderer;\n\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n get document(): Document | ShadowRoot {\n return this._document;\n }\n\n /**\n * Whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n tabsMovable: boolean;\n\n /**\n * Whether the titles can be user-edited.\n *\n */\n get titlesEditable(): boolean {\n return this._titlesEditable;\n }\n\n /**\n * Set whether titles can be user edited.\n *\n */\n set titlesEditable(value: boolean) {\n this._titlesEditable = value;\n }\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * #### Notes\n * Tabs can be always be deselected programmatically.\n */\n allowDeselect: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n */\n insertBehavior: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n */\n removeBehavior: TabBar.RemoveBehavior;\n\n /**\n * Get the currently selected title.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get currentTitle(): Title | null {\n return this._titles[this._currentIndex] || null;\n }\n\n /**\n * Set the currently selected title.\n *\n * #### Notes\n * If the title does not exist, the title will be set to `null`.\n */\n set currentTitle(value: Title | null) {\n this.currentIndex = value ? this._titles.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this._currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `-1`.\n */\n set currentIndex(value: number) {\n // Adjust for an out of range index.\n if (value < 0 || value >= this._titles.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._currentIndex === value) {\n return;\n }\n\n // Look up the previous index and title.\n let pi = this._currentIndex;\n let pt = this._titles[pi] || null;\n\n // Look up the current index and title.\n let ci = value;\n let ct = this._titles[ci] || null;\n\n // Update the current index and previous title.\n this._currentIndex = ci;\n this._previousTitle = pt;\n\n // Schedule an update of the tabs.\n this.update();\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: ci,\n currentTitle: ct\n });\n }\n\n /**\n * Get the name of the tab bar.\n */\n get name(): string {\n return this._name;\n }\n\n /**\n * Set the name of the tab bar.\n */\n set name(value: string) {\n this._name = value;\n if (value) {\n this.contentNode.setAttribute('aria-label', value);\n } else {\n this.contentNode.removeAttribute('aria-label');\n }\n }\n\n /**\n * Get the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n get orientation(): TabBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n set orientation(value: TabBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Toggle the orientation values.\n this._orientation = value;\n this.dataset['orientation'] = value;\n this.contentNode.setAttribute('aria-orientation', value);\n }\n\n /**\n * Whether the add button is enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add button is enabled.\n */\n set addButtonEnabled(value: boolean) {\n // Do nothing if the value does not change.\n if (this._addButtonEnabled === value) {\n return;\n }\n\n this._addButtonEnabled = value;\n if (value) {\n this.addButtonNode.classList.remove('lm-mod-hidden');\n } else {\n this.addButtonNode.classList.add('lm-mod-hidden');\n }\n }\n\n /**\n * A read-only array of the titles in the tab bar.\n */\n get titles(): ReadonlyArray> {\n return this._titles;\n }\n\n /**\n * The tab bar content node.\n *\n * #### Notes\n * This is the node which holds the tab nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * The tab bar add button node.\n *\n * #### Notes\n * This is the node which holds the add button.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get addButtonNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-addButton'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Add a tab to the end of the tab bar.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * If the title is already added to the tab bar, it will be moved.\n */\n addTab(value: Title | Title.IOptions): Title {\n return this.insertTab(this._titles.length, value);\n }\n\n /**\n * Insert a tab into the tab bar at the specified index.\n *\n * @param index - The index at which to insert the tab.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the tabs.\n *\n * If the title is already added to the tab bar, it will be moved.\n */\n insertTab(index: number, value: Title | Title.IOptions): Title {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Coerce the value to a title.\n let title = Private.asTitle(value);\n\n // Look up the index of the title.\n let i = this._titles.indexOf(title);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._titles.length));\n\n // If the title is not in the array, insert it.\n if (i === -1) {\n // Insert the title into the array.\n ArrayExt.insert(this._titles, j, title);\n\n // Connect to the title changed signal.\n title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the insert.\n this._adjustCurrentForInsert(j, title);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n // Otherwise, the title exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._titles.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return title;\n }\n\n // Move the title to the new location.\n ArrayExt.move(this._titles, i, j);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n /**\n * Remove a tab from the tab bar.\n *\n * @param title - The title for the tab to remove.\n *\n * #### Notes\n * This is a no-op if the title is not in the tab bar.\n */\n removeTab(title: Title): void {\n this.removeTabAt(this._titles.indexOf(title));\n }\n\n /**\n * Remove the tab at a given index from the tab bar.\n *\n * @param index - The index of the tab to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeTabAt(index: number): void {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Remove the title from the array.\n let title = ArrayExt.removeAt(this._titles, index);\n\n // Bail if the index is out of range.\n if (!title) {\n return;\n }\n\n // Disconnect from the title changed signal.\n title.changed.disconnect(this._onTitleChanged, this);\n\n // Clear the previous title if it's being removed.\n if (title === this._previousTitle) {\n this._previousTitle = null;\n }\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the remove.\n this._adjustCurrentForRemove(index, title);\n }\n\n /**\n * Remove all tabs from the tab bar.\n */\n clearTabs(): void {\n // Bail if there is nothing to remove.\n if (this._titles.length === 0) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Disconnect from the title changed signals.\n for (let title of this._titles) {\n title.changed.disconnect(this._onTitleChanged, this);\n }\n\n // Get the current index and title.\n let pi = this.currentIndex;\n let pt = this.currentTitle;\n\n // Reset the current index and previous title.\n this._currentIndex = -1;\n this._previousTitle = null;\n\n // Clear the title array.\n this._titles.length = 0;\n\n // Schedule an update of the tabs.\n this.update();\n\n // If no tab was selected, there's nothing else to do.\n if (pi === -1) {\n return;\n }\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n *\n * #### Notes\n * This will cause the tab bar to stop handling mouse events and to\n * restore the tabs to their non-dragged positions.\n */\n releaseMouse(): void {\n this._releaseMouse();\n }\n\n /**\n * Handle the DOM events for the tab bar.\n *\n * @param event - The DOM event sent to the tab bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tab bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'dblclick':\n this._evtDblClick(event as MouseEvent);\n break;\n case 'keydown':\n event.eventPhase === Event.CAPTURING_PHASE\n ? this._evtKeyDownCapturing(event as KeyboardEvent)\n : this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n this.node.addEventListener('dblclick', this);\n this.node.addEventListener('keydown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this.node.removeEventListener('dblclick', this);\n this.node.removeEventListener('keydown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let titles = this._titles;\n let renderer = this.renderer;\n let currentTitle = this.currentTitle;\n let content = new Array(titles.length);\n // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n // If the add button handles it, no need to do anything. If no element of the tab\n // bar handles it, set it on the current or the first tab to ensure one element\n // handles it after update.\n const tabHandlingTabindex =\n this._getCurrentTabindex() ??\n (this._currentIndex > -1 ? this._currentIndex : 0);\n\n for (let i = 0, n = titles.length; i < n; ++i) {\n let title = titles[i];\n let current = title === currentTitle;\n let zIndex = current ? n : n - i - 1;\n let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * Get the index of the tab which handles tabindex=\"0\".\n * If the add button handles tabindex=\"0\", -1 is returned.\n * If none of the previous handles tabindex=\"0\", null is returned.\n */\n private _getCurrentTabindex(): number | null {\n let index = null;\n const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n if (elemTabindex) {\n index = [...this.contentNode.children].indexOf(elemTabindex);\n } else if (\n this._addButtonEnabled &&\n this.addButtonNode.getAttribute('tabindex') === '0'\n ) {\n index = -1;\n }\n return index;\n }\n\n /**\n * Handle the `'dblclick'` event for the tab bar.\n */\n private _evtDblClick(event: MouseEvent): void {\n // Do nothing if titles are not editable\n if (!this.titlesEditable) {\n return;\n }\n\n let tabs = this.contentNode.children;\n\n // Find the index of the targeted tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab.\n if (index === -1) {\n return;\n }\n\n let title = this.titles[index];\n let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n if (label && label.contains(event.target as HTMLElement)) {\n let value = title.label || '';\n\n // Clear the label element\n let oldValue = label.innerHTML;\n label.innerHTML = '';\n\n let input = document.createElement('input');\n input.classList.add('lm-TabBar-tabInput');\n input.value = value;\n label.appendChild(input);\n\n let onblur = () => {\n input.removeEventListener('blur', onblur);\n label.innerHTML = oldValue;\n this.node.addEventListener('keydown', this);\n };\n\n input.addEventListener('dblclick', (event: Event) =>\n event.stopPropagation()\n );\n input.addEventListener('blur', onblur);\n input.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n if (input.value !== '') {\n title.label = title.caption = input.value;\n }\n onblur();\n } else if (event.key === 'Escape') {\n onblur();\n }\n });\n this.node.removeEventListener('keydown', this);\n input.select();\n input.focus();\n\n if (label.children.length > 0) {\n (label.children[0] as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at capturing phase.\n */\n private _evtKeyDownCapturing(event: KeyboardEvent): void {\n if (event.eventPhase !== Event.CAPTURING_PHASE) {\n return;\n }\n\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.key === 'Escape') {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at target phase.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Allow for navigation using tab key\n if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n return;\n }\n\n // Check if Enter or Spacebar key has been pressed and open that tab\n if (\n event.key === 'Enter' ||\n event.key === 'Spacebar' ||\n event.key === ' '\n ) {\n // Get focus element that is in focus by the tab key\n const focusedElement = document.activeElement;\n\n // Test first if the focus is on the add button node\n if (\n this.addButtonEnabled &&\n this.addButtonNode.contains(focusedElement)\n ) {\n event.preventDefault();\n event.stopPropagation();\n this._addRequested.emit();\n } else {\n const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n tab.contains(focusedElement)\n );\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this.currentIndex = index;\n }\n }\n // Handle the arrow keys to switch tabs.\n } else if (ARROW_KEYS.includes(event.key)) {\n // Create a list of all focusable elements in the tab bar.\n const focusable: Element[] = [...this.contentNode.children];\n if (this.addButtonEnabled) {\n focusable.push(this.addButtonNode);\n }\n // If the tab bar contains only one element, nothing to do.\n if (focusable.length <= 1) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n\n // Get the current focused element.\n let focusedIndex = focusable.indexOf(document.activeElement as Element);\n if (focusedIndex === -1) {\n focusedIndex = this._currentIndex;\n }\n\n // Find the next element to focus on.\n let nextFocused: Element | null | undefined;\n if (\n (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowDown' && this._orientation === 'vertical')\n ) {\n nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n } else if (\n (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowUp' && this._orientation === 'vertical')\n ) {\n nextFocused =\n focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n } else if (event.key === 'Home') {\n nextFocused = focusable[0];\n } else if (event.key === 'End') {\n nextFocused = focusable[focusable.length - 1];\n }\n\n // Change the focused element and the tabindex value.\n if (nextFocused) {\n focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n nextFocused?.setAttribute('tabindex', '0');\n (nextFocused as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the tab bar.\n */\n private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse press.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if a drag is in progress.\n if (this._dragData) {\n return;\n }\n\n // Do nothing if a title editable input was clicked.\n if (\n (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n ) {\n return;\n }\n\n // Check if the add button was clicked.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the pressed tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab or the add button.\n if (index === -1 && !addButtonClicked) {\n return;\n }\n\n // Pressing on a tab stops the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Initialize the non-measured parts of the drag data.\n this._dragData = {\n tab: tabs[index] as HTMLElement,\n index: index,\n pressX: event.clientX,\n pressY: event.clientY,\n tabPos: -1,\n tabSize: -1,\n tabPressPos: -1,\n targetIndex: -1,\n tabLayout: null,\n contentRect: null,\n override: null,\n dragActive: false,\n dragAborted: false,\n detachRequested: false\n };\n\n // Add the document pointer up listener.\n this.document.addEventListener('pointerup', this, true);\n\n // Do nothing else if the middle button or add button is clicked.\n if (event.button === 1 || addButtonClicked) {\n return;\n }\n\n // Do nothing else if the close icon is clicked.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n return;\n }\n\n // Add the extra listeners if the tabs are movable.\n if (this.tabsMovable) {\n this.document.addEventListener('pointermove', this, true);\n this.document.addEventListener('keydown', this, true);\n this.document.addEventListener('contextmenu', this, true);\n }\n\n // Update the current index as appropriate.\n if (this.allowDeselect && this.currentIndex === index) {\n this.currentIndex = -1;\n } else {\n this.currentIndex = index;\n }\n\n // Do nothing else if there is no current tab.\n if (this.currentIndex === -1) {\n return;\n }\n\n // Emit the tab activate request signal.\n this._tabActivateRequested.emit({\n index: this.currentIndex,\n title: this.currentTitle!\n });\n }\n\n /**\n * Handle the `'pointermove'` event for the tab bar.\n */\n private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Suppress the event during a drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Bail early if the drag threshold has not been met.\n if (!data.dragActive && !Private.dragExceeded(data, event)) {\n return;\n }\n\n // Activate the drag if necessary.\n if (!data.dragActive) {\n // Fill in the rest of the drag data measurements.\n let tabRect = data.tab.getBoundingClientRect();\n if (this._orientation === 'horizontal') {\n data.tabPos = data.tab.offsetLeft;\n data.tabSize = tabRect.width;\n data.tabPressPos = data.pressX - tabRect.left;\n } else {\n data.tabPos = data.tab.offsetTop;\n data.tabSize = tabRect.height;\n data.tabPressPos = data.pressY - tabRect.top;\n }\n data.tabPressOffset = {\n x: data.pressX - tabRect.left,\n y: data.pressY - tabRect.top\n };\n data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n data.contentRect = this.contentNode.getBoundingClientRect();\n data.override = Drag.overrideCursor('default');\n\n // Add the dragging style classes.\n data.tab.classList.add('lm-mod-dragging');\n this.addClass('lm-mod-dragging');\n\n // Mark the drag as active.\n data.dragActive = true;\n }\n\n // Emit the detach requested signal if the threshold is exceeded.\n if (!data.detachRequested && Private.detachExceeded(data, event)) {\n // Only emit the signal once per drag cycle.\n data.detachRequested = true;\n\n // Setup the arguments for the signal.\n let index = data.index;\n let clientX = event.clientX;\n let clientY = event.clientY;\n let tab = tabs[index] as HTMLElement;\n let title = this._titles[index];\n\n // Emit the tab detach requested signal.\n this._tabDetachRequested.emit({\n index,\n title,\n tab,\n clientX,\n clientY,\n offset: data.tabPressOffset\n });\n\n // Bail if the signal handler aborted the drag.\n if (data.dragAborted) {\n return;\n }\n }\n\n // Update the positions of the tabs.\n Private.layoutTabs(tabs, data, event, this._orientation);\n }\n\n /**\n * Handle the `'pointerup'` event for the document.\n */\n private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse release.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if no drag is in progress.\n const data = this._dragData;\n if (!data) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Remove the extra mouse event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Handle a release when the drag is not active.\n if (!data.dragActive) {\n // Clear the drag data.\n this._dragData = null;\n\n // Handle clicking the add button.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n if (addButtonClicked) {\n this._addRequested.emit(undefined);\n return;\n }\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the released tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the release is not on the original pressed tab.\n if (index !== data.index) {\n return;\n }\n\n // Ignore the release if the title is not closable.\n let title = this._titles[index];\n if (!title.closable) {\n return;\n }\n\n // Emit the close requested signal if the middle button is released.\n if (event.button === 1) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Emit the close requested signal if the close icon was released.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Otherwise, there is nothing left to do.\n return;\n }\n\n // Do nothing if the left button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Position the tab at its final resting position.\n Private.finalizeTabPosition(data, this._orientation);\n\n // Remove the dragging class from the tab so it can be transitioned.\n data.tab.classList.remove('lm-mod-dragging');\n\n // Parse the transition duration for releasing the tab.\n let duration = Private.parseTransitionDuration(data.tab);\n\n // Complete the release on a timer to allow the tab to transition.\n setTimeout(() => {\n // Do nothing if the drag has been aborted.\n if (data.dragAborted) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Reset the positions of the tabs.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor grab.\n data.override!.dispose();\n\n // Remove the remaining dragging style.\n this.removeClass('lm-mod-dragging');\n\n // If the tab was not moved, there is nothing else to do.\n let i = data.index;\n let j = data.targetIndex;\n if (j === -1 || i === j) {\n return;\n }\n\n // Move the title to the new locations.\n ArrayExt.move(this._titles, i, j);\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Emit the tab moved signal.\n this._tabMoved.emit({\n fromIndex: i,\n toIndex: j,\n title: this._titles[j]\n });\n\n // Update the tabs immediately to prevent flicker.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n }, duration);\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n */\n private _releaseMouse(): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Remove the extra document event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Indicate the drag has been aborted. This allows the mouse\n // event handlers to return early when the drag is canceled.\n data.dragAborted = true;\n\n // If the drag is not active, there's nothing more to do.\n if (!data.dragActive) {\n return;\n }\n\n // Reset the tabs to their non-dragged positions.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor override.\n data.override!.dispose();\n\n // Clear the dragging style classes.\n data.tab.classList.remove('lm-mod-dragging');\n this.removeClass('lm-mod-dragging');\n }\n\n /**\n * Adjust the current index for a tab insert operation.\n *\n * This method accounts for the tab bar's insertion behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForInsert(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ct = this.currentTitle;\n let ci = this._currentIndex;\n let bh = this.insertBehavior;\n\n // TODO: do we need to do an update to update the aria-selected attribute?\n\n // Handle the behavior where the new tab is always selected,\n // or the behavior where the new tab is selected if needed.\n if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n this._currentIndex = i;\n this._previousTitle = ct;\n this._currentChanged.emit({\n previousIndex: ci,\n previousTitle: ct,\n currentIndex: i,\n currentTitle: title\n });\n return;\n }\n\n // Otherwise, silently adjust the current index if needed.\n if (ci >= i) {\n this._currentIndex++;\n }\n }\n\n /**\n * Adjust the current index for a tab move operation.\n *\n * This method will not cause the actual current tab to change.\n * It silently adjusts the index to account for the given move.\n */\n private _adjustCurrentForMove(i: number, j: number): void {\n if (this._currentIndex === i) {\n this._currentIndex = j;\n } else if (this._currentIndex < i && this._currentIndex >= j) {\n this._currentIndex++;\n } else if (this._currentIndex > i && this._currentIndex <= j) {\n this._currentIndex--;\n }\n }\n\n /**\n * Adjust the current index for a tab remove operation.\n *\n * This method accounts for the tab bar's remove behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForRemove(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ci = this._currentIndex;\n let bh = this.removeBehavior;\n\n // Silently adjust the index if the current tab is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._currentIndex--;\n }\n return;\n }\n\n // TODO: do we need to do an update to adjust the aria-selected value?\n\n // No tab gets selected if the tab bar is empty.\n if (this._titles.length === 0) {\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n return;\n }\n\n // Handle behavior where the next sibling tab is selected.\n if (bh === 'select-tab-after') {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous sibling tab is selected.\n if (bh === 'select-tab-before') {\n this._currentIndex = Math.max(0, i - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous history tab is selected.\n if (bh === 'select-previous-tab') {\n if (this._previousTitle) {\n this._currentIndex = this._titles.indexOf(this._previousTitle);\n this._previousTitle = null;\n } else {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n }\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Otherwise, no tab gets selected.\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n this.update();\n }\n\n private _name: string;\n private _currentIndex = -1;\n private _titles: Title[] = [];\n private _orientation: TabBar.Orientation;\n private _document: Document | ShadowRoot;\n private _titlesEditable: boolean = false;\n private _previousTitle: Title | null = null;\n private _dragData: Private.IDragData | null = null;\n private _addButtonEnabled: boolean = false;\n private _tabMoved = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n private _addRequested = new Signal(this);\n private _tabCloseRequested = new Signal<\n this,\n TabBar.ITabCloseRequestedArgs\n >(this);\n private _tabDetachRequested = new Signal<\n this,\n TabBar.ITabDetachRequestedArgs\n >(this);\n private _tabActivateRequested = new Signal<\n this,\n TabBar.ITabActivateRequestedArgs\n >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n /**\n * A type alias for a tab bar orientation.\n */\n export type Orientation =\n | /**\n * The tabs are arranged in a single row, left-to-right.\n *\n * The tab text orientation is horizontal.\n */\n 'horizontal'\n\n /**\n * The tabs are arranged in a single column, top-to-bottom.\n *\n * The tab text orientation is horizontal.\n */\n | 'vertical';\n\n /**\n * A type alias for the selection behavior on tab insert.\n */\n export type InsertBehavior =\n | /**\n * The selected tab will not be changed.\n */\n 'none'\n\n /**\n * The inserted tab will be selected.\n */\n | 'select-tab'\n\n /**\n * The inserted tab will be selected if the current tab is null.\n */\n | 'select-tab-if-needed';\n\n /**\n * A type alias for the selection behavior on tab remove.\n */\n export type RemoveBehavior =\n | /**\n * No tab will be selected.\n */\n 'none'\n\n /**\n * The tab after the removed tab will be selected if possible.\n */\n | 'select-tab-after'\n\n /**\n * The tab before the removed tab will be selected if possible.\n */\n | 'select-tab-before'\n\n /**\n * The previously selected tab will be selected if possible.\n */\n | 'select-previous-tab';\n\n /**\n * An options object for creating a tab bar.\n */\n export interface IOptions {\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n\n /**\n * Name of the tab bar.\n *\n * This is used for accessibility reasons. The default is the empty string.\n */\n name?: string;\n\n /**\n * The layout orientation of the tab bar.\n *\n * The default is `horizontal`.\n */\n orientation?: TabBar.Orientation;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * The default is `false`.\n */\n allowDeselect?: boolean;\n\n /**\n * Whether the titles can be directly edited by the user.\n *\n * The default is `false`.\n */\n titlesEditable?: boolean;\n\n /**\n * Whether the add button is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n *\n * The default is `'select-tab-if-needed'`.\n */\n insertBehavior?: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n *\n * The default is `'select-tab-after'`.\n */\n removeBehavior?: TabBar.RemoveBehavior;\n\n /**\n * A renderer to use with the tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n readonly previousIndex: number;\n\n /**\n * The previously selected title.\n */\n readonly previousTitle: Title | null;\n\n /**\n * The currently selected index.\n */\n readonly currentIndex: number;\n\n /**\n * The currently selected title.\n */\n readonly currentTitle: Title | null;\n }\n\n /**\n * The arguments object for the `tabMoved` signal.\n */\n export interface ITabMovedArgs {\n /**\n * The previous index of the tab.\n */\n readonly fromIndex: number;\n\n /**\n * The current index of the tab.\n */\n readonly toIndex: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabActivateRequested` signal.\n */\n export interface ITabActivateRequestedArgs {\n /**\n * The index of the tab to activate.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabCloseRequested` signal.\n */\n export interface ITabCloseRequestedArgs {\n /**\n * The index of the tab to close.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabDetachRequested` signal.\n */\n export interface ITabDetachRequestedArgs {\n /**\n * The index of the tab to detach.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n\n /**\n * The node representing the tab.\n */\n readonly tab: HTMLElement;\n\n /**\n * The current client X position of the mouse.\n */\n readonly clientX: number;\n\n /**\n * The current client Y position of the mouse.\n */\n readonly clientY: number;\n\n /**\n * The mouse position in the tab coordinate.\n */\n readonly offset?: { x: number; y: number };\n }\n\n /**\n * An object which holds the data to render a tab.\n */\n export interface IRenderData {\n /**\n * The title associated with the tab.\n */\n readonly title: Title;\n\n /**\n * Whether the tab is the current tab.\n */\n readonly current: boolean;\n\n /**\n * The z-index for the tab.\n */\n readonly zIndex: number;\n\n /**\n * The tabindex value for the tab.\n */\n readonly tabIndex?: number;\n }\n\n /**\n * A renderer for use with a tab bar.\n */\n export interface IRenderer {\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector: string;\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n constructor() {\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement {\n let title = data.title.caption;\n let key = this.createTabKey(data);\n let id = key;\n let style = this.createTabStyle(data);\n let className = this.createTabClass(data);\n let dataset = this.createTabDataset(data);\n let aria = this.createTabARIA(data);\n if (data.title.closable) {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderCloseIcon(data)\n );\n } else {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n }\n\n /**\n * Render the icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n const { title } = data;\n let className = this.createIconClass(data);\n\n // If title.icon is undefined, it will be ignored.\n return h.div({ className }, title.icon!, title.iconLabel);\n }\n\n /**\n * Render the label element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n }\n\n /**\n * Render the close icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab close icon.\n */\n renderCloseIcon(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n }\n\n /**\n * Create a unique render key for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The unique render key for the tab.\n *\n * #### Notes\n * This method caches the key against the tab title the first time\n * the key is generated. This enables efficient rendering of moved\n * tabs and avoids subtle hover style artifacts.\n */\n createTabKey(data: IRenderData): string {\n let key = this._tabKeys.get(data.title);\n if (key === undefined) {\n key = `tab-key-${this._uuid}-${this._tabID++}`;\n this._tabKeys.set(data.title, key);\n }\n return key;\n }\n\n /**\n * Create the inline style object for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The inline style data for the tab.\n */\n createTabStyle(data: IRenderData): ElementInlineStyle {\n return { zIndex: `${data.zIndex}` };\n }\n\n /**\n * Create the class name for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab.\n */\n createTabClass(data: IRenderData): string {\n let name = 'lm-TabBar-tab';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.title.closable) {\n name += ' lm-mod-closable';\n }\n if (data.current) {\n name += ' lm-mod-current';\n }\n return name;\n }\n\n /**\n * Create the dataset for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The dataset for the tab.\n */\n createTabDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the ARIA attributes for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The ARIA attributes for the tab.\n */\n createTabARIA(data: IRenderData): ElementARIAAttrs | ElementBaseAttrs {\n return {\n role: 'tab',\n 'aria-selected': data.current.toString(),\n tabindex: `${data.tabIndex ?? '-1'}`\n };\n }\n\n /**\n * Create the class name for the tab icon.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-TabBar-tabIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _tabID = 0;\n private _tabKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * A selector which matches the add button node in the tab bar.\n */\n export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The start drag distance threshold.\n */\n export const DRAG_THRESHOLD = 5;\n\n /**\n * The detach distance threshold.\n */\n export const DETACH_THRESHOLD = 20;\n\n /**\n * A struct which holds the drag data for a tab bar.\n */\n export interface IDragData {\n /**\n * The tab node being dragged.\n */\n tab: HTMLElement;\n\n /**\n * The index of the tab being dragged.\n */\n index: number;\n\n /**\n * The mouse press client X position.\n */\n pressX: number;\n\n /**\n * The mouse press client Y position.\n */\n pressY: number;\n\n /**\n * The offset left/top of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPos: number;\n\n /**\n * The offset width/height of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabSize: number;\n\n /**\n * The original mouse X/Y position in tab coordinates.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPressPos: number;\n\n /**\n * The original mouse position in tab coordinates.\n *\n * This is undefined if the drag is not active.\n */\n tabPressOffset?: { x: number; y: number };\n\n /**\n * The tab target index upon mouse release.\n *\n * This will be `-1` if the drag is not active.\n */\n targetIndex: number;\n\n /**\n * The array of tab layout objects snapped at drag start.\n *\n * This will be `null` if the drag is not active.\n */\n tabLayout: ITabLayout[] | null;\n\n /**\n * The bounding client rect of the tab bar content node.\n *\n * This will be `null` if the drag is not active.\n */\n contentRect: DOMRect | null;\n\n /**\n * The disposable to clean up the cursor override.\n *\n * This will be `null` if the drag is not active.\n */\n override: IDisposable | null;\n\n /**\n * Whether the drag is currently active.\n */\n dragActive: boolean;\n\n /**\n * Whether the drag has been aborted.\n */\n dragAborted: boolean;\n\n /**\n * Whether a detach request as been made.\n */\n detachRequested: boolean;\n }\n\n /**\n * An object which holds layout data for a tab.\n */\n export interface ITabLayout {\n /**\n * The left/top margin value for the tab.\n */\n margin: number;\n\n /**\n * The offset left/top position of the tab.\n */\n pos: number;\n\n /**\n * The offset width/height of the tab.\n */\n size: number;\n }\n\n /**\n * Create the DOM node for a tab bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.setAttribute('role', 'tablist');\n content.className = 'lm-TabBar-content';\n node.appendChild(content);\n\n let add = document.createElement('div');\n add.className = 'lm-TabBar-addButton lm-mod-hidden';\n add.setAttribute('tabindex', '-1');\n add.setAttribute('role', 'button');\n node.appendChild(add);\n return node;\n }\n\n /**\n * Coerce a title or options into a real title.\n */\n export function asTitle(value: Title | Title.IOptions): Title {\n return value instanceof Title ? value : new Title(value);\n }\n\n /**\n * Parse the transition duration for a tab node.\n */\n export function parseTransitionDuration(tab: HTMLElement): number {\n let style = window.getComputedStyle(tab);\n return 1000 * (parseFloat(style.transitionDuration!) || 0);\n }\n\n /**\n * Get a snapshot of the current tab layout values.\n */\n export function snapTabLayout(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): ITabLayout[] {\n let layout = new Array(tabs.length);\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let node = tabs[i] as HTMLElement;\n let style = window.getComputedStyle(node);\n if (orientation === 'horizontal') {\n layout[i] = {\n pos: node.offsetLeft,\n size: node.offsetWidth,\n margin: parseFloat(style.marginLeft!) || 0\n };\n } else {\n layout[i] = {\n pos: node.offsetTop,\n size: node.offsetHeight,\n margin: parseFloat(style.marginTop!) || 0\n };\n }\n }\n return layout;\n }\n\n /**\n * Test if the event exceeds the drag threshold.\n */\n export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n let dx = Math.abs(event.clientX - data.pressX);\n let dy = Math.abs(event.clientY - data.pressY);\n return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n }\n\n /**\n * Test if the event exceeds the drag detach threshold.\n */\n export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n let rect = data.contentRect!;\n return (\n event.clientX < rect.left - DETACH_THRESHOLD ||\n event.clientX >= rect.right + DETACH_THRESHOLD ||\n event.clientY < rect.top - DETACH_THRESHOLD ||\n event.clientY >= rect.bottom + DETACH_THRESHOLD\n );\n }\n\n /**\n * Update the relative tab positions and computed target index.\n */\n export function layoutTabs(\n tabs: HTMLCollection,\n data: IDragData,\n event: MouseEvent,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive values.\n let pressPos: number;\n let localPos: number;\n let clientPos: number;\n let clientSize: number;\n if (orientation === 'horizontal') {\n pressPos = data.pressX;\n localPos = event.clientX - data.contentRect!.left;\n clientPos = event.clientX;\n clientSize = data.contentRect!.width;\n } else {\n pressPos = data.pressY;\n localPos = event.clientY - data.contentRect!.top;\n clientPos = event.clientY;\n clientSize = data.contentRect!.height;\n }\n\n // Compute the target data.\n let targetIndex = data.index;\n let targetPos = localPos - data.tabPressPos;\n let targetEnd = targetPos + data.tabSize;\n\n // Update the relative tab positions.\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let pxPos: string;\n let layout = data.tabLayout![i];\n let threshold = layout.pos + (layout.size >> 1);\n if (i < data.index && targetPos < threshold) {\n pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n targetIndex = Math.min(targetIndex, i);\n } else if (i > data.index && targetEnd > threshold) {\n pxPos = `${-data.tabSize - layout.margin}px`;\n targetIndex = Math.max(targetIndex, i);\n } else if (i === data.index) {\n let ideal = clientPos - pressPos;\n let limit = clientSize - (data.tabPos + data.tabSize);\n pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n } else {\n pxPos = '';\n }\n if (orientation === 'horizontal') {\n (tabs[i] as HTMLElement).style.left = pxPos;\n } else {\n (tabs[i] as HTMLElement).style.top = pxPos;\n }\n }\n\n // Update the computed target index.\n data.targetIndex = targetIndex;\n }\n\n /**\n * Position the drag tab at its final resting relative position.\n */\n export function finalizeTabPosition(\n data: IDragData,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive client size.\n let clientSize: number;\n if (orientation === 'horizontal') {\n clientSize = data.contentRect!.width;\n } else {\n clientSize = data.contentRect!.height;\n }\n\n // Compute the ideal final tab position.\n let ideal: number;\n if (data.targetIndex === data.index) {\n ideal = 0;\n } else if (data.targetIndex > data.index) {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n } else {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos - data.tabPos;\n }\n\n // Compute the tab position limit.\n let limit = clientSize - (data.tabPos + data.tabSize);\n let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n // Set the final orientation-sensitive position.\n if (orientation === 'horizontal') {\n data.tab.style.left = `${final}px`;\n } else {\n data.tab.style.top = `${final}px`;\n }\n }\n\n /**\n * Reset the relative positions of the given tabs.\n */\n export function resetTabPositions(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): void {\n for (const tab of tabs) {\n if (orientation === 'horizontal') {\n (tab as HTMLElement).style.left = '';\n } else {\n (tab as HTMLElement).style.top = '';\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n /**\n * Construct a new dock layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: DockLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n this._document = options.document || document;\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n */\n dispose(): void {\n // Get an iterator over the widgets in the layout.\n let widgets = this[Symbol.iterator]();\n\n // Dispose of the layout items.\n this._items.forEach(item => {\n item.dispose();\n });\n\n // Clear the layout state before disposing the widgets.\n this._box = null;\n this._root = null;\n this._items.clear();\n\n // Dispose of the widgets contained in the old layout root.\n for (const widget of widgets) {\n widget.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The renderer used by the dock layout.\n */\n readonly renderer: DockLayout.IRenderer;\n\n /**\n * The method for hiding child widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n for (const bar of this.tabBars()) {\n if (bar.titles.length > 1) {\n for (const title of bar.titles) {\n title.owner.hiddenMode = this._hiddenMode;\n }\n }\n }\n }\n\n /**\n * Get the inter-element spacing for the dock layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the dock layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Whether the dock layout is empty.\n */\n get isEmpty(): boolean {\n return this._root === null;\n }\n\n /**\n * Create an iterator over all widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This iterator includes the generated tab bars.\n */\n [Symbol.iterator](): IterableIterator {\n return this._root ? this._root.iterAllWidgets() : empty();\n }\n\n /**\n * Create an iterator over the user widgets in the layout.\n *\n * @returns A new iterator over the user widgets in the layout.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n widgets(): IterableIterator {\n return this._root ? this._root.iterUserWidgets() : empty();\n }\n\n /**\n * Create an iterator over the selected widgets in the layout.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the layout.\n */\n selectedWidgets(): IterableIterator {\n return this._root ? this._root.iterSelectedWidgets() : empty();\n }\n\n /**\n * Create an iterator over the tab bars in the layout.\n *\n * @returns A new iterator over the tab bars in the layout.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n tabBars(): IterableIterator> {\n return this._root ? this._root.iterTabBars() : empty();\n }\n\n /**\n * Create an iterator over the handles in the layout.\n *\n * @returns A new iterator over the handles in the layout.\n */\n handles(): IterableIterator {\n return this._root ? this._root.iterHandles() : empty();\n }\n\n /**\n * Move a handle to the given offset position.\n *\n * @param handle - The handle to move.\n *\n * @param offsetX - The desired offset X position of the handle.\n *\n * @param offsetY - The desired offset Y position of the handle.\n *\n * #### Notes\n * If the given handle is not contained in the layout, this is no-op.\n *\n * The handle will be moved as close as possible to the desired\n * position without violating any of the layout constraints.\n *\n * Only one of the coordinates is used depending on the orientation\n * of the handle. This method accepts both coordinates to make it\n * easy to invoke from a mouse move event without needing to know\n * the handle orientation.\n */\n moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n // Bail early if there is no root or if the handle is hidden.\n let hidden = handle.classList.contains('lm-mod-hidden');\n if (!this._root || hidden) {\n return;\n }\n\n // Lookup the split node for the handle.\n let data = this._root.findSplitNode(handle);\n if (!data) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (data.node.orientation === 'horizontal') {\n delta = offsetX - handle.offsetLeft;\n } else {\n delta = offsetY - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent sibling resizing unless needed.\n data.node.holdSizes();\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Save the current configuration of the dock layout.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockLayout.ILayoutConfig {\n // Bail early if there is no root.\n if (!this._root) {\n return { main: null };\n }\n\n // Hold the current sizes in the layout tree.\n this._root.holdAllSizes();\n\n // Return the layout config.\n return { main: this._root.createConfig() };\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n */\n restoreLayout(config: DockLayout.ILayoutConfig): void {\n // Create the widget set for validating the config.\n let widgetSet = new Set();\n\n // Normalize the main area config and collect the widgets.\n let mainConfig: DockLayout.AreaConfig | null;\n if (config.main) {\n mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n } else {\n mainConfig = null;\n }\n\n // Create iterators over the old content.\n let oldWidgets = this.widgets();\n let oldTabBars = this.tabBars();\n let oldHandles = this.handles();\n\n // Clear the root before removing the old content.\n this._root = null;\n\n // Unparent the old widgets which are not in the new config.\n for (const widget of oldWidgets) {\n if (!widgetSet.has(widget)) {\n widget.parent = null;\n }\n }\n\n // Dispose of the old tab bars.\n for (const tabBar of oldTabBars) {\n tabBar.dispose();\n }\n\n // Remove the old handles.\n for (const handle of oldHandles) {\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n }\n\n // Reparent the new widgets to the current parent.\n for (const widget of widgetSet) {\n widget.parent = this.parent;\n }\n\n // Create the root node for the new config.\n if (mainConfig) {\n this._root = Private.realizeAreaConfig(\n mainConfig,\n {\n // Ignoring optional `document` argument as we must reuse `this._document`\n createTabBar: (document?: Document | ShadowRoot) =>\n this._createTabBar(),\n createHandle: () => this._createHandle()\n },\n this._document\n );\n } else {\n this._root = null;\n }\n\n // If there is no parent, there is nothing more to do.\n if (!this.parent) {\n return;\n }\n\n // Attach the new widgets to the parent.\n widgetSet.forEach(widget => {\n this.attachWidget(widget);\n });\n\n // Post a fit request to the parent.\n this.parent.fit();\n }\n\n /**\n * Add a widget to the dock layout.\n *\n * @param widget - The widget to add to the dock layout.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * The widget will be moved if it is already contained in the layout.\n *\n * An error will be thrown if the reference widget is invalid.\n */\n addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n // Parse the options.\n let ref = options.ref || null;\n let mode = options.mode || 'tab-after';\n\n // Find the tab node which holds the reference widget.\n let refNode: Private.TabLayoutNode | null = null;\n if (this._root && ref) {\n refNode = this._root.findTabNode(ref);\n }\n\n // Throw an error if the reference widget is invalid.\n if (ref && !refNode) {\n throw new Error('Reference widget is not in the layout.');\n }\n\n // Reparent the widget to the current layout parent.\n widget.parent = this.parent;\n\n // Insert the widget according to the insert mode.\n switch (mode) {\n case 'tab-after':\n this._insertTab(widget, ref, refNode, true);\n break;\n case 'tab-before':\n this._insertTab(widget, ref, refNode, false);\n break;\n case 'split-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false);\n break;\n case 'split-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false);\n break;\n case 'split-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true);\n break;\n case 'split-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true);\n break;\n case 'merge-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n break;\n case 'merge-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n break;\n case 'merge-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n break;\n case 'merge-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n break;\n }\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Ensure the widget is attached to the parent widget.\n this.attachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Remove the widget from its current layout location.\n this._removeWidget(widget);\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Detach the widget from the parent widget.\n this.detachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Find the tab area which contains the given client position.\n *\n * @param clientX - The client X position of interest.\n *\n * @param clientY - The client Y position of interest.\n *\n * @returns The geometry of the tab area at the given position, or\n * `null` if there is no tab area at the given position.\n */\n hitTestTabAreas(\n clientX: number,\n clientY: number\n ): DockLayout.ITabAreaGeometry | null {\n // Bail early if hit testing cannot produce valid results.\n if (!this._root || !this.parent || !this.parent.isVisible) {\n return null;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent.node);\n }\n\n // Convert from client to local coordinates.\n let rect = this.parent.node.getBoundingClientRect();\n let x = clientX - rect.left - this._box.borderLeft;\n let y = clientY - rect.top - this._box.borderTop;\n\n // Find the tab layout node at the local position.\n let tabNode = this._root.hitTestTabNodes(x, y);\n\n // Bail if a tab layout node was not found.\n if (!tabNode) {\n return null;\n }\n\n // Extract the data from the tab node.\n let { tabBar, top, left, width, height } = tabNode;\n\n // Compute the right and bottom edges of the tab area.\n let borderWidth = this._box.borderLeft + this._box.borderRight;\n let borderHeight = this._box.borderTop + this._box.borderBottom;\n let right = rect.width - borderWidth - (left + width);\n let bottom = rect.height - borderHeight - (top + height);\n\n // Return the hit test results.\n return { tabBar, x, y, top, left, right, bottom, width, height };\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n // Perform superclass initialization.\n super.init();\n\n // Attach each widget to the parent.\n for (const widget of this) {\n this.attachWidget(widget);\n }\n\n // Attach each handle to the parent.\n for (const handle of this.handles()) {\n this.parent!.node.appendChild(handle);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Attach the widget to the layout parent widget.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a no-op if the widget is already attached.\n */\n protected attachWidget(widget: Widget): void {\n // Do nothing if the widget is already attached.\n if (this.parent!.node === widget.node.parentNode) {\n return;\n }\n\n // Create the layout item for the widget.\n this._items.set(widget, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach the widget from the layout parent widget.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a no-op if the widget is not attached.\n */\n protected detachWidget(widget: Widget): void {\n // Do nothing if the widget is not attached.\n if (this.parent!.node !== widget.node.parentNode) {\n return;\n }\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Delete the layout item for the widget.\n let item = this._items.get(widget);\n if (item) {\n this._items.delete(widget);\n item.dispose();\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Remove the specified widget from the layout structure.\n *\n * #### Notes\n * This is a no-op if the widget is not in the layout tree.\n *\n * This does not detach the widget from the parent node.\n */\n private _removeWidget(widget: Widget): void {\n // Bail early if there is no layout root.\n if (!this._root) {\n return;\n }\n\n // Find the tab node which contains the given widget.\n let tabNode = this._root.findTabNode(widget);\n\n // Bail early if the tab node is not found.\n if (!tabNode) {\n return;\n }\n\n Private.removeAria(widget);\n\n // If there are multiple tabs, just remove the widget's tab.\n if (tabNode.tabBar.titles.length > 1) {\n tabNode.tabBar.removeTab(widget.title);\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n tabNode.tabBar.titles.length == 1\n ) {\n const existingWidget = tabNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Display;\n }\n return;\n }\n\n // Otherwise, the tab node needs to be removed...\n\n // Dispose the tab bar.\n tabNode.tabBar.dispose();\n\n // Handle the case where the tab node is the root.\n if (this._root === tabNode) {\n this._root = null;\n return;\n }\n\n // Otherwise, remove the tab node from its parent...\n\n // Prevent widget resizing unless needed.\n this._root.holdAllSizes();\n\n // Clear the parent reference on the tab node.\n let splitNode = tabNode.parent!;\n tabNode.parent = null;\n\n // Remove the tab node from its parent split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n ArrayExt.removeAt(splitNode.sizers, i);\n\n // Remove the handle from its parent DOM node.\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n\n // If there are multiple children, just update the handles.\n if (splitNode.children.length > 1) {\n splitNode.syncHandles();\n return;\n }\n\n // Otherwise, the split node also needs to be removed...\n\n // Clear the parent reference on the split node.\n let maybeParent = splitNode.parent;\n splitNode.parent = null;\n\n // Lookup the remaining child node and handle.\n let childNode = splitNode.children[0];\n let childHandle = splitNode.handles[0];\n\n // Clear the split node data.\n splitNode.children.length = 0;\n splitNode.handles.length = 0;\n splitNode.sizers.length = 0;\n\n // Remove the child handle from its parent node.\n if (childHandle.parentNode) {\n childHandle.parentNode.removeChild(childHandle);\n }\n\n // Handle the case where the split node is the root.\n if (this._root === splitNode) {\n childNode.parent = null;\n this._root = childNode;\n return;\n }\n\n // Otherwise, move the child node to the parent node...\n let parentNode = maybeParent!;\n\n // Lookup the index of the split node.\n let j = parentNode.children.indexOf(splitNode);\n\n // Handle the case where the child node is a tab node.\n if (childNode instanceof Private.TabLayoutNode) {\n childNode.parent = parentNode;\n parentNode.children[j] = childNode;\n return;\n }\n\n // Remove the split data from the parent.\n let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n ArrayExt.removeAt(parentNode.children, j);\n ArrayExt.removeAt(parentNode.sizers, j);\n\n // Remove the handle from its parent node.\n if (splitHandle.parentNode) {\n splitHandle.parentNode.removeChild(splitHandle);\n }\n\n // The child node and the split parent node will have the same\n // orientation. Merge the grand-children with the parent node.\n for (let i = 0, n = childNode.children.length; i < n; ++i) {\n let gChild = childNode.children[i];\n let gHandle = childNode.handles[i];\n let gSizer = childNode.sizers[i];\n ArrayExt.insert(parentNode.children, j + i, gChild);\n ArrayExt.insert(parentNode.handles, j + i, gHandle);\n ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n gChild.parent = parentNode;\n }\n\n // Clear the child node.\n childNode.children.length = 0;\n childNode.handles.length = 0;\n childNode.sizers.length = 0;\n childNode.parent = null;\n\n // Sync the handles on the parent node.\n parentNode.syncHandles();\n }\n\n /**\n * Create the tab layout node to hold the widget.\n */\n private _createTabNode(widget: Widget): Private.TabLayoutNode {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n Private.addAria(widget, tabNode.tabBar);\n return tabNode;\n }\n\n /**\n * Insert a widget next to an existing tab.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertTab(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n after: boolean\n ): void {\n // Do nothing if the tab is inserted next to itself.\n if (widget === ref) {\n return;\n }\n\n // Create the root if it does not exist.\n if (!this._root) {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n this._root = tabNode;\n Private.addAria(widget, tabNode.tabBar);\n return;\n }\n\n // Use the first tab node as the ref node if needed.\n if (!refNode) {\n refNode = this._root.findFirstTabNode()!;\n }\n\n // If the widget is not contained in the ref node, ensure it is\n // removed from the layout and hidden before being added again.\n if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n this._removeWidget(widget);\n widget.hide();\n }\n\n // Lookup the target index for inserting the tab.\n let index: number;\n if (ref) {\n index = refNode.tabBar.titles.indexOf(ref.title);\n } else {\n index = refNode.tabBar.currentIndex;\n }\n\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n if (refNode.tabBar.titles.length === 0) {\n // Singular tab should use display mode to limit number of layers.\n widget.hiddenMode = Widget.HiddenMode.Display;\n } else if (refNode.tabBar.titles.length == 1) {\n // If we are adding a second tab, switch the existing tab back to scale.\n const existingWidget = refNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n // For the third and subsequent tabs no special action is needed.\n widget.hiddenMode = Widget.HiddenMode.Scale;\n }\n } else {\n // For all other modes just propagate the current mode.\n widget.hiddenMode = this._hiddenMode;\n }\n\n // Insert the widget's tab relative to the target index.\n refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n Private.addAria(widget, refNode.tabBar);\n }\n\n /**\n * Insert a widget as a new split area.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertSplit(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n orientation: Private.Orientation,\n after: boolean,\n merge: boolean = false\n ): void {\n // Do nothing if there is no effective split.\n if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n return;\n }\n\n // Ensure the widget is removed from the current layout.\n this._removeWidget(widget);\n\n // Set the root if it does not exist.\n if (!this._root) {\n this._root = this._createTabNode(widget);\n return;\n }\n\n // If the ref node parent is null, split the root.\n if (!refNode || !refNode.parent) {\n // Ensure the root is split with the correct orientation.\n let root = this._splitRoot(orientation);\n\n // Determine the insert index for the new tab node.\n let i = after ? root.children.length : 0;\n\n // Normalize the split node.\n root.normalizeSizes();\n\n // Create the sizer for new tab node.\n let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n // Insert the tab node sized to the golden ratio.\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(root.children, i, tabNode);\n ArrayExt.insert(root.sizers, i, sizer);\n ArrayExt.insert(root.handles, i, this._createHandle());\n tabNode.parent = root;\n\n // Re-normalize the split node to maintain the ratios.\n root.normalizeSizes();\n\n // Finally, synchronize the visibility of the handles.\n root.syncHandles();\n return;\n }\n\n // Lookup the split node for the ref widget.\n let splitNode = refNode.parent;\n\n // If the split node already had the correct orientation,\n // the widget can be inserted into the split node directly.\n if (splitNode.orientation === orientation) {\n // Find the index of the ref node.\n let i = splitNode.children.indexOf(refNode);\n\n // Conditionally reuse a tab layout found in the wanted position.\n if (merge) {\n let j = i + (after ? 1 : -1);\n let sibling = splitNode.children[j];\n if (sibling instanceof Private.TabLayoutNode) {\n this._insertTab(widget, null, sibling, true);\n ++sibling.tabBar.currentIndex;\n return;\n }\n }\n\n // Normalize the split node.\n splitNode.normalizeSizes();\n\n // Consume half the space for the insert location.\n let s = (splitNode.sizers[i].sizeHint /= 2);\n\n // Insert the tab node sized to the other half.\n let j = i + (after ? 1 : 0);\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(splitNode.children, j, tabNode);\n ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n ArrayExt.insert(splitNode.handles, j, this._createHandle());\n tabNode.parent = splitNode;\n\n // Finally, synchronize the visibility of the handles.\n splitNode.syncHandles();\n return;\n }\n\n // Remove the ref node from the split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n // Create a new normalized split node for the children.\n let childNode = new Private.SplitLayoutNode(orientation);\n childNode.normalized = true;\n\n // Add the ref node sized to half the space.\n childNode.children.push(refNode);\n childNode.sizers.push(Private.createSizer(0.5));\n childNode.handles.push(this._createHandle());\n refNode.parent = childNode;\n\n // Add the tab node sized to the other half.\n let j = after ? 1 : 0;\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(childNode.children, j, tabNode);\n ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n ArrayExt.insert(childNode.handles, j, this._createHandle());\n tabNode.parent = childNode;\n\n // Synchronize the visibility of the handles.\n childNode.syncHandles();\n\n // Finally, add the new child node to the original split node.\n ArrayExt.insert(splitNode.children, i, childNode);\n childNode.parent = splitNode;\n }\n\n /**\n * Ensure the root is a split node with the given orientation.\n */\n private _splitRoot(\n orientation: Private.Orientation\n ): Private.SplitLayoutNode {\n // Bail early if the root already meets the requirements.\n let oldRoot = this._root;\n if (oldRoot instanceof Private.SplitLayoutNode) {\n if (oldRoot.orientation === orientation) {\n return oldRoot;\n }\n }\n\n // Create a new root node with the specified orientation.\n let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n // Add the old root to the new root.\n if (oldRoot) {\n newRoot.children.push(oldRoot);\n newRoot.sizers.push(Private.createSizer(0));\n newRoot.handles.push(this._createHandle());\n oldRoot.parent = newRoot;\n }\n\n // Return the new root as a convenience.\n return newRoot;\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the size limits for the layout tree.\n if (this._root) {\n let limits = this._root.fit(this._spacing, this._items);\n minW = limits.minWidth;\n minH = limits.minHeight;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Bail early if there is no root layout node.\n if (!this._root) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let x = this._box.paddingTop;\n let y = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the geometry of the layout tree.\n this._root.update(x, y, width, height, this._spacing, this._items);\n }\n\n /**\n * Create a new tab bar for use by the dock layout.\n *\n * #### Notes\n * The tab bar will be attached to the parent if it exists.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar using the renderer.\n let tabBar = this.renderer.createTabBar(this._document);\n\n // Enforce necessary tab bar behavior.\n tabBar.orientation = 'horizontal';\n\n // Attach the tab bar to the parent if possible.\n if (this.parent) {\n this.attachWidget(tabBar);\n }\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for the dock layout.\n *\n * #### Notes\n * The handle will be attached to the parent if it exists.\n */\n private _createHandle(): HTMLDivElement {\n // Create the handle using the renderer.\n let handle = this.renderer.createHandle();\n\n // Initialize the handle layout behavior.\n let style = handle.style;\n style.position = 'absolute';\n style.contain = 'strict';\n style.top = '0';\n style.left = '0';\n style.width = '0';\n style.height = '0';\n\n // Attach the handle to the parent if it exists.\n if (this.parent) {\n this.parent.node.appendChild(handle);\n }\n\n // Return the initialized handle.\n return handle;\n }\n\n private _spacing = 4;\n private _dirty = false;\n private _root: Private.LayoutNode | null = null;\n private _box: ElementExt.IBoxSizing | null = null;\n private _document: Document | ShadowRoot;\n private _hiddenMode: Widget.HiddenMode;\n private _items: Private.ItemMap = new Map();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n /**\n * An options object for creating a dock layout.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * The renderer to use for the dock layout.\n */\n renderer: IRenderer;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a dock layout.\n */\n export interface IRenderer {\n /**\n * Create a new tab bar for use with a dock layout.\n *\n * @returns A new tab bar for a dock layout.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar;\n\n /**\n * Create a new handle node for use with a dock layout.\n *\n * @returns A new handle node for a dock layout.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * A type alias for the supported insertion modes.\n *\n * An insert mode is used to specify how a widget should be added\n * to the dock layout relative to a reference widget.\n */\n export type InsertMode =\n | /**\n * The area to the top of the reference widget.\n *\n * The widget will be inserted just above the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the top edge of the dock layout.\n */\n 'split-top'\n\n /**\n * The area to the left of the reference widget.\n *\n * The widget will be inserted just left of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the left edge of the dock layout.\n */\n | 'split-left'\n\n /**\n * The area to the right of the reference widget.\n *\n * The widget will be inserted just right of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the right edge of the dock layout.\n */\n | 'split-right'\n\n /**\n * The area to the bottom of the reference widget.\n *\n * The widget will be inserted just below the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the bottom edge of the dock layout.\n */\n | 'split-bottom'\n\n /**\n * Like `split-top` but if a tab layout exists above the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-top'\n\n /**\n * Like `split-left` but if a tab layout exists left of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-left'\n\n /**\n * Like `split-right` but if a tab layout exists right of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-right'\n\n /**\n * Like `split-bottom` but if a tab layout exists below the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-bottom'\n\n /**\n * The tab position before the reference widget.\n *\n * The widget will be added as a tab before the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-before'\n\n /**\n * The tab position after the reference widget.\n *\n * The widget will be added as a tab after the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-after';\n\n /**\n * An options object for adding a widget to the dock layout.\n */\n export interface IAddOptions {\n /**\n * The insertion mode for adding the widget.\n *\n * The default is `'tab-after'`.\n */\n mode?: InsertMode;\n\n /**\n * The reference widget for the insert location.\n *\n * The default is `null`.\n */\n ref?: Widget | null;\n }\n\n /**\n * A layout config object for a tab area.\n */\n export interface ITabAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'tab-area';\n\n /**\n * The widgets contained in the tab area.\n */\n widgets: Widget[];\n\n /**\n * The index of the selected tab.\n */\n currentIndex: number;\n }\n\n /**\n * A layout config object for a split area.\n */\n export interface ISplitAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'split-area';\n\n /**\n * The orientation of the split area.\n */\n orientation: 'horizontal' | 'vertical';\n\n /**\n * The children in the split area.\n */\n children: AreaConfig[];\n\n /**\n * The relative sizes of the children.\n */\n sizes: number[];\n }\n\n /**\n * A type alias for a general area config.\n */\n export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n /**\n * A dock layout configuration object.\n */\n export interface ILayoutConfig {\n /**\n * The layout config for the main dock area.\n */\n main: AreaConfig | null;\n }\n\n /**\n * An object which represents the geometry of a tab area.\n */\n export interface ITabAreaGeometry {\n /**\n * The tab bar for the tab area.\n */\n tabBar: TabBar;\n\n /**\n * The local X position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the local X coordinate of the hit test query.\n */\n x: number;\n\n /**\n * The local Y position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the local Y coordinate of the hit test query.\n */\n y: number;\n\n /**\n * The local coordinate of the top edge of the tab area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the top edge of the tab area.\n */\n top: number;\n\n /**\n * The local coordinate of the left edge of the tab area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the left edge of the tab area.\n */\n left: number;\n\n /**\n * The local coordinate of the right edge of the tab area.\n *\n * #### Notes\n * This is the distance from the right edge of the layout parent\n * widget, to the right edge of the tab area.\n */\n right: number;\n\n /**\n * The local coordinate of the bottom edge of the tab area.\n *\n * #### Notes\n * This is the distance from the bottom edge of the layout parent\n * widget, to the bottom edge of the tab area.\n */\n bottom: number;\n\n /**\n * The width of the tab area.\n *\n * #### Notes\n * This is total width allocated for the tab area.\n */\n width: number;\n\n /**\n * The height of the tab area.\n *\n * #### Notes\n * This is total height allocated for the tab area.\n */\n height: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * A type alias for a dock layout node.\n */\n export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n /**\n * A type alias for the orientation of a split layout node.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a layout item map.\n */\n export type ItemMap = Map;\n\n /**\n * Create a box sizer with an initial size hint.\n */\n export function createSizer(hint: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = hint;\n sizer.size = hint;\n return sizer;\n }\n\n /**\n * Normalize an area config object and collect the visited widgets.\n */\n export function normalizeAreaConfig(\n config: DockLayout.AreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n let result: DockLayout.AreaConfig | null;\n if (config.type === 'tab-area') {\n result = normalizeTabAreaConfig(config, widgetSet);\n } else {\n result = normalizeSplitAreaConfig(config, widgetSet);\n }\n return result;\n }\n\n /**\n * Convert a normalized area config into a layout tree.\n */\n export function realizeAreaConfig(\n config: DockLayout.AreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): LayoutNode {\n let node: LayoutNode;\n if (config.type === 'tab-area') {\n node = realizeTabAreaConfig(config, renderer, document);\n } else {\n node = realizeSplitAreaConfig(config, renderer, document);\n }\n return node;\n }\n\n /**\n * A layout node which holds the data for a tabbed area.\n */\n export class TabLayoutNode {\n /**\n * Construct a new tab layout node.\n *\n * @param tabBar - The tab bar to use for the layout node.\n */\n constructor(tabBar: TabBar) {\n let tabSizer = new BoxSizer();\n let widgetSizer = new BoxSizer();\n tabSizer.stretch = 0;\n widgetSizer.stretch = 1;\n this.tabBar = tabBar;\n this.sizers = [tabSizer, widgetSizer];\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * The tab bar for the layout node.\n */\n readonly tabBar: TabBar;\n\n /**\n * The sizers for the layout node.\n */\n readonly sizers: [BoxSizer, BoxSizer];\n\n /**\n * The most recent value for the `top` edge of the layout box.\n */\n get top(): number {\n return this._top;\n }\n\n /**\n * The most recent value for the `left` edge of the layout box.\n */\n get left(): number {\n return this._left;\n }\n\n /**\n * The most recent value for the `width` of the layout box.\n */\n get width(): number {\n return this._width;\n }\n\n /**\n * The most recent value for the `height` of the layout box.\n */\n get height(): number {\n return this._height;\n }\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n yield this.tabBar;\n yield* this.iterUserWidgets();\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const title of this.tabBar.titles) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n let title = this.tabBar.currentTitle;\n if (title) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n yield this.tabBar;\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n // eslint-disable-next-line require-yield\n *iterHandles(): IterableIterator {\n return;\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n return this;\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n if (x < this._left || x >= this._left + this._width) {\n return null;\n }\n if (y < this._top || y >= this._top + this._height) {\n return null;\n }\n return this;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ITabAreaConfig {\n let widgets = this.tabBar.titles.map(title => title.owner);\n let currentIndex = this.tabBar.currentIndex;\n return { type: 'tab-area', widgets, currentIndex };\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n return;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Set up the limit variables.\n let minWidth = 0;\n let minHeight = 0;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Lookup the tab bar and widget sizers.\n let [tabBarSizer, widgetSizer] = this.sizers;\n\n // Update the tab bar limits.\n if (tabBarItem) {\n tabBarItem.fit();\n }\n\n // Update the widget limits.\n if (widgetItem) {\n widgetItem.fit();\n }\n\n // Update the results and sizer for the tab bar.\n if (tabBarItem && !tabBarItem.isHidden) {\n minWidth = Math.max(minWidth, tabBarItem.minWidth);\n minHeight += tabBarItem.minHeight;\n tabBarSizer.minSize = tabBarItem.minHeight;\n tabBarSizer.maxSize = tabBarItem.maxHeight;\n } else {\n tabBarSizer.minSize = 0;\n tabBarSizer.maxSize = 0;\n }\n\n // Update the results and sizer for the current widget.\n if (widgetItem && !widgetItem.isHidden) {\n minWidth = Math.max(minWidth, widgetItem.minWidth);\n minHeight += widgetItem.minHeight;\n widgetSizer.minSize = widgetItem.minHeight;\n widgetSizer.maxSize = Infinity;\n } else {\n widgetSizer.minSize = 0;\n widgetSizer.maxSize = Infinity;\n }\n\n // Return the computed size limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Update the layout box values.\n this._top = top;\n this._left = left;\n this._width = width;\n this._height = height;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, height);\n\n // Update the tab bar item using the computed size.\n if (tabBarItem && !tabBarItem.isHidden) {\n let size = this.sizers[0].size;\n tabBarItem.update(left, top, width, size);\n top += size;\n }\n\n // Layout the widget using the computed size.\n if (widgetItem && !widgetItem.isHidden) {\n let size = this.sizers[1].size;\n widgetItem.update(left, top, width, size);\n }\n }\n\n private _top = 0;\n private _left = 0;\n private _width = 0;\n private _height = 0;\n }\n\n /**\n * A layout node which holds the data for a split area.\n */\n export class SplitLayoutNode {\n /**\n * Construct a new split layout node.\n *\n * @param orientation - The orientation of the node.\n */\n constructor(orientation: Orientation) {\n this.orientation = orientation;\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * Whether the sizers have been normalized.\n */\n normalized = false;\n\n /**\n * The orientation of the node.\n */\n readonly orientation: Orientation;\n\n /**\n * The child nodes for the split node.\n */\n readonly children: LayoutNode[] = [];\n\n /**\n * The box sizers for the layout children.\n */\n readonly sizers: BoxSizer[] = [];\n\n /**\n * The handles for the layout children.\n */\n readonly handles: HTMLDivElement[] = [];\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterAllWidgets();\n }\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterUserWidgets();\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterSelectedWidgets();\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n for (const child of this.children) {\n yield* child.iterTabBars();\n }\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n *iterHandles(): IterableIterator {\n yield* this.handles;\n for (const child of this.children) {\n yield* child.iterHandles();\n }\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findTabNode(widget);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n let index = this.handles.indexOf(handle);\n if (index !== -1) {\n return { index, node: this };\n }\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findSplitNode(handle);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n if (this.children.length === 0) {\n return null;\n }\n return this.children[0].findFirstTabNode();\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].hitTestTabNodes(x, y);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ISplitAreaConfig {\n let orientation = this.orientation;\n let sizes = this.createNormalizedSizes();\n let children = this.children.map(child => child.createConfig());\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Sync the visibility and orientation of the handles.\n */\n syncHandles(): void {\n this.handles.forEach((handle, i) => {\n handle.setAttribute('data-orientation', this.orientation);\n if (i === this.handles.length - 1) {\n handle.classList.add('lm-mod-hidden');\n } else {\n handle.classList.remove('lm-mod-hidden');\n }\n });\n }\n\n /**\n * Hold the current sizes of the box sizers.\n *\n * This sets the size hint of each sizer to its current size.\n */\n holdSizes(): void {\n for (const sizer of this.sizers) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n for (const child of this.children) {\n child.holdAllSizes();\n }\n this.holdSizes();\n }\n\n /**\n * Normalize the sizes of the split layout node.\n */\n normalizeSizes(): void {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return;\n }\n\n // Hold the current sizes of the sizers.\n this.holdSizes();\n\n // Compute the sum of the sizes.\n let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint = 1 / n;\n }\n } else {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint /= sum;\n }\n }\n\n // Mark the sizes as normalized.\n this.normalized = true;\n }\n\n /**\n * Snap the normalized sizes of the split layout node.\n */\n createNormalizedSizes(): number[] {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return [];\n }\n\n // Grab the current sizes of the sizers.\n let sizes = this.sizers.map(sizer => sizer.size);\n\n // Compute the sum of the sizes.\n let sum = sizes.reduce((v, size) => v + size, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] = 1 / n;\n }\n } else {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] /= sum;\n }\n }\n\n // Return the normalized sizes.\n return sizes;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Compute the required fixed space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n // Set up the limit variables.\n let minWidth = horizontal ? fixed : 0;\n let minHeight = horizontal ? 0 : fixed;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Fit the children and update the limits.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let limits = this.children[i].fit(spacing, items);\n if (horizontal) {\n minHeight = Math.max(minHeight, limits.minHeight);\n minWidth += limits.minWidth;\n this.sizers[i].minSize = limits.minWidth;\n } else {\n minWidth = Math.max(minWidth, limits.minWidth);\n minHeight += limits.minHeight;\n this.sizers[i].minSize = limits.minHeight;\n }\n }\n\n // Return the computed limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Compute the available layout space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n // De-normalize the sizes if needed.\n if (this.normalized) {\n for (const sizer of this.sizers) {\n sizer.sizeHint *= space;\n }\n this.normalized = false;\n }\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, space);\n\n // Update the geometry of the child nodes and handles.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let child = this.children[i];\n let size = this.sizers[i].size;\n let handleStyle = this.handles[i].style;\n if (horizontal) {\n child.update(left, top, size, height, spacing, items);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${spacing}px`;\n handleStyle.height = `${height}px`;\n left += spacing;\n } else {\n child.update(left, top, width, size, spacing, items);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${spacing}px`;\n top += spacing;\n }\n }\n }\n }\n\n export function addAria(widget: Widget, tabBar: TabBar): void {\n widget.node.setAttribute('role', 'tabpanel');\n let renderer = tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n export function removeAria(widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n }\n\n /**\n * Normalize a tab area config and collect the visited widgets.\n */\n function normalizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n widgetSet: Set\n ): DockLayout.ITabAreaConfig | null {\n // Bail early if there is no content.\n if (config.widgets.length === 0) {\n return null;\n }\n\n // Setup the filtered widgets array.\n let widgets: Widget[] = [];\n\n // Filter the config for unique widgets.\n for (const widget of config.widgets) {\n if (!widgetSet.has(widget)) {\n widgetSet.add(widget);\n widgets.push(widget);\n }\n }\n\n // Bail if there are no effective widgets.\n if (widgets.length === 0) {\n return null;\n }\n\n // Normalize the current index.\n let index = config.currentIndex;\n if (index !== -1 && (index < 0 || index >= widgets.length)) {\n index = 0;\n }\n\n // Return a normalized config object.\n return { type: 'tab-area', widgets, currentIndex: index };\n }\n\n /**\n * Normalize a split area config and collect the visited widgets.\n */\n function normalizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n // Set up the result variables.\n let orientation = config.orientation;\n let children: DockLayout.AreaConfig[] = [];\n let sizes: number[] = [];\n\n // Normalize the config children.\n for (let i = 0, n = config.children.length; i < n; ++i) {\n // Normalize the child config.\n let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n // Ignore an empty child.\n if (!child) {\n continue;\n }\n\n // Add the child or hoist its content as appropriate.\n if (child.type === 'tab-area' || child.orientation !== orientation) {\n children.push(child);\n sizes.push(Math.abs(config.sizes[i] || 0));\n } else {\n children.push(...child.children);\n sizes.push(...child.sizes);\n }\n }\n\n // Bail if there are no effective children.\n if (children.length === 0) {\n return null;\n }\n\n // If there is only one effective child, return that child.\n if (children.length === 1) {\n return children[0];\n }\n\n // Return a normalized config object.\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Convert a normalized tab area config into a layout tree.\n */\n function realizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): TabLayoutNode {\n // Create the tab bar for the layout node.\n let tabBar = renderer.createTabBar(document);\n\n // Hide each widget and add it to the tab bar.\n for (const widget of config.widgets) {\n widget.hide();\n tabBar.addTab(widget.title);\n Private.addAria(widget, tabBar);\n }\n\n // Set the current index of the tab bar.\n tabBar.currentIndex = config.currentIndex;\n\n // Return the new tab layout node.\n return new TabLayoutNode(tabBar);\n }\n\n /**\n * Convert a normalized split area config into a layout tree.\n */\n function realizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): SplitLayoutNode {\n // Create the split layout node.\n let node = new SplitLayoutNode(config.orientation);\n\n // Add each child to the layout node.\n config.children.forEach((child, i) => {\n // Create the child data for the layout node.\n let childNode = realizeAreaConfig(child, renderer, document);\n let sizer = createSizer(config.sizes[i]);\n let handle = renderer.createHandle();\n\n // Add the child data to the layout node.\n node.children.push(childNode);\n node.handles.push(handle);\n node.sizers.push(sizer);\n\n // Update the parent for the child node.\n childNode.parent = node;\n });\n\n // Synchronize the handle state for the layout node.\n node.syncHandles();\n\n // Normalize the sizes for the layout node.\n node.normalizeSizes();\n\n // Return the new layout node.\n return node;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n */\nexport class DockPanel extends Widget {\n /**\n * Construct a new dock panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: DockPanel.IOptions = {}) {\n super();\n this.addClass('lm-DockPanel');\n this._document = options.document || document;\n this._mode = options.mode || 'multiple-document';\n this._renderer = options.renderer || DockPanel.defaultRenderer;\n this._edges = options.edges || Private.DEFAULT_EDGES;\n if (options.tabsMovable !== undefined) {\n this._tabsMovable = options.tabsMovable;\n }\n if (options.tabsConstrained !== undefined) {\n this._tabsConstrained = options.tabsConstrained;\n }\n if (options.addButtonEnabled !== undefined) {\n this._addButtonEnabled = options.addButtonEnabled;\n }\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = this._mode;\n\n // Create the delegate renderer for the layout.\n let renderer: DockPanel.IRenderer = {\n createTabBar: () => this._createTabBar(),\n createHandle: () => this._createHandle()\n };\n\n // Set up the dock layout for the panel.\n this.layout = new DockLayout({\n document: this._document,\n renderer,\n spacing: options.spacing,\n hiddenMode: options.hiddenMode\n });\n\n // Set up the overlay drop indicator.\n this.overlay = options.overlay || new DockPanel.Overlay();\n this.node.appendChild(this.overlay.node);\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n // Ensure the mouse is released.\n this._releaseMouse();\n\n // Hide the overlay.\n this.overlay.hide(0);\n\n // Cancel a drag if one is in progress.\n if (this._drag) {\n this._drag.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The method for hiding widgets.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as DockLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as DockLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when the layout configuration is modified.\n *\n * #### Notes\n * This signal is emitted whenever the current layout configuration\n * may have changed.\n *\n * This signal is emitted asynchronously in a collapsed fashion, so\n * that multiple synchronous modifications results in only a single\n * emit of the signal.\n */\n get layoutModified(): ISignal {\n return this._layoutModified;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The overlay used by the dock panel.\n */\n readonly overlay: DockPanel.IOverlay;\n\n /**\n * The renderer used by the dock panel.\n */\n get renderer(): DockPanel.IRenderer {\n return (this.layout as DockLayout).renderer;\n }\n\n /**\n * Get the spacing between the widgets.\n */\n get spacing(): number {\n return (this.layout as DockLayout).spacing;\n }\n\n /**\n * Set the spacing between the widgets.\n */\n set spacing(value: number) {\n (this.layout as DockLayout).spacing = value;\n }\n\n /**\n * Get the mode for the dock panel.\n */\n get mode(): DockPanel.Mode {\n return this._mode;\n }\n\n /**\n * Set the mode for the dock panel.\n *\n * #### Notes\n * Changing the mode is a destructive operation with respect to the\n * panel's layout configuration. If layout state must be preserved,\n * save the current layout config before changing the mode.\n */\n set mode(value: DockPanel.Mode) {\n // Bail early if the mode does not change.\n if (this._mode === value) {\n return;\n }\n\n // Update the internal mode.\n this._mode = value;\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = value;\n\n // Get the layout for the panel.\n let layout = this.layout as DockLayout;\n\n // Configure the layout for the specified mode.\n switch (value) {\n case 'multiple-document':\n for (const tabBar of layout.tabBars()) {\n tabBar.show();\n }\n break;\n case 'single-document':\n layout.restoreLayout(Private.createSingleDocumentConfig(this));\n break;\n default:\n throw 'unreachable';\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Whether the tabs can be dragged / moved at runtime.\n */\n get tabsMovable(): boolean {\n return this._tabsMovable;\n }\n\n /**\n * Enable / Disable draggable / movable tabs.\n */\n set tabsMovable(value: boolean) {\n this._tabsMovable = value;\n for (const tabBar of this.tabBars()) {\n tabBar.tabsMovable = value;\n }\n }\n\n /**\n * Whether the tabs are constrained to their source dock panel\n */\n get tabsConstrained(): boolean {\n return this._tabsConstrained;\n }\n\n /**\n * Constrain/Allow tabs to be dragged outside of this dock panel\n */\n set tabsConstrained(value: boolean) {\n this._tabsConstrained = value;\n }\n\n /**\n * Whether the add buttons for each tab bar are enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add buttons for each tab bar are enabled.\n */\n set addButtonEnabled(value: boolean) {\n this._addButtonEnabled = value;\n for (const tabBar of this.tabBars()) {\n tabBar.addButtonEnabled = value;\n }\n }\n\n /**\n * Whether the dock panel is empty.\n */\n get isEmpty(): boolean {\n return (this.layout as DockLayout).isEmpty;\n }\n\n /**\n * Create an iterator over the user widgets in the panel.\n *\n * @returns A new iterator over the user widgets in the panel.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n *widgets(): IterableIterator {\n yield* (this.layout as DockLayout).widgets();\n }\n\n /**\n * Create an iterator over the selected widgets in the panel.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the panel.\n */\n *selectedWidgets(): IterableIterator {\n yield* (this.layout as DockLayout).selectedWidgets();\n }\n\n /**\n * Create an iterator over the tab bars in the panel.\n *\n * @returns A new iterator over the tab bars in the panel.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n *tabBars(): IterableIterator> {\n yield* (this.layout as DockLayout).tabBars();\n }\n\n /**\n * Create an iterator over the handles in the panel.\n *\n * @returns A new iterator over the handles in the panel.\n */\n *handles(): IterableIterator {\n yield* (this.layout as DockLayout).handles();\n }\n\n /**\n * Select a specific widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will make the widget the current widget in its tab area.\n */\n selectWidget(widget: Widget): void {\n // Find the tab bar which contains the widget.\n let tabBar = find(this.tabBars(), bar => {\n return bar.titles.indexOf(widget.title) !== -1;\n });\n\n // Throw an error if no tab bar is found.\n if (!tabBar) {\n throw new Error('Widget is not contained in the dock panel.');\n }\n\n // Ensure the widget is the current widget.\n tabBar.currentTitle = widget.title;\n }\n\n /**\n * Activate a specified widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will select and activate the given widget.\n */\n activateWidget(widget: Widget): void {\n this.selectWidget(widget);\n widget.activate();\n }\n\n /**\n * Save the current layout configuration of the dock panel.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockPanel.ILayoutConfig {\n return (this.layout as DockLayout).saveLayout();\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n *\n * The dock panel automatically reverts to `'multiple-document'`\n * mode when a layout config is restored.\n */\n restoreLayout(config: DockPanel.ILayoutConfig): void {\n // Reset the mode.\n this._mode = 'multiple-document';\n\n // Restore the layout.\n (this.layout as DockLayout).restoreLayout(config);\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Add a widget to the dock panel.\n *\n * @param widget - The widget to add to the dock panel.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * If the panel is in single document mode, the options are ignored\n * and the widget is always added as tab in the hidden tab bar.\n */\n addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n // Add the widget to the layout.\n if (this._mode === 'single-document') {\n (this.layout as DockLayout).addWidget(widget);\n } else {\n (this.layout as DockLayout).addWidget(widget, options);\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n */\n processMessage(msg: Message): void {\n if (msg.type === 'layout-modified') {\n this._layoutModified.emit(undefined);\n } else {\n super.processMessage(msg);\n }\n }\n\n /**\n * Handle the DOM events for the dock panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'lm-dragenter':\n this._evtDragEnter(event as Drag.Event);\n break;\n case 'lm-dragleave':\n this._evtDragLeave(event as Drag.Event);\n break;\n case 'lm-dragover':\n this._evtDragOver(event as Drag.Event);\n break;\n case 'lm-drop':\n this._evtDrop(event as Drag.Event);\n break;\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('lm-dragenter', this);\n this.node.addEventListener('lm-dragleave', this);\n this.node.addEventListener('lm-dragover', this);\n this.node.addEventListener('lm-drop', this);\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('lm-dragenter', this);\n this.node.removeEventListener('lm-dragleave', this);\n this.node.removeEventListener('lm-dragover', this);\n this.node.removeEventListener('lm-drop', this);\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Add the widget class to the child.\n msg.child.addClass('lm-DockPanel-widget');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Remove the widget class from the child.\n msg.child.removeClass('lm-DockPanel-widget');\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `'lm-dragenter'` event for the dock panel.\n */\n private _evtDragEnter(event: Drag.Event): void {\n // If the factory mime type is present, mark the event as\n // handled in order to get the rest of the drag events.\n if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handle the `'lm-dragleave'` event for the dock panel.\n */\n private _evtDragLeave(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n if (this._tabsConstrained && event.source !== this) return;\n\n event.stopPropagation();\n\n // The new target might be a descendant, so we might still handle the drop.\n // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n // hide is cancelled by the lm-dragover handler's show overlay logic.\n this.overlay.hide(1);\n }\n\n /**\n * Handle the `'lm-dragover'` event for the dock panel.\n */\n private _evtDragOver(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Show the drop indicator overlay and update the drop\n // action based on the drop target zone under the mouse.\n if (\n (this._tabsConstrained && event.source !== this) ||\n this._showOverlay(event.clientX, event.clientY) === 'invalid'\n ) {\n event.dropAction = 'none';\n } else {\n event.stopPropagation();\n event.dropAction = event.proposedAction;\n }\n }\n\n /**\n * Handle the `'lm-drop'` event for the dock panel.\n */\n private _evtDrop(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Hide the drop indicator overlay.\n this.overlay.hide(0);\n\n // Bail if the proposed action is to do nothing.\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n\n // Find the drop target under the mouse.\n let { clientX, clientY } = event;\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // Bail if the drop zone is invalid.\n if (\n (this._tabsConstrained && event.source !== this) ||\n zone === 'invalid'\n ) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory mime type has invalid data.\n let mimeData = event.mimeData;\n let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n if (typeof factory !== 'function') {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory does not produce a widget.\n let widget = factory();\n if (!(widget instanceof Widget)) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the widget is an ancestor of the dock panel.\n if (widget.contains(this)) {\n event.dropAction = 'none';\n return;\n }\n\n // Find the reference widget for the drop target.\n let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n // Add the widget according to the indicated drop zone.\n switch (zone) {\n case 'root-all':\n this.addWidget(widget);\n break;\n case 'root-top':\n this.addWidget(widget, { mode: 'split-top' });\n break;\n case 'root-left':\n this.addWidget(widget, { mode: 'split-left' });\n break;\n case 'root-right':\n this.addWidget(widget, { mode: 'split-right' });\n break;\n case 'root-bottom':\n this.addWidget(widget, { mode: 'split-bottom' });\n break;\n case 'widget-all':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n case 'widget-top':\n this.addWidget(widget, { mode: 'split-top', ref });\n break;\n case 'widget-left':\n this.addWidget(widget, { mode: 'split-left', ref });\n break;\n case 'widget-right':\n this.addWidget(widget, { mode: 'split-right', ref });\n break;\n case 'widget-bottom':\n this.addWidget(widget, { mode: 'split-bottom', ref });\n break;\n case 'widget-tab':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n default:\n throw 'unreachable';\n }\n\n // Accept the proposed drop action.\n event.dropAction = event.proposedAction;\n\n // Stop propagation if we have not bailed so far.\n event.stopPropagation();\n\n // Activate the dropped widget.\n this.activateWidget(widget);\n }\n\n /**\n * Handle the `'keydown'` event for the dock panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the dock panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the left mouse button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the mouse target, if any.\n let layout = this.layout as DockLayout;\n let target = event.target as HTMLElement;\n let handle = find(layout.handles(), handle => handle.contains(target));\n if (!handle) {\n return;\n }\n\n // Stop the event when a handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n this._document.addEventListener('keydown', this, true);\n this._document.addEventListener('pointerup', this, true);\n this._document.addEventListener('pointermove', this, true);\n this._document.addEventListener('contextmenu', this, true);\n\n // Compute the offset deltas for the handle press.\n let rect = handle.getBoundingClientRect();\n let deltaX = event.clientX - rect.left;\n let deltaY = event.clientY - rect.top;\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!, this._document);\n this._pressData = { handle, deltaX, deltaY, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the dock panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event when dragging a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let rect = this.node.getBoundingClientRect();\n let xPos = event.clientX - rect.left - this._pressData.deltaX;\n let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n // Set the handle as close to the desired position as possible.\n let layout = this.layout as DockLayout;\n layout.moveHandle(this._pressData.handle, xPos, yPos);\n }\n\n /**\n * Handle the `'pointerup'` event for the dock panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the left mouse button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Release the mouse grab for the dock panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra document listeners.\n this._document.removeEventListener('keydown', this, true);\n this._document.removeEventListener('pointerup', this, true);\n this._document.removeEventListener('pointermove', this, true);\n this._document.removeEventListener('contextmenu', this, true);\n }\n\n /**\n * Show the overlay indicator at the given client position.\n *\n * Returns the drop zone at the specified client position.\n *\n * #### Notes\n * If the position is not over a valid zone, the overlay is hidden.\n */\n private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n // Find the dock target for the given client position.\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // If the drop zone is invalid, hide the overlay and bail.\n if (zone === 'invalid') {\n this.overlay.hide(100);\n return zone;\n }\n\n // Setup the variables needed to compute the overlay geometry.\n let top: number;\n let left: number;\n let right: number;\n let bottom: number;\n let box = ElementExt.boxSizing(this.node); // TODO cache this?\n let rect = this.node.getBoundingClientRect();\n\n // Compute the overlay geometry based on the dock zone.\n switch (zone) {\n case 'root-all':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-top':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = rect.height * Private.GOLDEN_RATIO;\n break;\n case 'root-left':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = rect.width * Private.GOLDEN_RATIO;\n bottom = box.paddingBottom;\n break;\n case 'root-right':\n top = box.paddingTop;\n left = rect.width * Private.GOLDEN_RATIO;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-bottom':\n top = rect.height * Private.GOLDEN_RATIO;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'widget-all':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-top':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height / 2;\n break;\n case 'widget-left':\n top = target!.top;\n left = target!.left;\n right = target!.right + target!.width / 2;\n bottom = target!.bottom;\n break;\n case 'widget-right':\n top = target!.top;\n left = target!.left + target!.width / 2;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-bottom':\n top = target!.top + target!.height / 2;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-tab': {\n const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height - tabHeight;\n break;\n }\n default:\n throw 'unreachable';\n }\n\n // Show the overlay with the computed geometry.\n this.overlay.show({ top, left, right, bottom });\n\n // Finally, return the computed drop zone.\n return zone;\n }\n\n /**\n * Create a new tab bar for use by the panel.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar.\n let tabBar = this._renderer.createTabBar(this._document);\n\n // Set the generated tab bar property for the tab bar.\n Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n // Hide the tab bar when in single document mode.\n if (this._mode === 'single-document') {\n tabBar.hide();\n }\n\n // Enforce necessary tab bar behavior.\n // TODO do we really want to enforce *all* of these?\n tabBar.tabsMovable = this._tabsMovable;\n tabBar.allowDeselect = false;\n tabBar.addButtonEnabled = this._addButtonEnabled;\n tabBar.removeBehavior = 'select-previous-tab';\n tabBar.insertBehavior = 'select-tab-if-needed';\n\n // Connect the signal handlers for the tab bar.\n tabBar.tabMoved.connect(this._onTabMoved, this);\n tabBar.currentChanged.connect(this._onCurrentChanged, this);\n tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for use by the panel.\n */\n private _createHandle(): HTMLDivElement {\n return this._renderer.createHandle();\n }\n\n /**\n * Handle the `tabMoved` signal from a tab bar.\n */\n private _onTabMoved(): void {\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `currentChanged` signal from a tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousTitle, currentTitle } = args;\n\n // Hide the previous widget.\n if (previousTitle) {\n previousTitle.owner.hide();\n }\n\n // Show the current widget.\n if (currentTitle) {\n currentTitle.owner.show();\n }\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `addRequested` signal from a tab bar.\n */\n private _onTabAddRequested(sender: TabBar): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from a tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from a tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabDetachRequested` signal from a tab bar.\n */\n private _onTabDetachRequested(\n sender: TabBar,\n args: TabBar.ITabDetachRequestedArgs\n ): void {\n // Do nothing if a drag is already in progress.\n if (this._drag) {\n return;\n }\n\n // Release the tab bar's hold on the mouse.\n sender.releaseMouse();\n\n // Extract the data from the args.\n let { title, tab, clientX, clientY, offset } = args;\n\n // Setup the mime data for the drag operation.\n let mimeData = new MimeData();\n let factory = () => title.owner;\n mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n // Create the drag image for the drag operation.\n let dragImage = tab.cloneNode(true) as HTMLElement;\n if (offset) {\n dragImage.style.top = `-${offset.y}px`;\n dragImage.style.left = `-${offset.x}px`;\n }\n\n // Create the drag object to manage the drag-drop operation.\n this._drag = new Drag({\n document: this._document,\n mimeData,\n dragImage,\n proposedAction: 'move',\n supportedActions: 'move',\n source: this\n });\n\n // Hide the tab node in the original tab.\n tab.classList.add('lm-mod-hidden');\n let cleanup = () => {\n this._drag = null;\n tab.classList.remove('lm-mod-hidden');\n };\n\n // Start the drag operation and cleanup when done.\n this._drag.start(clientX, clientY).then(cleanup);\n }\n\n private _edges: DockPanel.IEdges;\n private _document: Document | ShadowRoot;\n private _mode: DockPanel.Mode;\n private _drag: Drag | null = null;\n private _renderer: DockPanel.IRenderer;\n private _tabsMovable: boolean = true;\n private _tabsConstrained: boolean = false;\n private _addButtonEnabled: boolean = false;\n private _pressData: Private.IPressData | null = null;\n private _layoutModified = new Signal(this);\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n /**\n * An options object for creating a dock panel.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n /**\n * The overlay to use with the dock panel.\n *\n * The default is a new `Overlay` instance.\n */\n overlay?: IOverlay;\n\n /**\n * The renderer to use for the dock panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The spacing between the items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The mode for the dock panel.\n *\n * The default is `'multiple-document'`.\n */\n mode?: DockPanel.Mode;\n\n /**\n * The sizes of the edge drop zones, in pixels.\n * If not given, default values will be used.\n */\n edges?: IEdges;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * Allow tabs to be draggable / movable by user.\n *\n * The default is `'true'`.\n */\n tabsMovable?: boolean;\n\n /**\n * Constrain tabs to this dock panel\n *\n * The default is `'false'`.\n */\n tabsConstrained?: boolean;\n\n /**\n * Enable add buttons in each of the dock panel's tab bars.\n *\n * The default is `'false'`.\n */\n addButtonEnabled?: boolean;\n }\n\n /**\n * The sizes of the edge drop zones, in pixels.\n */\n export interface IEdges {\n /**\n * The size of the top edge drop zone.\n */\n top: number;\n\n /**\n * The size of the right edge drop zone.\n */\n right: number;\n\n /**\n * The size of the bottom edge drop zone.\n */\n bottom: number;\n\n /**\n * The size of the left edge drop zone.\n */\n left: number;\n }\n\n /**\n * A type alias for the supported dock panel modes.\n */\n export type Mode =\n | /**\n * The single document mode.\n *\n * In this mode, only a single widget is visible at a time, and that\n * widget fills the available layout space. No tab bars are visible.\n */\n 'single-document'\n\n /**\n * The multiple document mode.\n *\n * In this mode, multiple documents are displayed in separate tab\n * areas, and those areas can be individually resized by the user.\n */\n | 'multiple-document';\n\n /**\n * A type alias for a layout configuration object.\n */\n export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n /**\n * A type alias for the supported insertion modes.\n */\n export type InsertMode = DockLayout.InsertMode;\n\n /**\n * A type alias for the add widget options.\n */\n export type IAddOptions = DockLayout.IAddOptions;\n\n /**\n * An object which holds the geometry for overlay positioning.\n */\n export interface IOverlayGeometry {\n /**\n * The distance between the overlay and parent top edges.\n */\n top: number;\n\n /**\n * The distance between the overlay and parent left edges.\n */\n left: number;\n\n /**\n * The distance between the overlay and parent right edges.\n */\n right: number;\n\n /**\n * The distance between the overlay and parent bottom edges.\n */\n bottom: number;\n }\n\n /**\n * An object which manages the overlay node for a dock panel.\n */\n export interface IOverlay {\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n *\n * #### Notes\n * The given geometry values assume the node will use absolute\n * positioning.\n *\n * This is called on every mouse move event during a drag in order\n * to update the position of the overlay. It should be efficient.\n */\n show(geo: IOverlayGeometry): void;\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 should hide the overlay immediately.\n *\n * #### Notes\n * This is called whenever the overlay node should been hidden.\n */\n hide(delay: number): void;\n }\n\n /**\n * A concrete implementation of `IOverlay`.\n *\n * This is the default overlay implementation for a dock panel.\n */\n export class Overlay implements IOverlay {\n /**\n * Construct a new overlay.\n */\n constructor() {\n this.node = document.createElement('div');\n this.node.classList.add('lm-DockPanel-overlay');\n this.node.classList.add('lm-mod-hidden');\n this.node.style.position = 'absolute';\n this.node.style.contain = 'strict';\n }\n\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n */\n show(geo: IOverlayGeometry): void {\n // Update the position of the overlay.\n let style = this.node.style;\n style.top = `${geo.top}px`;\n style.left = `${geo.left}px`;\n style.right = `${geo.right}px`;\n style.bottom = `${geo.bottom}px`;\n\n // Clear any pending hide timer.\n clearTimeout(this._timer);\n this._timer = -1;\n\n // If the overlay is already visible, we're done.\n if (!this._hidden) {\n return;\n }\n\n // Clear the hidden flag.\n this._hidden = false;\n\n // Finally, show the overlay.\n this.node.classList.remove('lm-mod-hidden');\n }\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 will hide the overlay immediately.\n */\n hide(delay: number): void {\n // Do nothing if the overlay is already hidden.\n if (this._hidden) {\n return;\n }\n\n // Hide immediately if the delay is <= 0.\n if (delay <= 0) {\n clearTimeout(this._timer);\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n return;\n }\n\n // Do nothing if a hide is already pending.\n if (this._timer !== -1) {\n return;\n }\n\n // Otherwise setup the hide timer.\n this._timer = window.setTimeout(() => {\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n }, delay);\n }\n\n private _timer = -1;\n private _hidden = true;\n }\n\n /**\n * A type alias for a dock panel renderer;\n */\n export type IRenderer = DockLayout.IRenderer;\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new tab bar for use with a dock panel.\n *\n * @returns A new tab bar for a dock panel.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar {\n let bar = new TabBar({ document });\n bar.addClass('lm-DockPanel-tabBar');\n return bar;\n }\n\n /**\n * Create a new handle node for use with a dock panel.\n *\n * @returns A new handle node for a dock panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-DockPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * The default sizes for the edge drop zones, in pixels.\n */\n export const DEFAULT_EDGES = {\n /**\n * The size of the top edge dock zone for the root panel, in pixels.\n * This is different from the others to distinguish between the top\n * tab bar and the top root zone.\n */\n top: 12,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n right: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n bottom: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n left: 40\n };\n\n /**\n * A singleton `'layout-modified'` conflatable message.\n */\n export const LayoutModified = new ConflatableMessage('layout-modified');\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The handle which was pressed.\n */\n handle: HTMLDivElement;\n\n /**\n * The X offset of the press in handle coordinates.\n */\n deltaX: number;\n\n /**\n * The Y offset of the press in handle coordinates.\n */\n deltaY: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * A type alias for a drop zone.\n */\n export type DropZone =\n | /**\n * An invalid drop zone.\n */\n 'invalid'\n\n /**\n * The entirety of the root dock area.\n */\n | 'root-all'\n\n /**\n * The top portion of the root dock area.\n */\n | 'root-top'\n\n /**\n * The left portion of the root dock area.\n */\n | 'root-left'\n\n /**\n * The right portion of the root dock area.\n */\n | 'root-right'\n\n /**\n * The bottom portion of the root dock area.\n */\n | 'root-bottom'\n\n /**\n * The entirety of a tabbed widget area.\n */\n | 'widget-all'\n\n /**\n * The top portion of tabbed widget area.\n */\n | 'widget-top'\n\n /**\n * The left portion of tabbed widget area.\n */\n | 'widget-left'\n\n /**\n * The right portion of tabbed widget area.\n */\n | 'widget-right'\n\n /**\n * The bottom portion of tabbed widget area.\n */\n | 'widget-bottom'\n\n /**\n * The the bar of a tabbed widget area.\n */\n | 'widget-tab';\n\n /**\n * An object which holds the drop target zone and widget.\n */\n export interface IDropTarget {\n /**\n * The semantic zone for the mouse position.\n */\n zone: DropZone;\n\n /**\n * The tab area geometry for the drop zone, or `null`.\n */\n target: DockLayout.ITabAreaGeometry | null;\n }\n\n /**\n * An attached property used to track generated tab bars.\n */\n export const isGeneratedTabBarProperty = new AttachedProperty<\n Widget,\n boolean\n >({\n name: 'isGeneratedTabBar',\n create: () => false\n });\n\n /**\n * Create a single document config for the widgets in a dock panel.\n */\n export function createSingleDocumentConfig(\n panel: DockPanel\n ): DockPanel.ILayoutConfig {\n // Return an empty config if the panel is empty.\n if (panel.isEmpty) {\n return { main: null };\n }\n\n // Get a flat array of the widgets in the panel.\n let widgets = Array.from(panel.widgets());\n\n // Get the first selected widget in the panel.\n let selected = panel.selectedWidgets().next().value;\n\n // Compute the current index for the new config.\n let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n // Return the single document config.\n return { main: { type: 'tab-area', widgets, currentIndex } };\n }\n\n /**\n * Find the drop target at the given client position.\n */\n export function findDropTarget(\n panel: DockPanel,\n clientX: number,\n clientY: number,\n edges: DockPanel.IEdges\n ): IDropTarget {\n // Bail if the mouse is not over the dock panel.\n if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n return { zone: 'invalid', target: null };\n }\n\n // Look up the layout for the panel.\n let layout = panel.layout as DockLayout;\n\n // If the layout is empty, indicate the entire root drop zone.\n if (layout.isEmpty) {\n return { zone: 'root-all', target: null };\n }\n\n // Test the edge zones when in multiple document mode.\n if (panel.mode === 'multiple-document') {\n // Get the client rect for the dock panel.\n let panelRect = panel.node.getBoundingClientRect();\n\n // Compute the distance to each edge of the panel.\n let pl = clientX - panelRect.left + 1;\n let pt = clientY - panelRect.top + 1;\n let pr = panelRect.right - clientX;\n let pb = panelRect.bottom - clientY;\n\n // Find the minimum distance to an edge.\n let pd = Math.min(pt, pr, pb, pl);\n\n // Return a root zone if the mouse is within an edge.\n switch (pd) {\n case pt:\n if (pt < edges.top) {\n return { zone: 'root-top', target: null };\n }\n break;\n case pr:\n if (pr < edges.right) {\n return { zone: 'root-right', target: null };\n }\n break;\n case pb:\n if (pb < edges.bottom) {\n return { zone: 'root-bottom', target: null };\n }\n break;\n case pl:\n if (pl < edges.left) {\n return { zone: 'root-left', target: null };\n }\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Hit test the dock layout at the given client position.\n let target = layout.hitTestTabAreas(clientX, clientY);\n\n // Bail if no target area was found.\n if (!target) {\n return { zone: 'invalid', target: null };\n }\n\n // Return the whole tab area when in single document mode.\n if (panel.mode === 'single-document') {\n return { zone: 'widget-all', target };\n }\n\n // Compute the distance to each edge of the tab area.\n let al = target.x - target.left + 1;\n let at = target.y - target.top + 1;\n let ar = target.left + target.width - target.x;\n let ab = target.top + target.height - target.y;\n\n const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n if (at < tabHeight) {\n return { zone: 'widget-tab', target };\n }\n\n // Get the X and Y edge sizes for the area.\n let rx = Math.round(target.width / 3);\n let ry = Math.round(target.height / 3);\n\n // If the mouse is not within an edge, indicate the entire area.\n if (al > rx && ar > rx && at > ry && ab > ry) {\n return { zone: 'widget-all', target };\n }\n\n // Scale the distances by the slenderness ratio.\n al /= rx;\n at /= ry;\n ar /= rx;\n ab /= ry;\n\n // Find the minimum distance to the area edge.\n let ad = Math.min(al, at, ar, ab);\n\n // Find the widget zone for the area edge.\n let zone: DropZone;\n switch (ad) {\n case al:\n zone = 'widget-left';\n break;\n case at:\n zone = 'widget-top';\n break;\n case ar:\n zone = 'widget-right';\n break;\n case ab:\n zone = 'widget-bottom';\n break;\n default:\n throw 'unreachable';\n }\n\n // Return the final drop target.\n return { zone, target };\n }\n\n /**\n * Get the drop reference widget for a tab bar.\n */\n export function getDropRef(tabBar: TabBar): Widget | null {\n if (tabBar.titles.length === 0) {\n return null;\n }\n if (tabBar.currentTitle) {\n return tabBar.currentTitle.owner;\n }\n return tabBar.titles[tabBar.titles.length - 1].owner;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker implements IDisposable {\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose(): void {\n // Do nothing if the tracker is already disposed.\n if (this._counter < 0) {\n return;\n }\n\n // Mark the tracker as disposed.\n this._counter = -1;\n\n // Clear the connections for the tracker.\n Signal.clearData(this);\n\n // Remove all event listeners.\n for (const widget of this._widgets) {\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n }\n\n // Clear the internal data structures.\n this._activeWidget = null;\n this._currentWidget = null;\n this._nodes.clear();\n this._numbers.clear();\n this._widgets.length = 0;\n }\n\n /**\n * A signal emitted when the current widget has changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when the active widget has changed.\n */\n get activeChanged(): ISignal> {\n return this._activeChanged;\n }\n\n /**\n * A flag indicating whether the tracker is disposed.\n */\n get isDisposed(): boolean {\n return this._counter < 0;\n }\n\n /**\n * The current widget in the tracker.\n *\n * #### Notes\n * The current widget is the widget among the tracked widgets which\n * has the *descendant node* which has most recently been focused.\n *\n * The current widget will not be updated if the node loses focus. It\n * will only be updated when a different tracked widget gains focus.\n *\n * If the current widget is removed from the tracker, the previous\n * current widget will be restored.\n *\n * This behavior is intended to follow a user's conceptual model of\n * a semantically \"current\" widget, where the \"last thing of type X\"\n * to be interacted with is the \"current instance of X\", regardless\n * of whether that instance still has focus.\n */\n get currentWidget(): T | null {\n return this._currentWidget;\n }\n\n /**\n * The active widget in the tracker.\n *\n * #### Notes\n * The active widget is the widget among the tracked widgets which\n * has the *descendant node* which is currently focused.\n */\n get activeWidget(): T | null {\n return this._activeWidget;\n }\n\n /**\n * A read only array of the widgets being tracked.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Get the focus number for a particular widget in the tracker.\n *\n * @param widget - The widget of interest.\n *\n * @returns The focus number for the given widget, or `-1` if the\n * widget has not had focus since being added to the tracker, or\n * is not contained by the tracker.\n *\n * #### Notes\n * The focus number indicates the relative order in which the widgets\n * have gained focus. A widget with a larger number has gained focus\n * more recently than a widget with a smaller number.\n *\n * The `currentWidget` will always have the largest focus number.\n *\n * All widgets start with a focus number of `-1`, which indicates that\n * the widget has not been focused since being added to the tracker.\n */\n focusNumber(widget: T): number {\n let n = this._numbers.get(widget);\n return n === undefined ? -1 : n;\n }\n\n /**\n * Test whether the focus tracker contains a given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns `true` if the widget is tracked, `false` otherwise.\n */\n has(widget: T): boolean {\n return this._numbers.has(widget);\n }\n\n /**\n * Add a widget to the focus tracker.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is already tracked, this is a no-op.\n */\n add(widget: T): void {\n // Do nothing if the widget is already tracked.\n if (this._numbers.has(widget)) {\n return;\n }\n\n // Test whether the widget has focus.\n let focused = widget.node.contains(document.activeElement);\n\n // Set up the initial focus number.\n let n = focused ? this._counter++ : -1;\n\n // Add the widget to the internal data structures.\n this._widgets.push(widget);\n this._numbers.set(widget, n);\n this._nodes.set(widget.node, widget);\n\n // Set up the event listeners. The capturing phase must be used\n // since the 'focus' and 'blur' events don't bubble and Firefox\n // doesn't support the 'focusin' or 'focusout' events.\n widget.node.addEventListener('focus', this, true);\n widget.node.addEventListener('blur', this, true);\n\n // Connect the disposed signal handler.\n widget.disposed.connect(this._onWidgetDisposed, this);\n\n // Set the current and active widgets if needed.\n if (focused) {\n this._setWidgets(widget, widget);\n }\n }\n\n /**\n * Remove a widget from the focus tracker.\n *\n * #### Notes\n * If the widget is the `currentWidget`, the previous current widget\n * will become the new `currentWidget`.\n *\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is not tracked, this is a no-op.\n */\n remove(widget: T): void {\n // Bail early if the widget is not tracked.\n if (!this._numbers.has(widget)) {\n return;\n }\n\n // Disconnect the disposed signal handler.\n widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n // Remove the event listeners.\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n\n // Remove the widget from the internal data structures.\n ArrayExt.removeFirstOf(this._widgets, widget);\n this._nodes.delete(widget.node);\n this._numbers.delete(widget);\n\n // Bail early if the widget is not the current widget.\n if (this._currentWidget !== widget) {\n return;\n }\n\n // Filter the widgets for those which have had focus.\n let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n // Get the valid widget with the max focus number.\n let previous =\n max(valid, (first, second) => {\n let a = this._numbers.get(first)!;\n let b = this._numbers.get(second)!;\n return a - b;\n }) || null;\n\n // Set the current and active widgets.\n this._setWidgets(previous, null);\n }\n\n /**\n * Handle the DOM events for the focus tracker.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tracked nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n }\n }\n\n /**\n * Set the current and active widgets for the tracker.\n */\n private _setWidgets(current: T | null, active: T | null): void {\n // Swap the current widget.\n let oldCurrent = this._currentWidget;\n this._currentWidget = current;\n\n // Swap the active widget.\n let oldActive = this._activeWidget;\n this._activeWidget = active;\n\n // Emit the `currentChanged` signal if needed.\n if (oldCurrent !== current) {\n this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n }\n\n // Emit the `activeChanged` signal if needed.\n if (oldActive !== active) {\n this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n }\n }\n\n /**\n * Handle the `'focus'` event for a tracked widget.\n */\n private _evtFocus(event: FocusEvent): void {\n // Find the widget which gained focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Update the focus number if necessary.\n if (widget !== this._currentWidget) {\n this._numbers.set(widget, this._counter++);\n }\n\n // Set the current and active widgets.\n this._setWidgets(widget, widget);\n }\n\n /**\n * Handle the `'blur'` event for a tracked widget.\n */\n private _evtBlur(event: FocusEvent): void {\n // Find the widget which lost focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Get the node which being focused after this blur.\n let focusTarget = event.relatedTarget as HTMLElement;\n\n // If no other node is being focused, clear the active widget.\n if (!focusTarget) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n\n // Bail if the focus widget is not changing.\n if (widget.node.contains(focusTarget)) {\n return;\n }\n\n // If no tracked widget is being focused, clear the active widget.\n if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n }\n\n /**\n * Handle the `disposed` signal for a tracked widget.\n */\n private _onWidgetDisposed(sender: T): void {\n this.remove(sender);\n }\n\n private _counter = 0;\n private _widgets: T[] = [];\n private _activeWidget: T | null = null;\n private _currentWidget: T | null = null;\n private _numbers = new Map();\n private _nodes = new Map();\n private _activeChanged = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n /**\n * An arguments object for the changed signals.\n */\n export interface IChangedArgs {\n /**\n * The old value for the widget.\n */\n oldValue: T | null;\n\n /**\n * The new value for the widget.\n */\n newValue: T | null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n /**\n * Construct a new grid layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: GridLayout.IOptions = {}) {\n super(options);\n if (options.rowCount !== undefined) {\n Private.reallocSizers(this._rowSizers, options.rowCount);\n }\n if (options.columnCount !== undefined) {\n Private.reallocSizers(this._columnSizers, options.columnCount);\n }\n if (options.rowSpacing !== undefined) {\n this._rowSpacing = Private.clampValue(options.rowSpacing);\n }\n if (options.columnSpacing !== undefined) {\n this._columnSpacing = Private.clampValue(options.columnSpacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the widgets and layout items.\n for (const item of this._items) {\n let widget = item.widget;\n item.dispose();\n widget.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._rowStarts.length = 0;\n this._rowSizers.length = 0;\n this._columnStarts.length = 0;\n this._columnSizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the number of rows in the layout.\n */\n get rowCount(): number {\n return this._rowSizers.length;\n }\n\n /**\n * Set the number of rows in the layout.\n *\n * #### Notes\n * The minimum row count is `1`.\n */\n set rowCount(value: number) {\n // Do nothing if the row count does not change.\n if (value === this.rowCount) {\n return;\n }\n\n // Reallocate the row sizers.\n Private.reallocSizers(this._rowSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the number of columns in the layout.\n */\n get columnCount(): number {\n return this._columnSizers.length;\n }\n\n /**\n * Set the number of columns in the layout.\n *\n * #### Notes\n * The minimum column count is `1`.\n */\n set columnCount(value: number) {\n // Do nothing if the column count does not change.\n if (value === this.columnCount) {\n return;\n }\n\n // Reallocate the column sizers.\n Private.reallocSizers(this._columnSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the row spacing for the layout.\n */\n get rowSpacing(): number {\n return this._rowSpacing;\n }\n\n /**\n * Set the row spacing for the layout.\n */\n set rowSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._rowSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._rowSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the column spacing for the layout.\n */\n get columnSpacing(): number {\n return this._columnSpacing;\n }\n\n /**\n * Set the col spacing for the layout.\n */\n set columnSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._columnSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._columnSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @returns The stretch factor for the row.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n rowStretch(index: number): number {\n let sizer = this._rowSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @param value - The stretch factor for the row.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setRowStretch(index: number, value: number): void {\n // Look up the row sizer.\n let sizer = this._rowSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Get the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @returns The stretch factor for the column.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n columnStretch(index: number): number {\n let sizer = this._columnSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @param value - The stretch factor for the column.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setColumnStretch(index: number, value: number): void {\n // Look up the column sizer.\n let sizer = this._columnSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n for (const item of this._items) {\n yield item.widget;\n }\n }\n\n /**\n * Add a widget to the grid layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, this is no-op.\n */\n addWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is already in the layout.\n if (i !== -1) {\n return;\n }\n\n // Add the widget to the layout.\n this._items.push(new LayoutItem(widget));\n\n // Attach the widget to the parent.\n if (this.parent) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Remove a widget from the grid layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is not in the layout.\n if (i === -1) {\n return;\n }\n\n // Remove the widget from the layout.\n let item = ArrayExt.removeAt(this._items, i)!;\n\n // Detach the widget from the parent.\n if (this.parent) {\n this.detachWidget(widget);\n }\n\n // Dispose the layout item.\n item.dispose();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Reset the min sizes of the sizers.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n this._rowSizers[i].minSize = 0;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n this._columnSizers[i].minSize = 0;\n }\n\n // Filter for the visible layout items.\n let items = this._items.filter(it => !it.isHidden);\n\n // Fit the layout items.\n for (let i = 0, n = items.length; i < n; ++i) {\n items[i].fit();\n }\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Sort the items by row span.\n items.sort(Private.rowSpanCmp);\n\n // Update the min sizes of the row sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the row bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n // Distribute the minimum height to the sizers as needed.\n Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n }\n\n // Sort the items by column span.\n items.sort(Private.columnSpanCmp);\n\n // Update the min sizes of the column sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the column bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let c1 = Math.min(config.column, maxCol);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Distribute the minimum width to the sizers as needed.\n Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n }\n\n // If no size constraint is needed, just update the parent.\n if (this.fitPolicy === 'set-no-constraint') {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n return;\n }\n\n // Set up the computed min size.\n let minH = maxRow * this._rowSpacing;\n let minW = maxCol * this._columnSpacing;\n\n // Add the sizer minimums to the computed min size.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n minH += this._rowSizers[i].minSize;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n minW += this._columnSizers[i].minSize;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Compute the total fixed row and column space.\n let fixedRowSpace = maxRow * this._rowSpacing;\n let fixedColSpace = maxCol * this._columnSpacing;\n\n // Distribute the available space to the box sizers.\n BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n // Update the row start positions.\n for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n this._rowStarts[i] = pos;\n pos += this._rowSizers[i].size + this._rowSpacing;\n }\n\n // Update the column start positions.\n for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n this._columnStarts[i] = pos;\n pos += this._columnSizers[i].size + this._columnSpacing;\n }\n\n // Update the geometry of the layout items.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the cell bounds for the widget.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let c1 = Math.min(config.column, maxCol);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Compute the cell geometry.\n let x = this._columnStarts[c1];\n let y = this._rowStarts[r1];\n let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n // Update the geometry of the layout item.\n item.update(x, y, w, h);\n }\n }\n\n private _dirty = false;\n private _rowSpacing = 4;\n private _columnSpacing = 4;\n private _items: LayoutItem[] = [];\n private _rowStarts: number[] = [];\n private _columnStarts: number[] = [];\n private _rowSizers: BoxSizer[] = [new BoxSizer()];\n private _columnSizers: BoxSizer[] = [new BoxSizer()];\n private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n /**\n * An options object for initializing a grid layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The initial row count for the layout.\n *\n * The default is `1`.\n */\n rowCount?: number;\n\n /**\n * The initial column count for the layout.\n *\n * The default is `1`.\n */\n columnCount?: number;\n\n /**\n * The spacing between rows in the layout.\n *\n * The default is `4`.\n */\n rowSpacing?: number;\n\n /**\n * The spacing between columns in the layout.\n *\n * The default is `4`.\n */\n columnSpacing?: number;\n }\n\n /**\n * An object which holds the cell configuration for a widget.\n */\n export interface ICellConfig {\n /**\n * The row index for the widget.\n */\n readonly row: number;\n\n /**\n * The column index for the widget.\n */\n readonly column: number;\n\n /**\n * The row span for the widget.\n */\n readonly rowSpan: number;\n\n /**\n * The column span for the widget.\n */\n readonly columnSpan: number;\n }\n\n /**\n * Get the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The cell config for the widget.\n */\n export function getCellConfig(widget: Widget): ICellConfig {\n return Private.cellConfigProperty.get(widget);\n }\n\n /**\n * Set the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the cell config.\n */\n export function setCellConfig(\n widget: Widget,\n value: Partial\n ): void {\n Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for the widget cell config.\n */\n export const cellConfigProperty = new AttachedProperty<\n Widget,\n GridLayout.ICellConfig\n >({\n name: 'cellConfig',\n create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n changed: onChildCellConfigChanged\n });\n\n /**\n * Normalize a partial cell config object.\n */\n export function normalizeConfig(\n config: Partial\n ): GridLayout.ICellConfig {\n let row = Math.max(0, Math.floor(config.row || 0));\n let column = Math.max(0, Math.floor(config.column || 0));\n let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n return { row, column, rowSpan, columnSpan };\n }\n\n /**\n * Clamp a value to an integer >= 0.\n */\n export function clampValue(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * A sort comparison function for row spans.\n */\n export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.rowSpan - c2.rowSpan;\n }\n\n /**\n * A sort comparison function for column spans.\n */\n export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.columnSpan - c2.columnSpan;\n }\n\n /**\n * Reallocate the box sizers for the given grid dimensions.\n */\n export function reallocSizers(sizers: BoxSizer[], count: number): void {\n // Coerce the count to the valid range.\n count = Math.max(1, Math.floor(count));\n\n // Add the missing sizers.\n while (sizers.length < count) {\n sizers.push(new BoxSizer());\n }\n\n // Remove the extra sizers.\n if (sizers.length > count) {\n sizers.length = count;\n }\n }\n\n /**\n * Distribute a min size constraint across a range of sizers.\n */\n export function distributeMin(\n sizers: BoxSizer[],\n i1: number,\n i2: number,\n minSize: number\n ): void {\n // Sanity check the indices.\n if (i2 < i1) {\n return;\n }\n\n // Handle the simple case of no cell span.\n if (i1 === i2) {\n let sizer = sizers[i1];\n sizer.minSize = Math.max(sizer.minSize, minSize);\n return;\n }\n\n // Compute the total current min size of the span.\n let totalMin = 0;\n for (let i = i1; i <= i2; ++i) {\n totalMin += sizers[i].minSize;\n }\n\n // Do nothing if the total is greater than the required.\n if (totalMin >= minSize) {\n return;\n }\n\n // Compute the portion of the space to allocate to each sizer.\n let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n // Add the portion to each sizer.\n for (let i = i1; i <= i2; ++i) {\n sizers[i].minSize += portion;\n }\n }\n\n /**\n * The change handler for the child cell config property.\n */\n function onChildCellConfigChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof GridLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n */\nexport class MenuBar extends Widget {\n /**\n * Construct a new menu bar.\n *\n * @param options - The options for initializing the menu bar.\n */\n constructor(options: MenuBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-MenuBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.renderer = options.renderer || MenuBar.defaultRenderer;\n this._forceItemsPosition = options.forceItemsPosition || {\n forceX: true,\n forceY: true\n };\n this._overflowMenuOptions = options.overflowMenuOptions || {\n isVisible: true\n };\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._closeChildMenu();\n this._menus.length = 0;\n super.dispose();\n }\n\n /**\n * The renderer used by the menu bar.\n */\n readonly renderer: MenuBar.IRenderer;\n\n /**\n * The child menu of the menu bar.\n *\n * #### Notes\n * This will be `null` if the menu bar does not have an open menu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The overflow index of the menu bar.\n */\n get overflowIndex(): number {\n return this._overflowIndex;\n }\n\n /**\n * The overflow menu of the menu bar.\n */\n get overflowMenu(): Menu | null {\n return this._overflowMenu;\n }\n\n /**\n * Get the menu bar content node.\n *\n * #### Notes\n * This is the node which holds the menu title nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-MenuBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu.\n */\n get activeMenu(): Menu | null {\n return this._menus[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu.\n *\n * #### Notes\n * If the menu does not exist, the menu will be set to `null`.\n */\n set activeMenu(value: Menu | null) {\n this.activeIndex = value ? this._menus.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu.\n *\n * #### Notes\n * This will be `-1` if no menu is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu.\n *\n * #### Notes\n * If the menu cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._menus.length) {\n value = -1;\n }\n\n // An empty menu cannot be active\n if (value > -1 && this._menus[value].items.length === 0) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menus in the menu bar.\n */\n get menus(): ReadonlyArray {\n return this._menus;\n }\n\n /**\n * Open the active menu and activate its first menu item.\n *\n * #### Notes\n * If there is no active menu, this is a no-op.\n */\n openActiveMenu(): void {\n // Bail early if there is no active item.\n if (this._activeIndex === -1) {\n return;\n }\n\n // Open the child menu.\n this._openChildMenu();\n\n // Activate the first item in the child menu.\n if (this._childMenu) {\n this._childMenu.activeIndex = -1;\n this._childMenu.activateNextItem();\n }\n }\n\n /**\n * Add a menu to the end of the menu bar.\n *\n * @param menu - The menu to add to the menu bar.\n *\n * #### Notes\n * If the menu is already added to the menu bar, it will be moved.\n */\n addMenu(menu: Menu, update: boolean = true): void {\n this.insertMenu(this._menus.length, menu, update);\n }\n\n /**\n * Insert a menu into the menu bar at the specified index.\n *\n * @param index - The index at which to insert the menu.\n *\n * @param menu - The menu to insert into the menu bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the menus.\n *\n * If the menu is already added to the menu bar, it will be moved.\n */\n insertMenu(index: number, menu: Menu, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Look up the index of the menu.\n let i = this._menus.indexOf(menu);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._menus.length));\n\n // If the menu is not in the array, insert it.\n if (i === -1) {\n // Insert the menu into the array.\n ArrayExt.insert(this._menus, j, menu);\n\n // Add the styling class to the menu.\n menu.addClass('lm-MenuBar-menu');\n\n // Connect to the menu signals.\n menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n menu.menuRequested.connect(this._onMenuMenuRequested, this);\n menu.title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the menu exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._menus.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the menu to the new locations.\n ArrayExt.move(this._menus, i, j);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove a menu from the menu bar.\n *\n * @param menu - The menu to remove from the menu bar.\n *\n * #### Notes\n * This is a no-op if the menu is not in the menu bar.\n */\n removeMenu(menu: Menu, update: boolean = true): void {\n this.removeMenuAt(this._menus.indexOf(menu), update);\n }\n\n /**\n * Remove the menu at a given index from the menu bar.\n *\n * @param index - The index of the menu to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeMenuAt(index: number, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Remove the menu from the array.\n let menu = ArrayExt.removeAt(this._menus, index);\n\n // Bail if the index is out of range.\n if (!menu) {\n return;\n }\n\n // Disconnect from the menu signals.\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n\n // Remove the styling class from the menu.\n menu.removeClass('lm-MenuBar-menu');\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove all menus from the menu bar.\n */\n clearMenus(): void {\n // Bail if there is nothing to remove.\n if (this._menus.length === 0) {\n return;\n }\n\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Disconnect from the menu signals and remove the styling class.\n for (let menu of this._menus) {\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n menu.removeClass('lm-MenuBar-menu');\n }\n\n // Clear the menus array.\n this._menus.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Handle the DOM events for the menu bar.\n *\n * @param event - The DOM event sent to the menu bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu bar's DOM nodes. It\n * should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'focusout':\n this._evtFocusOut(event as FocusEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mousedown', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('focusout', this);\n this.node.addEventListener('contextmenu', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mousedown', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('focusout', this);\n this.node.removeEventListener('contextmenu', this);\n this._closeChildMenu();\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this._focusItemAt(0);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n this.update();\n super.onResize(msg);\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let menus = this._menus;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let tabFocusIndex =\n this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n ? this._tabFocusIndex\n : 0;\n let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n let totalMenuSize = 0;\n let isVisible = false;\n\n // Check that the overflow menu doesn't count\n length = this._overflowMenu !== null ? length - 1 : length;\n let content = new Array(length);\n\n // Render visible menus\n for (let i = 0; i < length; ++i) {\n content[i] = renderer.renderItem({\n title: menus[i].title,\n active: i === activeIndex,\n tabbable: i === tabFocusIndex,\n disabled: menus[i].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = i;\n this.activeIndex = i;\n }\n });\n // Calculate size of current menu\n totalMenuSize += this._menuItemSizes[i];\n // Check if overflow menu is already rendered\n if (menus[i].title.label === this._overflowMenuOptions.title) {\n isVisible = true;\n length--;\n }\n }\n // Render overflow menu if needed and active\n if (this._overflowMenuOptions.isVisible) {\n if (this._overflowIndex > -1 && !isVisible) {\n // Create overflow menu\n if (this._overflowMenu === null) {\n const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n this._overflowMenu.title.label = overflowMenuTitle;\n this._overflowMenu.title.mnemonic = 0;\n this.addMenu(this._overflowMenu, false);\n }\n // Move menus to overflow menu\n for (let i = menus.length - 2; i >= length; i--) {\n const submenu = this.menus[i];\n submenu.title.mnemonic = 0;\n this._overflowMenu.insertItem(0, {\n type: 'submenu',\n submenu: submenu\n });\n this.removeMenu(submenu, false);\n }\n content[length] = renderer.renderItem({\n title: this._overflowMenu.title,\n active: length === activeIndex && menus[length].items.length !== 0,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n } else if (this._overflowMenu !== null) {\n // Remove submenus from overflow menu\n let overflowMenuItems = this._overflowMenu.items;\n let screenSize = this.node.offsetWidth;\n let n = this._overflowMenu.items.length;\n for (let i = 0; i < n; ++i) {\n let index = menus.length - 1 - i;\n if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n let menu = overflowMenuItems[0].submenu as Menu;\n this._overflowMenu.removeItemAt(0);\n this.insertMenu(length, menu, false);\n content[length] = renderer.renderItem({\n title: menu.title,\n active: false,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n }\n }\n if (this._overflowMenu.items.length === 0) {\n this.removeMenu(this._overflowMenu, false);\n content.pop();\n this._overflowMenu = null;\n this._overflowIndex = -1;\n }\n }\n }\n VirtualDOM.render(content, this.contentNode);\n this._updateOverflowIndex();\n }\n\n /**\n * Calculate and update the current overflow index.\n */\n private _updateOverflowIndex(): void {\n if (!this._overflowMenuOptions.isVisible) {\n return;\n }\n\n // Get elements visible in the main menu bar\n const itemMenus = this.contentNode.childNodes;\n let screenSize = this.node.offsetWidth;\n let totalMenuSize = 0;\n let index = -1;\n let n = itemMenus.length;\n\n if (this._menuItemSizes.length == 0) {\n // Check if it is the first resize and get info about menu items sizes\n for (let i = 0; i < n; i++) {\n let item = itemMenus[i] as HTMLLIElement;\n // Add sizes to array\n totalMenuSize += item.offsetWidth;\n this._menuItemSizes.push(item.offsetWidth);\n if (totalMenuSize > screenSize && index === -1) {\n index = i;\n }\n }\n } else {\n // Calculate current menu size\n for (let i = 0; i < this._menuItemSizes.length; i++) {\n totalMenuSize += this._menuItemSizes[i];\n if (totalMenuSize > screenSize) {\n index = i;\n break;\n }\n }\n }\n this._overflowIndex = index;\n }\n\n /**\n * Handle the `'keydown'` event for the menu bar.\n *\n * #### Notes\n * All keys are trapped except the tab key that is ignored.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Reset the active index on tab, but do not trap the tab key.\n if (kc === 9) {\n this.activeIndex = -1;\n return;\n }\n\n // A menu bar handles all other keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Enter, Space, Up Arrow, Down Arrow\n if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n // The active index may have changed (for example, user hovers over an\n // item with the mouse), so be sure to use the focus index.\n this.activeIndex = this._tabFocusIndex;\n if (this.activeIndex !== this._tabFocusIndex) {\n // Bail if the setter refused to set activeIndex to tabFocusIndex\n // because it means that the item at tabFocusIndex cannot be opened (for\n // example, it has an empty menu)\n return;\n }\n this.openActiveMenu();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this._closeChildMenu();\n this._focusItemAt(this.activeIndex);\n return;\n }\n\n // Left or Right Arrow\n if (kc === 37 || kc === 39) {\n let direction = kc === 37 ? -1 : 1;\n let start = this._tabFocusIndex + direction;\n let n = this._menus.length;\n for (let i = 0; i < n; i++) {\n let index = (n + start + direction * i) % n;\n if (this._menus[index].items.length) {\n this._focusItemAt(index);\n return;\n }\n }\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._menus, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that menu is opened.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.openActiveMenu();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n this._focusItemAt(this.activeIndex);\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n this._focusItemAt(this.activeIndex);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the menu bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the mouse press was not on the menu bar. This can occur\n // when the document listener is installed for an active menu bar.\n if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n return;\n }\n\n // Stop the propagation of the event. Immediate propagation is\n // also stopped so that an open menu does not handle the event.\n event.stopPropagation();\n event.stopImmediatePropagation();\n\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // If the press was not on an item, close the child menu.\n if (index === -1) {\n this._closeChildMenu();\n return;\n }\n\n // If the press was not the left mouse button, do nothing further.\n if (event.button !== 0) {\n return;\n }\n\n // Otherwise, toggle the open state of the child menu.\n if (this._childMenu) {\n this._closeChildMenu();\n this.activeIndex = index;\n } else {\n // If we don't call preventDefault() here, then the item in the menu\n // bar will take focus over the menu that is being opened.\n event.preventDefault();\n const position = this._positionForMenu(index);\n Menu.saveWindowData();\n // Begin DOM modifications.\n this.activeIndex = index;\n this._openChildMenu(position);\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the menu bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the active index will not change.\n if (index === this._activeIndex) {\n return;\n }\n\n // Bail early if a child menu is open and the mouse is not over\n // an item. This allows the child menu to be kept open when the\n // mouse is over the empty part of the menu bar.\n if (index === -1 && this._childMenu) {\n return;\n }\n\n // Get position for the new menu >before< updating active index.\n const position =\n index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n // Before any modification, update window data.\n Menu.saveWindowData();\n\n // Begin DOM modifications.\n\n // Update the active index to the hovered item.\n this.activeIndex = index;\n\n // Open the new menu if a menu is already open.\n if (position) {\n this._openChildMenu(position);\n }\n }\n\n /**\n * Find initial position for the menu based on menubar item position.\n *\n * NOTE: this should be called before updating active index to avoid\n * an additional layout and style invalidation as changing active\n * index modifies DOM.\n */\n private _positionForMenu(index: number): Private.IPosition {\n let itemNode = this.contentNode.children[index];\n let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n return {\n top: bottom,\n left\n };\n }\n\n /**\n * Handle the `'focusout'` event for the menu bar.\n */\n private _evtFocusOut(event: FocusEvent): void {\n // Reset the active index if there is no open menu and the menubar is losing focus.\n if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n this.activeIndex = -1;\n }\n }\n\n /**\n * Focus an item in the menu bar.\n *\n * #### Notes\n * Does not open the associated menu.\n */\n private _focusItemAt(index: number): void {\n const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n if (itemNode) {\n itemNode.focus();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if there is no active menu.\n */\n private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n // If there is no active menu, close the current menu.\n let newMenu = this.activeMenu;\n if (!newMenu) {\n this._closeChildMenu();\n return;\n }\n\n // Bail if there is no effective menu change.\n let oldMenu = this._childMenu;\n if (oldMenu === newMenu) {\n return;\n }\n\n // Swap the internal menu reference.\n this._childMenu = newMenu;\n\n // Close the current menu, or setup for the new menu.\n if (oldMenu) {\n oldMenu.close();\n } else {\n document.addEventListener('mousedown', this, true);\n }\n\n // Update the tab focus index and ensure the menu bar is updated.\n this._tabFocusIndex = this.activeIndex;\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n // Get the positioning data for the new menu.\n let { left, top } = options;\n if (typeof left === 'undefined' || typeof top === 'undefined') {\n ({ left, top } = this._positionForMenu(this._activeIndex));\n }\n // Begin DOM modifications\n\n if (!oldMenu) {\n // Continue setup for new menu\n this.addClass('lm-mod-active');\n }\n\n // Open the new menu at the computed location.\n if (newMenu.items.length > 0) {\n newMenu.open(left, top, this._forceItemsPosition);\n }\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n // Bail if no child menu is open.\n if (!this._childMenu) {\n return;\n }\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n let menu = this._childMenu;\n this._childMenu = null;\n\n // Close the menu.\n menu.close();\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `aboutToClose` signal of a menu.\n */\n private _onMenuAboutToClose(sender: Menu): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n this._childMenu = null;\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `menuRequested` signal of a child menu.\n */\n private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Look up the active index and menu count.\n let i = this._activeIndex;\n let n = this._menus.length;\n\n // Active the next requested index.\n switch (args) {\n case 'next':\n this.activeIndex = i === n - 1 ? 0 : i + 1;\n break;\n case 'previous':\n this.activeIndex = i === 0 ? n - 1 : i - 1;\n break;\n }\n\n // Open the active menu.\n this.openActiveMenu();\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(): void {\n this.update();\n }\n\n // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n private _activeIndex = -1;\n // Track which item can be focused using the TAB key. Unlike _activeIndex will\n // always point to a menuitem. Whenever you update this value, it's important\n // to follow it with an \"update-request\" message so that the `tabindex`\n // attribute on each menubar item gets properly updated.\n private _tabFocusIndex = 0;\n private _forceItemsPosition: Menu.IOpenOptions;\n private _overflowMenuOptions: IOverflowMenuOptions;\n private _menus: Menu[] = [];\n private _childMenu: Menu | null = null;\n private _overflowMenu: Menu | null = null;\n private _menuItemSizes: number[] = [];\n private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n /**\n * An options object for creating a menu bar.\n */\n export interface IOptions {\n /**\n * A custom renderer for creating menu bar content.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n /**\n * Whether to force the position of the menu. The MenuBar forces the\n * coordinates of its menus by default. With this option you can disable it.\n *\n * Setting to `false` will enable the logic which repositions the\n * coordinates of the menu if it will not fit entirely on screen.\n *\n * The default is `true`.\n */\n forceItemsPosition?: Menu.IOpenOptions;\n /**\n * Whether to add a overflow menu if there's overflow.\n *\n * Setting to `true` will enable the logic that creates an overflow menu\n * to show the menu items that don't fit entirely on the screen.\n *\n * The default is `true`.\n */\n overflowMenuOptions?: IOverflowMenuOptions;\n }\n\n /**\n * An object which holds the data to render a menu bar item.\n */\n export interface IRenderData {\n /**\n * The title to be rendered.\n */\n readonly title: Title;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the user can tab to the item.\n */\n readonly tabbable: boolean;\n\n /**\n * Whether the item is disabled.\n *\n * #### Notes\n * A disabled item cannot be active.\n * A disabled item cannot be focussed.\n */\n readonly disabled?: boolean;\n\n readonly onfocus?: (event: FocusEvent) => void;\n }\n\n /**\n * A renderer for use with a menu bar.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n\n /**\n * Render the icon element for a menu bar item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.title.icon is undefined, it will be ignored.\n return h.div({ className }, data.title.icon!, data.title.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n }\n\n /**\n * Create the class name for the menu bar item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n let name = 'lm-MenuBar-item';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.active && !data.disabled) {\n name += ' lm-mod-active';\n }\n return name;\n }\n\n /**\n * Create the dataset for a menu bar item.\n *\n * @param data - The data to use for the item.\n *\n * @returns The dataset for the menu bar item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the aria attributes for menu bar item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n return {\n role: 'menuitem',\n 'aria-haspopup': 'true',\n 'aria-disabled': data.disabled ? 'true' : 'false'\n };\n }\n\n /**\n * Create the class name for the menu bar item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-MenuBar-itemIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.title;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n /**\n * Determines if a overflow menu appears when the menu items overflow.\n *\n * Defaults to `true`.\n */\n isVisible: boolean;\n /**\n * Determines the title of the overflow menu.\n *\n * Default: `...`.\n */\n title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a menu bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-MenuBar-content';\n node.appendChild(content);\n content.setAttribute('role', 'menubar');\n return node;\n }\n\n /**\n * Position for the menu relative to top-left screen corner.\n */\n export interface IPosition {\n /**\n * Pixels right from screen origin.\n */\n left: number;\n /**\n * Pixels down from screen origin.\n */\n top: number;\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n menus: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = menus.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Look up the menu title.\n let title = menus[k].title;\n\n // Ignore titles with an empty label.\n if (title.label.length === 0) {\n continue;\n }\n\n // Look up the mnemonic index for the label.\n let mn = title.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < title.label.length) {\n if (title.label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n /**\n * Construct a new scroll bar.\n *\n * @param options - The options for initializing the scroll bar.\n */\n constructor(options: ScrollBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-ScrollBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n\n // Set the orientation.\n this._orientation = options.orientation || 'vertical';\n this.dataset['orientation'] = this._orientation;\n\n // Parse the rest of the options.\n if (options.maximum !== undefined) {\n this._maximum = Math.max(0, options.maximum);\n }\n if (options.page !== undefined) {\n this._page = Math.max(0, options.page);\n }\n if (options.value !== undefined) {\n this._value = Math.max(0, Math.min(options.value, this._maximum));\n }\n }\n\n /**\n * A signal emitted when the user moves the scroll thumb.\n *\n * #### Notes\n * The payload is the current value of the scroll bar.\n */\n get thumbMoved(): ISignal {\n return this._thumbMoved;\n }\n\n /**\n * A signal emitted when the user clicks a step button.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get stepRequested(): ISignal {\n return this._stepRequested;\n }\n\n /**\n * A signal emitted when the user clicks the scroll track.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get pageRequested(): ISignal {\n return this._pageRequested;\n }\n\n /**\n * Get the orientation of the scroll bar.\n */\n get orientation(): ScrollBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the scroll bar.\n */\n set orientation(value: ScrollBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making changes.\n this._releaseMouse();\n\n // Update the internal orientation.\n this._orientation = value;\n this.dataset['orientation'] = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the current value of the scroll bar.\n */\n get value(): number {\n return this._value;\n }\n\n /**\n * Set the current value of the scroll bar.\n *\n * #### Notes\n * The value will be clamped to the range `[0, maximum]`.\n */\n set value(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Do nothing if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the page size of the scroll bar.\n *\n * #### Notes\n * The page size is the amount of visible content in the scrolled\n * region, expressed in data units. It determines the size of the\n * scroll bar thumb.\n */\n get page(): number {\n return this._page;\n }\n\n /**\n * Set the page size of the scroll bar.\n *\n * #### Notes\n * The page size will be clamped to the range `[0, Infinity]`.\n */\n set page(value: number) {\n // Clamp the page size to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._page === value) {\n return;\n }\n\n // Update the internal page size.\n this._page = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the maximum value of the scroll bar.\n */\n get maximum(): number {\n return this._maximum;\n }\n\n /**\n * Set the maximum value of the scroll bar.\n *\n * #### Notes\n * The max size will be clamped to the range `[0, Infinity]`.\n */\n set maximum(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._maximum === value) {\n return;\n }\n\n // Update the internal values.\n this._maximum = value;\n\n // Clamp the current value to the new range.\n this._value = Math.min(this._value, value);\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * The scroll bar decrement button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get decrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar increment button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get incrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[1] as HTMLDivElement;\n }\n\n /**\n * The scroll bar track node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get trackNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-track'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar thumb node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get thumbNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-thumb'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Handle the DOM events for the scroll bar.\n *\n * @param event - The DOM event sent to the scroll bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the scroll bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A method invoked on a 'before-attach' message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('mousedown', this);\n this.update();\n }\n\n /**\n * A method invoked on an 'after-detach' message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n }\n\n /**\n * A method invoked on an 'update-request' message.\n */\n protected onUpdateRequest(msg: Message): void {\n // Convert the value and page into percentages.\n let value = (this._value * 100) / this._maximum;\n let page = (this._page * 100) / (this._page + this._maximum);\n\n // Clamp the value and page to the relevant range.\n value = Math.max(0, Math.min(value, 100));\n page = Math.max(0, Math.min(page, 100));\n\n // Fetch the thumb style.\n let thumbStyle = this.thumbNode.style;\n\n // Update the thumb style for the current orientation.\n if (this._orientation === 'horizontal') {\n thumbStyle.top = '';\n thumbStyle.height = '';\n thumbStyle.left = `${value}%`;\n thumbStyle.width = `${page}%`;\n thumbStyle.transform = `translate(${-value}%, 0%)`;\n } else {\n thumbStyle.left = '';\n thumbStyle.width = '';\n thumbStyle.top = `${value}%`;\n thumbStyle.height = `${page}%`;\n thumbStyle.transform = `translate(0%, ${-value}%)`;\n }\n }\n\n /**\n * Handle the `'keydown'` event for the scroll bar.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Ignore anything except the `Escape` key.\n if (event.keyCode !== 27) {\n return;\n }\n\n // Fetch the previous scroll value.\n let value = this._pressData ? this._pressData.value : -1;\n\n // Release the mouse.\n this._releaseMouse();\n\n // Restore the old scroll value if possible.\n if (value !== -1) {\n this._moveThumb(value);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the scroll bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Do nothing if it's not a left mouse press.\n if (event.button !== 0) {\n return;\n }\n\n // Send an activate request to the scroll bar. This can be\n // used by message hooks to activate something relevant.\n this.activate();\n\n // Do nothing if the mouse is already captured.\n if (this._pressData) {\n return;\n }\n\n // Find the pressed scroll bar part.\n let part = Private.findPart(this, event.target as HTMLElement);\n\n // Do nothing if the part is not of interest.\n if (!part) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Override the mouse cursor.\n let override = Drag.overrideCursor('default');\n\n // Set up the press data.\n this._pressData = {\n part,\n override,\n delta: -1,\n value: -1,\n mouseX: event.clientX,\n mouseY: event.clientY\n };\n\n // Add the extra event listeners.\n document.addEventListener('mousemove', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Handle a thumb press.\n if (part === 'thumb') {\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Update the press data delta for the current orientation.\n if (this._orientation === 'horizontal') {\n this._pressData.delta = event.clientX - thumbRect.left;\n } else {\n this._pressData.delta = event.clientY - thumbRect.top;\n }\n\n // Add the active class to the thumb node.\n thumbNode.classList.add('lm-mod-active');\n\n // Store the current value in the press data.\n this._pressData.value = this._value;\n\n // Finished.\n return;\n }\n\n // Handle a track press.\n if (part === 'track') {\n // Fetch the client rect for the thumb.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n\n // Handle a decrement button press.\n if (part === 'decrement') {\n // Add the active class to the decrement node.\n this.decrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button press.\n if (part === 'increment') {\n // Add the active class to the increment node.\n this.incrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the scroll bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Do nothing if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Update the mouse position.\n this._pressData.mouseX = event.clientX;\n this._pressData.mouseY = event.clientY;\n\n // Bail if the thumb is not being dragged.\n if (this._pressData.part !== 'thumb') {\n return;\n }\n\n // Get the client rect for the thumb and track.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n let trackRect = this.trackNode.getBoundingClientRect();\n\n // Fetch the scroll geometry based on the orientation.\n let trackPos: number;\n let trackSpan: number;\n if (this._orientation === 'horizontal') {\n trackPos = event.clientX - trackRect.left - this._pressData.delta;\n trackSpan = trackRect.width - thumbRect.width;\n } else {\n trackPos = event.clientY - trackRect.top - this._pressData.delta;\n trackSpan = trackRect.height - thumbRect.height;\n }\n\n // Compute the desired value from the scroll geometry.\n let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n // Move the thumb to the computed value.\n this._moveThumb(value);\n }\n\n /**\n * Handle the `'mouseup'` event for the scroll bar.\n */\n private _evtMouseUp(event: MouseEvent): void {\n // Do nothing if it's not a left mouse release.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse and restore the node states.\n */\n private _releaseMouse(): void {\n // Bail if there is no press data.\n if (!this._pressData) {\n return;\n }\n\n // Clear the repeat timer.\n clearTimeout(this._repeatTimer);\n this._repeatTimer = -1;\n\n // Clear the press data.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra event listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n\n // Remove the active classes from the nodes.\n this.thumbNode.classList.remove('lm-mod-active');\n this.decrementNode.classList.remove('lm-mod-active');\n this.incrementNode.classList.remove('lm-mod-active');\n }\n\n /**\n * Move the thumb to the specified position.\n */\n private _moveThumb(value: number): void {\n // Clamp the value to the allowed range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Bail if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update of the scroll bar.\n this.update();\n\n // Emit the thumb moved signal.\n this._thumbMoved.emit(value);\n }\n\n /**\n * A timeout callback for repeating the mouse press.\n */\n private _onRepeat = () => {\n // Clear the repeat timer id.\n this._repeatTimer = -1;\n\n // Bail if the mouse has been released.\n if (!this._pressData) {\n return;\n }\n\n // Look up the part that was pressed.\n let part = this._pressData.part;\n\n // Bail if the thumb was pressed.\n if (part === 'thumb') {\n return;\n }\n\n // Schedule the timer for another repeat.\n this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n // Get the current mouse position.\n let mouseX = this._pressData.mouseX;\n let mouseY = this._pressData.mouseY;\n\n // Handle a decrement button repeat.\n if (part === 'decrement') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button repeat.\n if (part === 'increment') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n\n // Handle a track repeat.\n if (part === 'track') {\n // Bail if the mouse is not over the track.\n if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Bail if the mouse is over the thumb.\n if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n };\n\n private _value = 0;\n private _page = 10;\n private _maximum = 100;\n private _repeatTimer = -1;\n private _orientation: ScrollBar.Orientation;\n private _pressData: Private.IPressData | null = null;\n private _thumbMoved = new Signal(this);\n private _stepRequested = new Signal(this);\n private _pageRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n /**\n * A type alias for a scroll bar orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * An options object for creating a scroll bar.\n */\n export interface IOptions {\n /**\n * The orientation of the scroll bar.\n *\n * The default is `'vertical'`.\n */\n orientation?: Orientation;\n\n /**\n * The value for the scroll bar.\n *\n * The default is `0`.\n */\n value?: number;\n\n /**\n * The page size for the scroll bar.\n *\n * The default is `10`.\n */\n page?: number;\n\n /**\n * The maximum value for the scroll bar.\n *\n * The default is `100`.\n */\n maximum?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A type alias for the parts of a scroll bar.\n */\n export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The scroll bar part which was pressed.\n */\n part: ScrollBarPart;\n\n /**\n * The offset of the press in thumb coordinates, or -1.\n */\n delta: number;\n\n /**\n * The scroll value at the time the thumb was pressed, or -1.\n */\n value: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n\n /**\n * The current X position of the mouse.\n */\n mouseX: number;\n\n /**\n * The current Y position of the mouse.\n */\n mouseY: number;\n }\n\n /**\n * Create the DOM node for a scroll bar.\n */\n export function createNode(): HTMLElement {\n let node = document.createElement('div');\n let decrement = document.createElement('div');\n let increment = document.createElement('div');\n let track = document.createElement('div');\n let thumb = document.createElement('div');\n decrement.className = 'lm-ScrollBar-button';\n increment.className = 'lm-ScrollBar-button';\n decrement.dataset['action'] = 'decrement';\n increment.dataset['action'] = 'increment';\n track.className = 'lm-ScrollBar-track';\n thumb.className = 'lm-ScrollBar-thumb';\n track.appendChild(thumb);\n node.appendChild(decrement);\n node.appendChild(track);\n node.appendChild(increment);\n return node;\n }\n\n /**\n * Find the scroll bar part which contains the given target.\n */\n export function findPart(\n scrollBar: ScrollBar,\n target: HTMLElement\n ): ScrollBarPart | null {\n // Test the thumb.\n if (scrollBar.thumbNode.contains(target)) {\n return 'thumb';\n }\n\n // Test the track.\n if (scrollBar.trackNode.contains(target)) {\n return 'track';\n }\n\n // Test the decrement button.\n if (scrollBar.decrementNode.contains(target)) {\n return 'decrement';\n }\n\n // Test the increment button.\n if (scrollBar.incrementNode.contains(target)) {\n return 'increment';\n }\n\n // Indicate no match.\n return null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this._widget) {\n let widget = this._widget;\n this._widget = null;\n widget.dispose();\n }\n super.dispose();\n }\n\n /**\n * Get the child widget for the layout.\n */\n get widget(): Widget | null {\n return this._widget;\n }\n\n /**\n * Set the child widget for the layout.\n *\n * #### Notes\n * Setting the child widget will cause the old child widget to be\n * automatically disposed. If that is not desired, set the parent\n * of the old child to `null` before assigning a new child.\n */\n set widget(widget: Widget | null) {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n if (widget) {\n widget.parent = this.parent;\n }\n\n // Bail early if the widget does not change.\n if (this._widget === widget) {\n return;\n }\n\n // Dispose of the old child widget.\n if (this._widget) {\n this._widget.dispose();\n }\n\n // Update the internal widget.\n this._widget = widget;\n\n // Attach the new child widget if needed.\n if (this.parent && widget) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n if (this._widget) {\n yield this._widget;\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Bail early if the widget does not exist in the layout.\n if (this._widget !== widget) {\n return;\n }\n\n // Clear the internal widget.\n this._widget = null;\n\n // If the layout is parented, detach the widget from the DOM.\n if (this.parent) {\n this.detachWidget(widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n constructor(options: StackedLayout.IOptions = {}) {\n super(options);\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n if (this.widgets.length > 1) {\n this.widgets.forEach(w => {\n w.hiddenMode = this._hiddenMode;\n });\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n this._items.length > 0\n ) {\n if (this._items.length === 1) {\n this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n }\n widget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n widget.hiddenMode = Widget.HiddenMode.Display;\n }\n\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Reset the z-index for the widget.\n item!.widget.node.style.zIndex = '';\n\n // Reset the hidden mode for the widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n widget.hiddenMode = Widget.HiddenMode.Display;\n\n // Reset the hidden mode for the first widget if necessary.\n if (this._items.length === 1) {\n this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n }\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the computed minimum size.\n minW = Math.max(minW, item.minWidth);\n minH = Math.max(minH, item.minHeight);\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the widget stacking order and layout geometry.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Set the z-index for the widget.\n item.widget.node.style.zIndex = `${i}`;\n\n // Update the item geometry.\n item.update(left, top, width, height);\n }\n }\n\n private _dirty = false;\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n /**\n * An options object for initializing a stacked layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n /**\n * Construct a new stacked panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: StackedPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-StackedPanel');\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as StackedLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as StackedLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when a widget is removed from a stacked panel.\n */\n get widgetRemoved(): ISignal {\n return this._widgetRemoved;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-StackedPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-StackedPanel-child');\n this._widgetRemoved.emit(msg.child);\n }\n\n private _widgetRemoved = new Signal(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n /**\n * An options object for creating a stacked panel.\n */\n export interface IOptions {\n /**\n * The stacked layout to use for the stacked panel.\n *\n * The default is a new `StackedLayout`.\n */\n layout?: StackedLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a stacked layout for the given panel options.\n */\n export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n return options.layout || new StackedLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n constructor(options: TabPanel.IOptions = {}) {\n super();\n this.addClass('lm-TabPanel');\n\n // Create the tab bar and stacked panel.\n this.tabBar = new TabBar(options);\n this.tabBar.addClass('lm-TabPanel-tabBar');\n this.stackedPanel = new StackedPanel();\n this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n // Connect the tab bar signal handlers.\n this.tabBar.tabMoved.connect(this._onTabMoved, this);\n this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n this.tabBar.tabActivateRequested.connect(\n this._onTabActivateRequested,\n this\n );\n this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Connect the stacked panel signal handlers.\n this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n // Get the data related to the placement.\n this._tabPlacement = options.tabPlacement || 'top';\n let direction = Private.directionFromPlacement(this._tabPlacement);\n let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = this._tabPlacement;\n\n // Create the box layout.\n let layout = new BoxLayout({ direction, spacing: 0 });\n\n // Set the stretch factors for the child widgets.\n BoxLayout.setStretch(this.tabBar, 0);\n BoxLayout.setStretch(this.stackedPanel, 1);\n\n // Add the child widgets to the layout.\n layout.addWidget(this.tabBar);\n layout.addWidget(this.stackedPanel);\n\n // Install the layout on the tab panel.\n this.layout = layout;\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal {\n return this._currentChanged;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this.tabBar.currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `-1`.\n */\n set currentIndex(value: number) {\n this.tabBar.currentIndex = value;\n }\n\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get currentWidget(): Widget | null {\n let title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n }\n\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set currentWidget(value: Widget | null) {\n this.tabBar.currentTitle = value ? value.title : null;\n }\n\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get tabsMovable(): boolean {\n return this.tabBar.tabsMovable;\n }\n\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set tabsMovable(value: boolean) {\n this.tabBar.tabsMovable = value;\n }\n\n /**\n * Get the whether the add button is enabled.\n *\n */\n get addButtonEnabled(): boolean {\n return this.tabBar.addButtonEnabled;\n }\n\n /**\n * Set the whether the add button is enabled.\n *\n */\n set addButtonEnabled(value: boolean) {\n this.tabBar.addButtonEnabled = value;\n }\n\n /**\n * Get the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n get tabPlacement(): TabPanel.TabPlacement {\n return this._tabPlacement;\n }\n\n /**\n * Set the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n set tabPlacement(value: TabPanel.TabPlacement) {\n // Bail if the placement does not change.\n if (this._tabPlacement === value) {\n return;\n }\n\n // Update the internal value.\n this._tabPlacement = value;\n\n // Get the values related to the placement.\n let direction = Private.directionFromPlacement(value);\n let orientation = Private.orientationFromPlacement(value);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = value;\n\n // Update the layout direction.\n (this.layout as BoxLayout).direction = direction;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The tab bar used by the tab panel.\n *\n * #### Notes\n * Modifying the tab bar directly can lead to undefined behavior.\n */\n readonly tabBar: TabBar;\n\n /**\n * The stacked panel used by the tab panel.\n *\n * #### Notes\n * Modifying the panel directly can lead to undefined behavior.\n */\n readonly stackedPanel: StackedPanel;\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return this.stackedPanel.widgets;\n }\n\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this.widgets.length, widget);\n }\n\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n insertWidget(index: number, widget: Widget): void {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.stackedPanel.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n\n widget.node.setAttribute('role', 'tabpanel');\n\n let renderer = this.tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n // Extract the widgets from the titles.\n let previousWidget = previousTitle ? previousTitle.owner : null;\n let currentWidget = currentTitle ? currentTitle.owner : null;\n\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex,\n previousWidget,\n currentIndex,\n currentWidget\n });\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n }\n\n /**\n * Handle the `tabAddRequested` signal from the tab bar.\n */\n private _onTabAddRequested(sender: TabBar, args: void): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n private _onTabMoved(\n sender: TabBar,\n args: TabBar.ITabMovedArgs\n ): void {\n this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n }\n\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n this.tabBar.removeTab(widget.title);\n }\n\n private _tabPlacement: TabPanel.TabPlacement;\n private _currentChanged = new Signal(\n this\n );\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n /**\n * A type alias for tab placement in a tab bar.\n */\n export type TabPlacement =\n | /**\n * The tabs are placed as a row above the content.\n */\n 'top'\n\n /**\n * The tabs are placed as a column to the left of the content.\n */\n | 'left'\n\n /**\n * The tabs are placed as a column to the right of the content.\n */\n | 'right'\n\n /**\n * The tabs are placed as a row below the content.\n */\n | 'bottom';\n\n /**\n * An options object for initializing a tab panel.\n */\n export interface IOptions {\n /**\n * The document to use with the tab panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether the button to add new tabs is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The placement of the tab bar relative to the content.\n *\n * The default is `'top'`.\n */\n tabPlacement?: TabPlacement;\n\n /**\n * The renderer for the panel's tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: TabBar.IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n previousIndex: number;\n\n /**\n * The previously selected widget.\n */\n previousWidget: Widget | null;\n\n /**\n * The currently selected index.\n */\n currentIndex: number;\n\n /**\n * The currently selected widget.\n */\n currentWidget: Widget | null;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Convert a tab placement to tab bar orientation.\n */\n export function orientationFromPlacement(\n plc: TabPanel.TabPlacement\n ): TabBar.Orientation {\n return placementToOrientationMap[plc];\n }\n\n /**\n * Convert a tab placement to a box layout direction.\n */\n export function directionFromPlacement(\n plc: TabPanel.TabPlacement\n ): BoxLayout.Direction {\n return placementToDirectionMap[plc];\n }\n\n /**\n * A mapping of tab placement to tab bar orientation.\n */\n const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n top: 'horizontal',\n left: 'vertical',\n right: 'vertical',\n bottom: 'horizontal'\n };\n\n /**\n * A mapping of tab placement to box layout direction.\n */\n const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n top: 'top-to-bottom',\n left: 'left-to-right',\n right: 'right-to-left',\n bottom: 'bottom-to-top'\n };\n}\n"],"names":["BoxEngine","Signal","Private","MessageLoop","AttachedProperty","Message","ConflatableMessage","ElementExt","ArrayExt","Utils","UUID","Drag","VirtualDOM","h","StringExt","CommandRegistry","JSONExt","getKeyboardLayout","DisposableDelegate","Selector","empty","find","Platform","MimeData","max"],"mappings":";;;;;;IAAA;IACA;IACA;;;;;;IAM+E;IAE/E;;;;;;;;;IASG;UACU,QAAQ,CAAA;IAArB,IAAA,WAAA,GAAA;IACE;;;;;;;;;;;;IAYG;YACH,IAAQ,CAAA,QAAA,GAAG,CAAC,CAAC;IAEb;;;;;;;;;;;;IAYG;YACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;IAEZ;;;;;;;;;;;;IAYG;YACH,IAAO,CAAA,OAAA,GAAG,QAAQ,CAAC;IAEnB;;;;;;;;;;;;;;;IAeG;YACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;IAEZ;;;;;;;;;;;IAWG;YACH,IAAI,CAAA,IAAA,GAAG,CAAC,CAAC;IAET;;;;;;;IAOG;YACH,IAAI,CAAA,IAAA,GAAG,KAAK,CAAC;SACd;IAAA,CAAA;IAED;;IAEG;AACcA,+BA0XhB;IA1XD,CAAA,UAAiB,SAAS,EAAA;IACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6DG;IACH,IAAA,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AAG,EAAE,eAAe;IACpB,QAAA,IAAI,EAAE,eAAe;IACrB,QAAA,KAAK,EAAE,eAAe;IACtB,QAAA,MAAM,EAAE,eAAe;SACxB,CAAC;IACJ,CAAC,EAtCS,OAAO,KAAP,OAAO,GAsChB,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} +\ No newline at end of file ++{"version":3,"file":"index.js","sources":["../src/boxengine.ts","../src/title.ts","../src/widget.ts","../src/layout.ts","../src/panellayout.ts","../src/utils.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/focustracker.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/stackedpanel.ts","../src/tabpanel.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n /**\n * The preferred size for the sizer.\n *\n * #### Notes\n * The sizer will be given this initial size subject to its size\n * bounds. The sizer will not deviate from this size unless such\n * deviation is required to fit into the available layout space.\n *\n * There is no limit to this value, but it will be clamped to the\n * bounds defined by {@link minSize} and {@link maxSize}.\n *\n * The default value is `0`.\n */\n sizeHint = 0;\n\n /**\n * The minimum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized less than this value, even if\n * it means the sizer will overflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity)`\n * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `0`.\n */\n minSize = 0;\n\n /**\n * The maximum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized greater than this value, even if\n * it means the sizer will underflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity]`\n * and that it is `>=` to {@link minSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `Infinity`.\n */\n maxSize = Infinity;\n\n /**\n * The stretch factor for the sizer.\n *\n * #### Notes\n * This controls how much the sizer stretches relative to its sibling\n * sizers when layout space is distributed. A stretch factor of zero\n * is special and will cause the sizer to only be resized after all\n * other sizers with a stretch factor greater than zero have been\n * resized to their limits.\n *\n * It is assumed that this value is an integer that lies in the range\n * `[0, Infinity)`. Failure to adhere to this constraint will yield\n * undefined results.\n *\n * The default value is `1`.\n */\n stretch = 1;\n\n /**\n * The computed size of the sizer.\n *\n * #### Notes\n * This value is the output of a call to {@link BoxEngine.calc}. It represents\n * the computed size for the object along the layout orientation,\n * and will always lie in the range `[minSize, maxSize]`.\n *\n * This value is output only.\n *\n * Changing this value will have no effect.\n */\n size = 0;\n\n /**\n * An internal storage property for the layout algorithm.\n *\n * #### Notes\n * This value is used as temporary storage by the layout algorithm.\n *\n * Changing this value will have no effect.\n */\n done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n /**\n * Calculate the optimal layout sizes for a sequence of box sizers.\n *\n * This distributes the available layout space among the box sizers\n * according to the following algorithm:\n *\n * 1. Initialize the sizers's size to its size hint and compute the\n * sums for each of size hint, min size, and max size.\n *\n * 2. If the total size hint equals the available space, return.\n *\n * 3. If the available space is less than the total min size, set all\n * sizers to their min size and return.\n *\n * 4. If the available space is greater than the total max size, set\n * all sizers to their max size and return.\n *\n * 5. If the layout space is less than the total size hint, distribute\n * the negative delta as follows:\n *\n * a. Shrink each sizer with a stretch factor greater than zero by\n * an amount proportional to the negative space and the sum of\n * stretch factors. If the sizer reaches its min size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains negative\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its min size,\n * remove it from the computation.\n *\n * 6. If the layout space is greater than the total size hint,\n * distribute the positive delta as follows:\n *\n * a. Expand each sizer with a stretch factor greater than zero by\n * an amount proportional to the postive space and the sum of\n * stretch factors. If the sizer reaches its max size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains positive\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its max size,\n * remove it from the computation.\n *\n * 7. return\n *\n * @param sizers - The sizers for a particular layout line.\n *\n * @param space - The available layout space for the sizers.\n *\n * @returns The delta between the provided available space and the\n * actual consumed space. This value will be zero if the sizers\n * can be adjusted to fit, negative if the available space is too\n * small, and positive if the available space is too large.\n *\n * #### Notes\n * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n *\n * This function can be called at any time to recompute the layout for\n * an existing sequence of sizers. The previously computed results will\n * have no effect on the new output. It is therefore not necessary to\n * create new sizer objects on each resize event.\n */\n export function calc(sizers: ArrayLike, space: number): number {\n // Bail early if there is nothing to do.\n let count = sizers.length;\n if (count === 0) {\n return space;\n }\n\n // Setup the size and stretch counters.\n let totalMin = 0;\n let totalMax = 0;\n let totalSize = 0;\n let totalStretch = 0;\n let stretchCount = 0;\n\n // Setup the sizers and compute the totals.\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n let min = sizer.minSize;\n let max = sizer.maxSize;\n let hint = sizer.sizeHint;\n sizer.done = false;\n sizer.size = Math.max(min, Math.min(hint, max));\n totalSize += sizer.size;\n totalMin += min;\n totalMax += max;\n if (sizer.stretch > 0) {\n totalStretch += sizer.stretch;\n stretchCount++;\n }\n }\n\n // If the space is equal to the total size, return early.\n if (space === totalSize) {\n return 0;\n }\n\n // If the space is less than the total min, minimize each sizer.\n if (space <= totalMin) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.minSize;\n }\n return space - totalMin;\n }\n\n // If the space is greater than the total max, maximize each sizer.\n if (space >= totalMax) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.maxSize;\n }\n return space - totalMax;\n }\n\n // The loops below perform sub-pixel precision sizing. A near zero\n // value is used for compares instead of zero to ensure that the\n // loop terminates when the subdivided space is reasonably small.\n let nearZero = 0.01;\n\n // A counter which is decremented each time a sizer is resized to\n // its limit. This ensures the loops terminate even if there is\n // space remaining to distribute.\n let notDoneCount = count;\n\n // Distribute negative delta space.\n if (space < totalSize) {\n // Shrink each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its min size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = totalSize - space;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n }\n // Distribute positive delta space.\n else {\n // Expand each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its max size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = space - totalSize;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n }\n\n // Indicate that the consumed space equals the available space.\n return 0;\n }\n\n /**\n * Adjust a sizer by a delta and update its neighbors accordingly.\n *\n * @param sizers - The sizers which should be adjusted.\n *\n * @param index - The index of the sizer to grow.\n *\n * @param delta - The amount to adjust the sizer, positive or negative.\n *\n * #### Notes\n * This will adjust the indicated sizer by the specified amount, along\n * with the sizes of the appropriate neighbors, subject to the limits\n * specified by each of the sizers.\n *\n * This is useful when implementing box layouts where the boundaries\n * between the sizers are interactively adjustable by the user.\n */\n export function adjust(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Bail early when there is nothing to do.\n if (sizers.length === 0 || delta === 0) {\n return;\n }\n\n // Dispatch to the proper implementation.\n if (delta > 0) {\n growSizer(sizers, index, delta);\n } else {\n shrinkSizer(sizers, index, -delta);\n }\n }\n\n /**\n * Grow a sizer by a positive delta and adjust neighbors.\n */\n function growSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the left can expand.\n let growLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the right can shrink.\n let shrinkLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the left by the delta.\n let grow = delta;\n for (let i = index; i >= 0 && grow > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the right by the delta.\n let shrink = delta;\n for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n\n /**\n * Shrink a sizer by a positive delta and adjust neighbors.\n */\n function shrinkSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the right can expand.\n let growLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the left can shrink.\n let shrinkLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the right by the delta.\n let grow = delta;\n for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the left by the delta.\n let shrink = delta;\n for (let i = index; i >= 0 && shrink > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title implements IDisposable {\n /**\n * Construct a new title.\n *\n * @param options - The options for initializing the title.\n */\n constructor(options: Title.IOptions) {\n this.owner = options.owner;\n if (options.label !== undefined) {\n this._label = options.label;\n }\n if (options.mnemonic !== undefined) {\n this._mnemonic = options.mnemonic;\n }\n if (options.icon !== undefined) {\n this._icon = options.icon;\n }\n\n if (options.iconClass !== undefined) {\n this._iconClass = options.iconClass;\n }\n if (options.iconLabel !== undefined) {\n this._iconLabel = options.iconLabel;\n }\n if (options.caption !== undefined) {\n this._caption = options.caption;\n }\n if (options.className !== undefined) {\n this._className = options.className;\n }\n if (options.closable !== undefined) {\n this._closable = options.closable;\n }\n this._dataset = options.dataset || {};\n }\n\n /**\n * A signal emitted when the state of the title changes.\n */\n get changed(): ISignal {\n return this._changed;\n }\n\n /**\n * The object which owns the title.\n */\n readonly owner: T;\n\n /**\n * Get the label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get label(): string {\n return this._label;\n }\n\n /**\n * Set the label for the title.\n */\n set label(value: string) {\n if (this._label === value) {\n return;\n }\n this._label = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the mnemonic index for the title.\n *\n * #### Notes\n * The default value is `-1`.\n */\n get mnemonic(): number {\n return this._mnemonic;\n }\n\n /**\n * Set the mnemonic index for the title.\n */\n set mnemonic(value: number) {\n if (this._mnemonic === value) {\n return;\n }\n this._mnemonic = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon renderer for the title.\n *\n * #### Notes\n * The default value is undefined.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._icon;\n }\n\n /**\n * Set the icon renderer for the title.\n *\n * #### Notes\n * A renderer is an object that supplies a render and unrender function.\n */\n set icon(value: VirtualElement.IRenderer | undefined) {\n if (this._icon === value) {\n return;\n }\n this._icon = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconClass(): string {\n return this._iconClass;\n }\n\n /**\n * Set the icon class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconClass(value: string) {\n if (this._iconClass === value) {\n return;\n }\n this._iconClass = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconLabel(): string {\n return this._iconLabel;\n }\n\n /**\n * Set the icon label for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconLabel(value: string) {\n if (this._iconLabel === value) {\n return;\n }\n this._iconLabel = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the caption for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get caption(): string {\n return this._caption;\n }\n\n /**\n * Set the caption for the title.\n */\n set caption(value: string) {\n if (this._caption === value) {\n return;\n }\n this._caption = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the extra class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get className(): string {\n return this._className;\n }\n\n /**\n * Set the extra class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set className(value: string) {\n if (this._className === value) {\n return;\n }\n this._className = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the closable state for the title.\n *\n * #### Notes\n * The default value is `false`.\n */\n get closable(): boolean {\n return this._closable;\n }\n\n /**\n * Set the closable state for the title.\n *\n * #### Notes\n * This controls the presence of a close icon when applicable.\n */\n set closable(value: boolean) {\n if (this._closable === value) {\n return;\n }\n this._closable = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the dataset for the title.\n *\n * #### Notes\n * The default value is an empty dataset.\n */\n get dataset(): Title.Dataset {\n return this._dataset;\n }\n\n /**\n * Set the dataset for the title.\n *\n * #### Notes\n * This controls the data attributes when applicable.\n */\n set dataset(value: Title.Dataset) {\n if (this._dataset === value) {\n return;\n }\n this._dataset = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Test whether the title has been disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the title.\n *\n * #### Notes\n * It is the responsibility of the owner to call the title disposal.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n\n Signal.clearData(this);\n }\n\n private _label = '';\n private _caption = '';\n private _mnemonic = -1;\n private _icon: VirtualElement.IRenderer | undefined = undefined;\n private _iconClass = '';\n private _iconLabel = '';\n private _className = '';\n private _closable = false;\n private _dataset: Title.Dataset;\n private _changed = new Signal(this);\n private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n /**\n * A type alias for a simple immutable string dataset.\n */\n export type Dataset = { readonly [key: string]: string };\n\n /**\n * An options object for initializing a title.\n */\n export interface IOptions {\n /**\n * The object which owns the title.\n */\n owner: T;\n\n /**\n * The label for the title.\n */\n label?: string;\n\n /**\n * The mnemonic index for the title.\n */\n mnemonic?: number;\n\n /**\n * The icon renderer for the title.\n */\n icon?: VirtualElement.IRenderer;\n\n /**\n * The icon class name for the title.\n */\n iconClass?: string;\n\n /**\n * The icon label for the title.\n */\n iconLabel?: string;\n\n /**\n * The caption for the title.\n */\n caption?: string;\n\n /**\n * The extra class name for the title.\n */\n className?: string;\n\n /**\n * The closable state for the title.\n */\n closable?: boolean;\n\n /**\n * The dataset for the title.\n */\n dataset?: Dataset;\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n ConflatableMessage,\n IMessageHandler,\n Message,\n MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n /**\n * Construct a new widget.\n *\n * @param options - The options for initializing the widget.\n */\n constructor(options: Widget.IOptions = {}) {\n this.node = Private.createNode(options);\n this.addClass('lm-Widget');\n }\n\n /**\n * Dispose of the widget and its descendant widgets.\n *\n * #### Notes\n * It is unsafe to use the widget after it has been disposed.\n *\n * All calls made to this method after the first are a no-op.\n */\n dispose(): void {\n // Do nothing if the widget is already disposed.\n if (this.isDisposed) {\n return;\n }\n\n // Set the disposed flag and emit the disposed signal.\n this.setFlag(Widget.Flag.IsDisposed);\n this._disposed.emit(undefined);\n\n // Remove or detach the widget if necessary.\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n\n // Dispose of the widget layout.\n if (this._layout) {\n this._layout.dispose();\n this._layout = null;\n }\n\n // Dispose the title\n this.title.dispose();\n\n // Clear the extra data associated with the widget.\n Signal.clearData(this);\n MessageLoop.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * A signal emitted when the widget is disposed.\n */\n get disposed(): ISignal {\n return this._disposed;\n }\n\n /**\n * Get the DOM node owned by the widget.\n */\n readonly node: HTMLElement;\n\n /**\n * Test whether the widget has been disposed.\n */\n get isDisposed(): boolean {\n return this.testFlag(Widget.Flag.IsDisposed);\n }\n\n /**\n * Test whether the widget's node is attached to the DOM.\n */\n get isAttached(): boolean {\n return this.testFlag(Widget.Flag.IsAttached);\n }\n\n /**\n * Test whether the widget is explicitly hidden.\n */\n get isHidden(): boolean {\n return this.testFlag(Widget.Flag.IsHidden);\n }\n\n /**\n * Test whether the widget is visible.\n *\n * #### Notes\n * A widget is visible when it is attached to the DOM, is not\n * explicitly hidden, and has no explicitly hidden ancestors.\n */\n get isVisible(): boolean {\n return this.testFlag(Widget.Flag.IsVisible);\n }\n\n /**\n * The title object for the widget.\n *\n * #### Notes\n * The title object is used by some container widgets when displaying\n * the widget alongside some title, such as a tab panel or side bar.\n *\n * Since not all widgets will use the title, it is created on demand.\n *\n * The `owner` property of the title is set to this widget.\n */\n get title(): Title {\n return Private.titleProperty.get(this);\n }\n\n /**\n * Get the id of the widget's DOM node.\n */\n get id(): string {\n return this.node.id;\n }\n\n /**\n * Set the id of the widget's DOM node.\n */\n set id(value: string) {\n this.node.id = value;\n }\n\n /**\n * The dataset for the widget's DOM node.\n */\n get dataset(): DOMStringMap {\n return this.node.dataset;\n }\n\n /**\n * Get the method for hiding the widget.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding the widget.\n */\n set hiddenMode(value: Widget.HiddenMode) {\n if (this._hiddenMode === value) {\n return;\n }\n\n if (this.isHidden) {\n // Reset styles set by previous mode.\n this._toggleHidden(false);\n }\n\n if (value == Widget.HiddenMode.Scale) {\n this.node.style.willChange = 'transform';\n } else {\n this.node.style.willChange = 'auto';\n }\n\n this._hiddenMode = value;\n\n if (this.isHidden) {\n // Set styles for new mode.\n this._toggleHidden(true);\n }\n }\n\n /**\n * Get the parent of the widget.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent of the widget.\n *\n * #### Notes\n * Children are typically added to a widget by using a layout, which\n * means user code will not normally set the parent widget directly.\n *\n * The widget will be automatically removed from its old parent.\n *\n * This is a no-op if there is no effective parent change.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (value && this.contains(value)) {\n throw new Error('Invalid parent widget.');\n }\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-removed', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n this._parent = value;\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-added', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n if (!this.isDisposed) {\n MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n }\n }\n\n /**\n * Get the layout for the widget.\n */\n get layout(): Layout | null {\n return this._layout;\n }\n\n /**\n * Set the layout for the widget.\n *\n * #### Notes\n * The layout is single-use only. It cannot be changed after the\n * first assignment.\n *\n * The layout is disposed automatically when the widget is disposed.\n */\n set layout(value: Layout | null) {\n if (this._layout === value) {\n return;\n }\n if (this.testFlag(Widget.Flag.DisallowLayout)) {\n throw new Error('Cannot set widget layout.');\n }\n if (this._layout) {\n throw new Error('Cannot change widget layout.');\n }\n if (value!.parent) {\n throw new Error('Cannot change layout parent.');\n }\n this._layout = value;\n value!.parent = this;\n }\n\n /**\n * Create an iterator over the widget's children.\n *\n * @returns A new iterator over the children of the widget.\n *\n * #### Notes\n * The widget must have a populated layout in order to have children.\n *\n * If a layout is not installed, the returned iterator will be empty.\n */\n *children(): IterableIterator {\n if (this._layout) {\n yield* this._layout;\n }\n }\n\n /**\n * Test whether a widget is a descendant of this widget.\n *\n * @param widget - The descendant widget of interest.\n *\n * @returns `true` if the widget is a descendant, `false` otherwise.\n */\n contains(widget: Widget): boolean {\n for (let value: Widget | null = widget; value; value = value._parent) {\n if (value === this) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Test whether the widget's DOM node has the given class name.\n *\n * @param name - The class name of interest.\n *\n * @returns `true` if the node has the class, `false` otherwise.\n */\n hasClass(name: string): boolean {\n return this.node.classList.contains(name);\n }\n\n /**\n * Add a class name to the widget's DOM node.\n *\n * @param name - The class name to add to the node.\n *\n * #### Notes\n * If the class name is already added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n addClass(name: string): void {\n this.node.classList.add(name);\n }\n\n /**\n * Remove a class name from the widget's DOM node.\n *\n * @param name - The class name to remove from the node.\n *\n * #### Notes\n * If the class name is not yet added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n removeClass(name: string): void {\n this.node.classList.remove(name);\n }\n\n /**\n * Toggle a class name on the widget's DOM node.\n *\n * @param name - The class name to toggle on the node.\n *\n * @param force - Whether to force add the class (`true`) or force\n * remove the class (`false`). If not provided, the presence of\n * the class will be toggled from its current state.\n *\n * @returns `true` if the class is now present, `false` otherwise.\n *\n * #### Notes\n * The class name must not contain whitespace.\n */\n toggleClass(name: string, force?: boolean): boolean {\n if (force === true) {\n this.node.classList.add(name);\n return true;\n }\n if (force === false) {\n this.node.classList.remove(name);\n return false;\n }\n return this.node.classList.toggle(name);\n }\n\n /**\n * Post an `'update-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n update(): void {\n MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n }\n\n /**\n * Post a `'fit-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n fit(): void {\n MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n }\n\n /**\n * Post an `'activate-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n activate(): void {\n MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n }\n\n /**\n * Send a `'close-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for sending the message.\n */\n close(): void {\n MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n }\n\n /**\n * Show the widget and make it visible to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `false`.\n *\n * If the widget is not explicitly hidden, this is a no-op.\n */\n show(): void {\n if (!this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n }\n this.clearFlag(Widget.Flag.IsHidden);\n this._toggleHidden(false);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-shown', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Hide the widget and make it hidden to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `true`.\n *\n * If the widget is explicitly hidden, this is a no-op.\n */\n hide(): void {\n if (this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n }\n this.setFlag(Widget.Flag.IsHidden);\n this._toggleHidden(true);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-hidden', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Show or hide the widget according to a boolean value.\n *\n * @param hidden - `true` to hide the widget, or `false` to show it.\n *\n * #### Notes\n * This is a convenience method for `hide()` and `show()`.\n */\n setHidden(hidden: boolean): void {\n if (hidden) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Test whether the given widget flag is set.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n testFlag(flag: Widget.Flag): boolean {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * Set the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n setFlag(flag: Widget.Flag): void {\n this._flags |= flag;\n }\n\n /**\n * Clear the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n clearFlag(flag: Widget.Flag): void {\n this._flags &= ~flag;\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n *\n * #### Notes\n * Subclasses may reimplement this method as needed.\n */\n processMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.notifyLayout(msg);\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.notifyLayout(msg);\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.notifyLayout(msg);\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.notifyLayout(msg);\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.setFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.notifyLayout(msg);\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.clearFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.notifyLayout(msg);\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n this.setFlag(Widget.Flag.IsVisible);\n }\n this.setFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.notifyLayout(msg);\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.clearFlag(Widget.Flag.IsVisible);\n this.clearFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterDetach(msg);\n break;\n case 'activate-request':\n this.notifyLayout(msg);\n this.onActivateRequest(msg);\n break;\n case 'close-request':\n this.notifyLayout(msg);\n this.onCloseRequest(msg);\n break;\n case 'child-added':\n this.notifyLayout(msg);\n this.onChildAdded(msg as Widget.ChildMessage);\n break;\n case 'child-removed':\n this.notifyLayout(msg);\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n default:\n this.notifyLayout(msg);\n break;\n }\n }\n\n /**\n * Invoke the message processing routine of the widget's layout.\n *\n * @param msg - The message to dispatch to the layout.\n *\n * #### Notes\n * This is a no-op if the widget does not have a layout.\n *\n * This will not typically be called directly by user code.\n */\n protected notifyLayout(msg: Message): void {\n if (this._layout) {\n this._layout.processParentMessage(msg);\n }\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n *\n * #### Notes\n * The default implementation unparents or detaches the widget.\n */\n protected onCloseRequest(msg: Message): void {\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onResize(msg: Widget.ResizeMessage): void {}\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onUpdateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onActivateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeShow(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterShow(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeHide(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterHide(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-added'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n private _toggleHidden(hidden: boolean) {\n if (hidden) {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.addClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = 'scale(0)';\n this.node.setAttribute('aria-hidden', 'true');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = 'hidden';\n this.node.style.zIndex = '-1';\n break;\n }\n } else {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.removeClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = '';\n this.node.removeAttribute('aria-hidden');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = '';\n this.node.style.zIndex = '';\n break;\n }\n }\n }\n\n private _flags = 0;\n private _layout: Layout | null = null;\n private _parent: Widget | null = null;\n private _disposed = new Signal(this);\n private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n /**\n * An options object for initializing a widget.\n */\n export interface IOptions {\n /**\n * The optional node to use for the widget.\n *\n * If a node is provided, the widget will assume full ownership\n * and control of the node, as if it had created the node itself.\n *\n * The default is a new `
`.\n */\n node?: HTMLElement;\n\n /**\n * The optional element tag, used for constructing the widget's node.\n *\n * If a pre-constructed node is provided via the `node` arg, this\n * value is ignored.\n */\n tag?: keyof HTMLElementTagNameMap;\n }\n\n /**\n * The method for hiding the widget.\n *\n * The default is Display.\n *\n * Using `Scale` will often increase performance as most browsers will not\n * trigger style computation for the `transform` action. This should be used\n * sparingly and tested, since increasing the number of composition layers\n * may slow things down.\n *\n * To ensure the transformation does not trigger style recomputation, you\n * may need to set the widget CSS style `will-change: transform`. This\n * should be used only when needed as it may overwhelm the browser with a\n * high number of layers. See\n * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n */\n export enum HiddenMode {\n /**\n * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n * CSS from the standard Lumino CSS.\n */\n Display = 0,\n\n /**\n * Hide the widget by setting the `transform` to `'scale(0)'`.\n */\n Scale,\n\n /**\n *Hide the widget by setting the `content-visibility` to `'hidden'`.\n */\n ContentVisibility\n }\n\n /**\n * An enum of widget bit flags.\n */\n export enum Flag {\n /**\n * The widget has been disposed.\n */\n IsDisposed = 0x1,\n\n /**\n * The widget is attached to the DOM.\n */\n IsAttached = 0x2,\n\n /**\n * The widget is hidden.\n */\n IsHidden = 0x4,\n\n /**\n * The widget is visible.\n */\n IsVisible = 0x8,\n\n /**\n * A layout cannot be set on the widget.\n */\n DisallowLayout = 0x10\n }\n\n /**\n * A collection of stateless messages related to widgets.\n */\n export namespace Msg {\n /**\n * A singleton `'before-show'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const BeforeShow = new Message('before-show');\n\n /**\n * A singleton `'after-show'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const AfterShow = new Message('after-show');\n\n /**\n * A singleton `'before-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const BeforeHide = new Message('before-hide');\n\n /**\n * A singleton `'after-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const AfterHide = new Message('after-hide');\n\n /**\n * A singleton `'before-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is attached.\n */\n export const BeforeAttach = new Message('before-attach');\n\n /**\n * A singleton `'after-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is attached.\n */\n export const AfterAttach = new Message('after-attach');\n\n /**\n * A singleton `'before-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is detached.\n */\n export const BeforeDetach = new Message('before-detach');\n\n /**\n * A singleton `'after-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is detached.\n */\n export const AfterDetach = new Message('after-detach');\n\n /**\n * A singleton `'parent-changed'` message.\n *\n * #### Notes\n * This message is sent to a widget when its parent has changed.\n */\n export const ParentChanged = new Message('parent-changed');\n\n /**\n * A singleton conflatable `'update-request'` message.\n *\n * #### Notes\n * This message can be dispatched to supporting widgets in order to\n * update their content based on the current widget state. Not all\n * widgets will respond to messages of this type.\n *\n * For widgets with a layout, this message will inform the layout to\n * update the position and size of its child widgets.\n */\n export const UpdateRequest = new ConflatableMessage('update-request');\n\n /**\n * A singleton conflatable `'fit-request'` message.\n *\n * #### Notes\n * For widgets with a layout, this message will inform the layout to\n * recalculate its size constraints to fit the space requirements of\n * its child widgets, and to update their position and size. Not all\n * layouts will respond to messages of this type.\n */\n export const FitRequest = new ConflatableMessage('fit-request');\n\n /**\n * A singleton conflatable `'activate-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should\n * perform the actions necessary to activate the widget, which\n * may include focusing its node or descendant node.\n */\n export const ActivateRequest = new ConflatableMessage('activate-request');\n\n /**\n * A singleton conflatable `'close-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should close\n * and remove itself from the widget hierarchy.\n */\n export const CloseRequest = new ConflatableMessage('close-request');\n }\n\n /**\n * A message class for child related messages.\n */\n export class ChildMessage extends Message {\n /**\n * Construct a new child message.\n *\n * @param type - The message type.\n *\n * @param child - The child widget for the message.\n */\n constructor(type: string, child: Widget) {\n super(type);\n this.child = child;\n }\n\n /**\n * The child widget for the message.\n */\n readonly child: Widget;\n }\n\n /**\n * A message class for `'resize'` messages.\n */\n export class ResizeMessage extends Message {\n /**\n * Construct a new resize message.\n *\n * @param width - The **offset width** of the widget, or `-1` if\n * the width is not known.\n *\n * @param height - The **offset height** of the widget, or `-1` if\n * the height is not known.\n */\n constructor(width: number, height: number) {\n super('resize');\n this.width = width;\n this.height = height;\n }\n\n /**\n * The offset width of the widget.\n *\n * #### Notes\n * This will be `-1` if the width is unknown.\n */\n readonly width: number;\n\n /**\n * The offset height of the widget.\n *\n * #### Notes\n * This will be `-1` if the height is unknown.\n */\n readonly height: number;\n }\n\n /**\n * The namespace for the `ResizeMessage` class statics.\n */\n export namespace ResizeMessage {\n /**\n * A singleton `'resize'` message with an unknown size.\n */\n export const UnknownSize = new ResizeMessage(-1, -1);\n }\n\n /**\n * Attach a widget to a host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * @param host - The DOM node to use as the widget's host.\n *\n * @param ref - The child of `host` to use as the reference element.\n * If this is provided, the widget will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * widget to be added as the last child of the host.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget, if\n * the widget is already attached, or if the host is not attached\n * to the DOM.\n */\n export function attach(\n widget: Widget,\n host: HTMLElement,\n ref: HTMLElement | null = null\n ): void {\n if (widget.parent) {\n throw new Error('Cannot attach a child widget.');\n }\n if (widget.isAttached || widget.node.isConnected) {\n throw new Error('Widget is already attached.');\n }\n if (!host.isConnected) {\n throw new Error('Host is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n host.insertBefore(widget.node, ref);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n /**\n * Detach the widget from its host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget,\n * or if the widget is not attached to the DOM.\n */\n export function detach(widget: Widget): void {\n if (widget.parent) {\n throw new Error('Cannot detach a child widget.');\n }\n if (!widget.isAttached || !widget.node.isConnected) {\n throw new Error('Widget is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n widget.node.parentNode!.removeChild(widget.node);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An attached property for the widget title object.\n */\n export const titleProperty = new AttachedProperty>({\n name: 'title',\n create: owner => new Title({ owner })\n });\n\n /**\n * Create a DOM node for the given widget options.\n */\n export function createNode(options: Widget.IOptions): HTMLElement {\n return options.node || document.createElement(options.tag || 'div');\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable, IDisposable {\n /**\n * Construct a new layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: Layout.IOptions = {}) {\n this._fitPolicy = options.fitPolicy || 'set-min-size';\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This should be reimplemented to clear and dispose of the widgets.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n this._parent = null;\n this._disposed = true;\n Signal.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * Test whether the layout is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Get the parent widget of the layout.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent widget of the layout.\n *\n * #### Notes\n * This is set automatically when installing the layout on the parent\n * widget. The parent widget should not be set directly by user code.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (this._parent) {\n throw new Error('Cannot change parent widget.');\n }\n if (value!.layout !== this) {\n throw new Error('Invalid parent widget.');\n }\n this._parent = value;\n this.init();\n }\n\n /**\n * Get the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n get fitPolicy(): Layout.FitPolicy {\n return this._fitPolicy;\n }\n\n /**\n * Set the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n *\n * Changing the fit policy will clear the current size constraint\n * for the parent widget and then re-fit the parent.\n */\n set fitPolicy(value: Layout.FitPolicy) {\n // Bail if the policy does not change\n if (this._fitPolicy === value) {\n return;\n }\n\n // Update the internal policy.\n this._fitPolicy = value;\n\n // Clear the size constraints and schedule a fit of the parent.\n if (this._parent) {\n let style = this._parent.node.style;\n style.minWidth = '';\n style.minHeight = '';\n style.maxWidth = '';\n style.maxHeight = '';\n this._parent.fit();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This abstract method must be implemented by a subclass.\n */\n abstract [Symbol.iterator](): IterableIterator;\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method should *not* modify the widget's `parent`.\n */\n abstract removeWidget(widget: Widget): void;\n\n /**\n * Process a message sent to the parent widget.\n *\n * @param msg - The message sent to the parent widget.\n *\n * #### Notes\n * This method is called by the parent widget to process a message.\n *\n * Subclasses may reimplement this method as needed.\n */\n processParentMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.onAfterDetach(msg);\n break;\n case 'child-removed':\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n case 'child-shown':\n this.onChildShown(msg as Widget.ChildMessage);\n break;\n case 'child-hidden':\n this.onChildHidden(msg as Widget.ChildMessage);\n break;\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n *\n * #### Notes\n * This method is invoked immediately after the layout is installed\n * on the parent widget.\n *\n * The default implementation reparents all of the widgets to the\n * layout parent widget.\n *\n * Subclasses should reimplement this method and attach the child\n * widget nodes to the parent widget's node.\n */\n protected init(): void {\n for (const widget of this) {\n widget.parent = this.parent;\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the specified layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the available layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onUpdateRequest(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * This will remove the child widget from the layout.\n *\n * Subclasses should **not** typically reimplement this method.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n this.removeWidget(msg.child);\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n private _disposed = false;\n private _fitPolicy: Layout.FitPolicy;\n private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n /**\n * A type alias for the layout fit policy.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n export type FitPolicy =\n | /**\n * No size constraint will be applied to the parent widget.\n */\n 'set-no-constraint'\n\n /**\n * The computed min size will be applied to the parent widget.\n */\n | 'set-min-size';\n\n /**\n * An options object for initializing a layout.\n */\n export interface IOptions {\n /**\n * The fit policy for the layout.\n *\n * The default is `'set-min-size'`.\n */\n fitPolicy?: FitPolicy;\n }\n\n /**\n * A type alias for the horizontal alignment of a widget.\n */\n export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n /**\n * A type alias for the vertical alignment of a widget.\n */\n export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n /**\n * Get the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The horizontal alignment for the widget.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n */\n export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n return Private.horizontalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the horizontal alignment.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setHorizontalAlignment(\n widget: Widget,\n value: HorizontalAlignment\n ): void {\n Private.horizontalAlignmentProperty.set(widget, value);\n }\n\n /**\n * Get the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The vertical alignment for the widget.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n */\n export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n return Private.verticalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the vertical alignment.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setVerticalAlignment(\n widget: Widget,\n value: VerticalAlignment\n ): void {\n Private.verticalAlignmentProperty.set(widget, value);\n }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n /**\n * Construct a new layout item.\n *\n * @param widget - The widget to be managed by the item.\n *\n * #### Notes\n * The widget will be set to absolute positioning.\n * The widget will use strict CSS containment.\n */\n constructor(widget: Widget) {\n this.widget = widget;\n this.widget.node.style.position = 'absolute';\n this.widget.node.style.contain = 'strict';\n }\n\n /**\n * Dispose of the the layout item.\n *\n * #### Notes\n * This will reset the positioning of the widget.\n */\n dispose(): void {\n // Do nothing if the item is already disposed.\n if (this._disposed) {\n return;\n }\n\n // Mark the item as disposed.\n this._disposed = true;\n\n // Reset the widget style.\n let style = this.widget.node.style;\n style.position = '';\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n style.contain = '';\n }\n\n /**\n * The widget managed by the layout item.\n */\n readonly widget: Widget;\n\n /**\n * The computed minimum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minWidth(): number {\n return this._minWidth;\n }\n\n /**\n * The computed minimum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minHeight(): number {\n return this._minHeight;\n }\n\n /**\n * The computed maximum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxWidth(): number {\n return this._maxWidth;\n }\n\n /**\n * The computed maximum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxHeight(): number {\n return this._maxHeight;\n }\n\n /**\n * Whether the layout item is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Whether the managed widget is hidden.\n */\n get isHidden(): boolean {\n return this.widget.isHidden;\n }\n\n /**\n * Whether the managed widget is visible.\n */\n get isVisible(): boolean {\n return this.widget.isVisible;\n }\n\n /**\n * Whether the managed widget is attached.\n */\n get isAttached(): boolean {\n return this.widget.isAttached;\n }\n\n /**\n * Update the computed size limits of the managed widget.\n */\n fit(): void {\n let limits = ElementExt.sizeLimits(this.widget.node);\n this._minWidth = limits.minWidth;\n this._minHeight = limits.minHeight;\n this._maxWidth = limits.maxWidth;\n this._maxHeight = limits.maxHeight;\n }\n\n /**\n * Update the position and size of the managed widget.\n *\n * @param left - The left edge position of the layout box.\n *\n * @param top - The top edge position of the layout box.\n *\n * @param width - The width of the layout box.\n *\n * @param height - The height of the layout box.\n */\n update(left: number, top: number, width: number, height: number): void {\n // Clamp the size to the computed size limits.\n let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n // Adjust the left edge for the horizontal alignment, if needed.\n if (clampW < width) {\n switch (Layout.getHorizontalAlignment(this.widget)) {\n case 'left':\n break;\n case 'center':\n left += (width - clampW) / 2;\n break;\n case 'right':\n left += width - clampW;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Adjust the top edge for the vertical alignment, if needed.\n if (clampH < height) {\n switch (Layout.getVerticalAlignment(this.widget)) {\n case 'top':\n break;\n case 'center':\n top += (height - clampH) / 2;\n break;\n case 'bottom':\n top += height - clampH;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Set up the resize variables.\n let resized = false;\n let style = this.widget.node.style;\n\n // Update the top edge of the widget if needed.\n if (this._top !== top) {\n this._top = top;\n style.top = `${top}px`;\n }\n\n // Update the left edge of the widget if needed.\n if (this._left !== left) {\n this._left = left;\n style.left = `${left}px`;\n }\n\n // Update the width of the widget if needed.\n if (this._width !== clampW) {\n resized = true;\n this._width = clampW;\n style.width = `${clampW}px`;\n }\n\n // Update the height of the widget if needed.\n if (this._height !== clampH) {\n resized = true;\n this._height = clampH;\n style.height = `${clampH}px`;\n }\n\n // Send a resize message to the widget if needed.\n if (resized) {\n let msg = new Widget.ResizeMessage(clampW, clampH);\n MessageLoop.sendMessage(this.widget, msg);\n }\n }\n\n private _top = NaN;\n private _left = NaN;\n private _width = NaN;\n private _height = NaN;\n private _minWidth = 0;\n private _minHeight = 0;\n private _maxWidth = Infinity;\n private _maxHeight = Infinity;\n private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The attached property for a widget horizontal alignment.\n */\n export const horizontalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.HorizontalAlignment\n >({\n name: 'horizontalAlignment',\n create: () => 'center',\n changed: onAlignmentChanged\n });\n\n /**\n * The attached property for a widget vertical alignment.\n */\n export const verticalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.VerticalAlignment\n >({\n name: 'verticalAlignment',\n create: () => 'top',\n changed: onAlignmentChanged\n });\n\n /**\n * The change handler for the attached alignment properties.\n */\n function onAlignmentChanged(child: Widget): void {\n if (child.parent && child.parent.layout) {\n child.parent.update();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n while (this._widgets.length > 0) {\n this._widgets.pop()!.dispose();\n }\n super.dispose();\n }\n\n /**\n * A read-only array of the widgets in the layout.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n yield* this._widgets;\n }\n\n /**\n * Add a widget to the end of the layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, it will be moved.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this._widgets.length, widget);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n widget.parent = this.parent;\n\n // Look up the current index of the widget.\n let i = this._widgets.indexOf(widget);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._widgets.length));\n\n // If the widget is not in the array, insert it.\n if (i === -1) {\n // Insert the widget into the array.\n ArrayExt.insert(this._widgets, j, widget);\n\n // If the layout is parented, attach the widget to the DOM.\n if (this.parent) {\n this.attachWidget(j, widget);\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the widget exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._widgets.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the widget to the new location.\n ArrayExt.move(this._widgets, i, j);\n\n // If the layout is parented, move the widget in the DOM.\n if (this.parent) {\n this.moveWidget(i, j, widget);\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n this.removeWidgetAt(this._widgets.indexOf(widget));\n }\n\n /**\n * Remove the widget at a given index from the layout.\n *\n * @param index - The index of the widget to remove.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n removeWidgetAt(index: number): void {\n // Remove the widget from the array.\n let widget = ArrayExt.removeAt(this._widgets, index);\n\n // If the layout is parented, detach the widget from the DOM.\n if (widget && this.parent) {\n this.detachWidget(index, widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n let index = 0;\n for (const widget of this) {\n this.attachWidget(index++, widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[index];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation moves the widget's node to the proper\n * location in the parent's node and sends the appropriate attach and\n * detach messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is moved in the parent's node.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` and message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[toIndex];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widgets: Widget[] = [];\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n /**\n * Clamp a dimension value to an integer >= 0.\n */\n export function clampDimension(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n /**\n * Construct a new split layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: SplitLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.orientation !== undefined) {\n this._orientation = options.orientation;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n this._handles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the split layout.\n */\n readonly renderer: SplitLayout.IRenderer;\n\n /**\n * Get the layout orientation for the split layout.\n */\n get orientation(): SplitLayout.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the layout orientation for the split layout.\n */\n set orientation(value: SplitLayout.Orientation) {\n if (this._orientation === value) {\n return;\n }\n this._orientation = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['orientation'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n get alignment(): SplitLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n set alignment(value: SplitLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the split layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the split layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the split handles in the layout.\n */\n get handles(): ReadonlyArray {\n return this._handles;\n }\n\n /**\n * Get the absolute sizes of the widgets in the layout.\n *\n * @returns A new array of the absolute sizes of the widgets.\n *\n * This method **does not** measure the DOM nodes.\n */\n absoluteSizes(): number[] {\n return this._sizers.map(sizer => sizer.size);\n }\n\n /**\n * Get the relative sizes of the widgets in the layout.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return Private.normalize(this._sizers.map(sizer => sizer.size));\n }\n\n /**\n * Set the relative sizes for the widgets in the layout.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n // Copy the sizes and pad with zeros as needed.\n let n = this._sizers.length;\n let temp = sizes.slice(0, n);\n while (temp.length < n) {\n temp.push(0);\n }\n\n // Normalize the padded sizes.\n let normed = Private.normalize(temp);\n\n // Apply the normalized sizes to the sizers.\n for (let i = 0; i < n; ++i) {\n let sizer = this._sizers[i];\n sizer.sizeHint = normed[i];\n sizer.size = normed[i];\n }\n\n // Set the flag indicating the sizes are normalized.\n this._hasNormedSizes = true;\n\n // Trigger an update of the parent widget.\n if (update && this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Move the offset position of a split handle.\n *\n * @param index - The index of the handle of the interest.\n *\n * @param position - The desired offset position of the handle.\n *\n * #### Notes\n * The position is relative to the offset parent.\n *\n * This will move the handle as close as possible to the desired\n * position. The sibling widgets will be adjusted as necessary.\n */\n moveHandle(index: number, position: number): void {\n // Bail if the index is invalid or the handle is hidden.\n let handle = this._handles[index];\n if (!handle || handle.classList.contains('lm-mod-hidden')) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (this._orientation === 'horizontal') {\n delta = position - handle.offsetLeft;\n } else {\n delta = position - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent widget resizing unless needed.\n for (let sizer of this._sizers) {\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(this._sizers, index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['orientation'] = this.orientation;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create the item, handle, and sizer for the new widget.\n let item = new LayoutItem(widget);\n let handle = Private.createHandle(this.renderer);\n let average = Private.averageSize(this._sizers);\n let sizer = Private.createSizer(average);\n\n // Insert the item, handle, and sizer into the internal arrays.\n ArrayExt.insert(this._items, index, item);\n ArrayExt.insert(this._sizers, index, sizer);\n ArrayExt.insert(this._handles, index, handle);\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget and handle nodes to the parent.\n this.parent!.node.appendChild(widget.node);\n this.parent!.node.appendChild(handle);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the item, sizer, and handle for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n ArrayExt.move(this._handles, fromIndex, toIndex);\n\n // Post a fit request to the parent to show/hide last handle.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the item, handle, and sizer for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n let handle = ArrayExt.removeAt(this._handles, index);\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget and handle nodes from the parent.\n this.parent!.node.removeChild(widget.node);\n this.parent!.node.removeChild(handle!);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const item = this._items[i];\n if (item.isHidden) {\n return;\n }\n\n // Fetch the style for the handle.\n let handleStyle = this._handles[i].style;\n\n // Update the widget and handle, and advance the relevant edge.\n if (isHorizontal) {\n left += this.widgetOffset;\n item.update(left, top, size, height);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${this._spacing}px`;\n handleStyle.height = `${height}px`;\n } else {\n top += this.widgetOffset;\n item.update(left, top, width, size);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${this._spacing}px`;\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Update the handles and track the visible widget count.\n let nVisible = 0;\n let lastHandleIndex = -1;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n if (this._items[i].isHidden) {\n this._handles[i].classList.add('lm-mod-hidden');\n } else {\n this._handles[i].classList.remove('lm-mod-hidden');\n lastHandleIndex = i;\n nVisible++;\n }\n }\n\n // Hide the handle for the last visible widget.\n if (lastHandleIndex !== -1) {\n this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n }\n\n // Update the fixed space for the visible items.\n this._fixed =\n this._spacing * Math.max(0, nVisible - 1) +\n this.widgetOffset * this._items.length;\n\n // Setup the computed minimum size.\n let horz = this._orientation === 'horizontal';\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed size limits.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // Prevent resizing unless necessary.\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the stretch factor.\n sizer.stretch = SplitLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0 && this.widgetOffset === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Set up the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n let horz = this._orientation === 'horizontal';\n\n if (nVisible > 0) {\n // Compute the adjusted layout space.\n let space: number;\n if (horz) {\n // left += this.widgetOffset;\n space = Math.max(0, width - this._fixed);\n } else {\n // top += this.widgetOffset;\n space = Math.max(0, height - this._fixed);\n }\n\n // Scale the size hints if they are normalized.\n if (this._hasNormedSizes) {\n for (let sizer of this._sizers) {\n sizer.sizeHint *= space;\n }\n this._hasNormedSizes = false;\n }\n\n // Distribute the layout space to the box sizers.\n let delta = BoxEngine.calc(this._sizers, space);\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n const item = this._items[i];\n\n // Fetch the computed size for the widget.\n const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n this.updateItemPosition(\n i,\n horz,\n horz ? left + offset : left,\n horz ? top : top + offset,\n height,\n width,\n size\n );\n\n const fullOffset =\n this.widgetOffset +\n (this._handles[i].classList.contains('lm-mod-hidden')\n ? 0\n : this._spacing);\n\n if (horz) {\n left += size + fullOffset;\n } else {\n top += size + fullOffset;\n }\n }\n }\n\n protected widgetOffset = 0;\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _hasNormedSizes = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _handles: HTMLDivElement[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: SplitLayout.Alignment = 'start';\n private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n /**\n * A type alias for a split layout orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a split layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a split layout.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split layout.\n */\n renderer: IRenderer;\n\n /**\n * The orientation of the layout.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a split layout.\n */\n export interface IRenderer {\n /**\n * Create a new handle for use with a split layout.\n *\n * @returns A new handle element.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * Get the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Create a new box sizer with the given size hint.\n */\n export function createSizer(size: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = Math.floor(size);\n return sizer;\n }\n\n /**\n * Create a new split handle node using the given renderer.\n */\n export function createHandle(\n renderer: SplitLayout.IRenderer\n ): HTMLDivElement {\n let handle = renderer.createHandle();\n handle.style.position = 'absolute';\n // Do not use size containment to allow the handle to fill the available space\n handle.style.contain = 'style';\n return handle;\n }\n\n /**\n * Compute the average size of an array of box sizers.\n */\n export function averageSize(sizers: BoxSizer[]): number {\n return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n }\n\n /**\n * Normalize an array of values.\n */\n export function normalize(values: number[]): number[] {\n let n = values.length;\n if (n === 0) {\n return [];\n }\n let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof SplitLayout) {\n child.parent.fit();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n /**\n * Construct a new accordion layout.\n *\n * @param options - The options for initializing the layout.\n *\n * #### Notes\n * The default orientation will be vertical.\n *\n * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n */\n constructor(options: AccordionLayout.IOptions) {\n super({ ...options, orientation: options.orientation || 'vertical' });\n this.titleSpace = options.titleSpace || 22;\n }\n\n /**\n * The section title height or width depending on the orientation.\n */\n get titleSpace(): number {\n return this.widgetOffset;\n }\n set titleSpace(value: number) {\n value = Utils.clampDimension(value);\n if (this.widgetOffset === value) {\n return;\n }\n this.widgetOffset = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return this._titles;\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n\n // Clear the layout state.\n this._titles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the accordion layout.\n */\n readonly renderer: AccordionLayout.IRenderer;\n\n public updateTitle(index: number, widget: Widget): void {\n const oldTitle = this._titles[index];\n const expanded = oldTitle.classList.contains('lm-mod-expanded');\n const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n this._titles[index] = newTitle;\n\n // Add the title node to the parent before the widget.\n this.parent!.node.replaceChild(newTitle, oldTitle);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n if (!widget.id) {\n widget.id = `id-${UUID.uuid4()}`;\n }\n super.insertWidget(index, widget);\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(index: number, widget: Widget): void {\n const title = Private.createTitle(this.renderer, widget.title);\n\n ArrayExt.insert(this._titles, index, title);\n\n // Add the title node to the parent before the widget.\n this.parent!.node.appendChild(title);\n\n widget.node.setAttribute('role', 'region');\n widget.node.setAttribute('aria-labelledby', title.id);\n\n super.attachWidget(index, widget);\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n ArrayExt.move(this._titles, fromIndex, toIndex);\n super.moveWidget(fromIndex, toIndex, widget);\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n const title = ArrayExt.removeAt(this._titles, index);\n\n this.parent!.node.removeChild(title!);\n\n super.detachWidget(index, widget);\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const titleStyle = this._titles[i].style;\n\n // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n titleStyle.top = `${top}px`;\n titleStyle.left = `${left}px`;\n titleStyle.height = `${this.widgetOffset}px`;\n if (isHorizontal) {\n titleStyle.width = `${height}px`;\n } else {\n titleStyle.width = `${width}px`;\n }\n\n super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n }\n\n private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n /**\n * A type alias for a accordion layout orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion layout alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * An options object for initializing a accordion layout.\n */\n export interface IOptions extends SplitLayout.IOptions {\n /**\n * The renderer to use for the accordion layout.\n */\n renderer: IRenderer;\n\n /**\n * The section title height or width depending on the orientation.\n *\n * The default is `22`.\n */\n titleSpace?: number;\n }\n\n /**\n * A renderer for use with an accordion layout.\n */\n export interface IRenderer extends SplitLayout.IRenderer {\n /**\n * Common class name for all accordion titles.\n */\n readonly titleClassName: string;\n\n /**\n * Render the element for a section title.\n *\n * @param title - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(title: Title): HTMLElement;\n }\n}\n\nnamespace Private {\n /**\n * Create the title HTML element.\n *\n * @param renderer Accordion renderer\n * @param data Widget title\n * @returns Title HTML element\n */\n export function createTitle(\n renderer: AccordionLayout.IRenderer,\n data: Title,\n expanded: boolean = true\n ): HTMLElement {\n const title = renderer.createSectionTitle(data);\n title.style.position = 'absolute';\n title.style.contain = 'strict';\n title.setAttribute('aria-label', `${data.label} Section`);\n title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n title.setAttribute('aria-controls', data.owner.id);\n if (expanded) {\n title.classList.add('lm-mod-expanded');\n }\n return title;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n /**\n * Construct a new panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: Panel.IOptions = {}) {\n super();\n this.addClass('lm-Panel');\n this.layout = Private.createLayout(options);\n }\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return (this.layout as PanelLayout).widgets;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n (this.layout as PanelLayout).addWidget(widget);\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n (this.layout as PanelLayout).insertWidget(index, widget);\n }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n /**\n * An options object for creating a panel.\n */\n export interface IOptions {\n /**\n * The panel layout to use for the panel.\n *\n * The default is a new `PanelLayout`.\n */\n layout?: PanelLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a panel layout for the given panel options.\n */\n export function createLayout(options: Panel.IOptions): PanelLayout {\n return options.layout || new PanelLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n /**\n * Construct a new split panel.\n *\n * @param options - The options for initializing the split panel.\n */\n constructor(options: SplitPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-SplitPanel');\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n this._releaseMouse();\n super.dispose();\n }\n\n /**\n * Get the layout orientation for the split panel.\n */\n get orientation(): SplitPanel.Orientation {\n return (this.layout as SplitLayout).orientation;\n }\n\n /**\n * Set the layout orientation for the split panel.\n */\n set orientation(value: SplitPanel.Orientation) {\n (this.layout as SplitLayout).orientation = value;\n }\n\n /**\n * Get the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n get alignment(): SplitPanel.Alignment {\n return (this.layout as SplitLayout).alignment;\n }\n\n /**\n * Set the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n set alignment(value: SplitPanel.Alignment) {\n (this.layout as SplitLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the split panel.\n */\n get spacing(): number {\n return (this.layout as SplitLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the split panel.\n */\n set spacing(value: number) {\n (this.layout as SplitLayout).spacing = value;\n }\n\n /**\n * The renderer used by the split panel.\n */\n get renderer(): SplitPanel.IRenderer {\n return (this.layout as SplitLayout).renderer;\n }\n\n /**\n * A signal emitted when a split handle has moved.\n */\n get handleMoved(): ISignal {\n return this._handleMoved;\n }\n\n /**\n * A read-only array of the split handles in the panel.\n */\n get handles(): ReadonlyArray {\n return (this.layout as SplitLayout).handles;\n }\n\n /**\n * Get the relative sizes of the widgets in the panel.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return (this.layout as SplitLayout).relativeSizes();\n }\n\n /**\n * Set the relative sizes for the widgets in the panel.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n }\n\n /**\n * Handle the DOM events for the split panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * Handle the `'keydown'` event for the split panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n if (this._pressData) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the split panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the primary button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the target, if any.\n let layout = this.layout as SplitLayout;\n let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n return handle.contains(event.target as HTMLElement);\n });\n\n // Bail early if the mouse press was not on a handle.\n if (index === -1) {\n return;\n }\n\n // Stop the event when a split handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n document.addEventListener('pointerup', this, true);\n document.addEventListener('pointermove', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Compute the offset delta for the handle press.\n let delta: number;\n let handle = layout.handles[index];\n let rect = handle.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n delta = event.clientX - rect.left;\n } else {\n delta = event.clientY - rect.top;\n }\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!);\n this._pressData = { index, delta, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the split panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Stop the event when dragging a split handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let pos: number;\n let layout = this.layout as SplitLayout;\n let rect = this.node.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n pos = event.clientX - rect.left - this._pressData!.delta;\n } else {\n pos = event.clientY - rect.top - this._pressData!.delta;\n }\n\n // Move the handle as close to the desired position as possible.\n layout.moveHandle(this._pressData!.index, pos);\n }\n\n /**\n * Handle the `'pointerup'` event for the split panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the primary button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse grab for the split panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Emit the handle moved signal.\n this._handleMoved.emit();\n\n // Remove the extra document listeners.\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('pointerup', this, true);\n document.removeEventListener('pointermove', this, true);\n document.removeEventListener('contextmenu', this, true);\n }\n\n private _handleMoved = new Signal(this);\n private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n /**\n * A type alias for a split panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a split panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a split panel renderer.\n */\n export type IRenderer = SplitLayout.IRenderer;\n\n /**\n * An options object for initializing a split panel.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The layout orientation of the panel.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The split layout to use for the split panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `SplitLayout`.\n */\n layout?: SplitLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new handle for use with a split panel.\n *\n * @returns A new handle element for a split panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-SplitPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * Get the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return SplitLayout.getStretch(widget);\n }\n\n /**\n * Set the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n SplitLayout.setStretch(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The index of the pressed handle.\n */\n index: number;\n\n /**\n * The offset of the press in handle coordinates.\n */\n delta: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * Create a split layout for the given panel options.\n */\n export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n return (\n options.layout ||\n new SplitLayout({\n renderer: options.renderer || SplitPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n */\nexport class AccordionPanel extends SplitPanel {\n /**\n * Construct a new accordion panel.\n *\n * @param options - The options for initializing the accordion panel.\n */\n constructor(options: AccordionPanel.IOptions = {}) {\n super({ ...options, layout: Private.createLayout(options) });\n this.addClass('lm-AccordionPanel');\n }\n\n /**\n * The renderer used by the accordion panel.\n */\n get renderer(): AccordionPanel.IRenderer {\n return (this.layout as AccordionLayout).renderer;\n }\n\n /**\n * The section title space.\n *\n * This is the height if the panel is vertical and the width if it is\n * horizontal.\n */\n get titleSpace(): number {\n return (this.layout as AccordionLayout).titleSpace;\n }\n set titleSpace(value: number) {\n (this.layout as AccordionLayout).titleSpace = value;\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return (this.layout as AccordionLayout).titles;\n }\n\n /**\n * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n */\n get expansionToggled(): ISignal {\n return this._expansionToggled;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n super.addWidget(widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Collapse the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n collapse(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && !widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Expand the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n expand(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n super.insertWidget(index, widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Handle the DOM events for the accordion panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n super.handleEvent(event);\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._eventKeyDown(event as KeyboardEvent);\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n super.onBeforeAttach(msg);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n super.onAfterDetach(msg);\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n return widget.contains(sender.owner);\n });\n\n if (index >= 0) {\n (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n this.update();\n }\n }\n\n /**\n * Compute the size of widgets in this panel on the title click event.\n * On closing, the size of the widget is cached and we will try to expand\n * the last opened widget.\n * On opening, we will use the cached size if it is available to restore the\n * widget.\n * In both cases, if we can not compute the size of widgets, we will let\n * `SplitLayout` decide.\n *\n * @param index - The index of widget to be opened of closed\n *\n * @returns Relative size of widgets in this panel, if this size can\n * not be computed, return `undefined`\n */\n private _computeWidgetSize(index: number): number[] | undefined {\n const layout = this.layout as AccordionLayout;\n\n const widget = layout.widgets[index];\n if (!widget) {\n return undefined;\n }\n const isHidden = widget.isHidden;\n const widgetSizes = layout.absoluteSizes();\n const delta = (isHidden ? -1 : 1) * this.spacing;\n const totalSize = widgetSizes.reduce(\n (prev: number, curr: number) => prev + curr\n );\n\n let newSize = [...widgetSizes];\n\n if (!isHidden) {\n // Hide the widget\n const currentSize = widgetSizes[index];\n\n this._widgetSizesCache.set(widget, currentSize);\n newSize[index] = 0;\n\n const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // All widget are closed, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n\n newSize[widgetToCollapse] =\n widgetSizes[widgetToCollapse] + currentSize + delta;\n } else {\n // Show the widget\n const previousSize = this._widgetSizesCache.get(widget);\n if (!previousSize) {\n // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n newSize[index] += previousSize;\n\n const widgetToCollapse = newSize\n .map(sz => sz - previousSize > 0)\n .lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // Can not reduce the size of one widget, reduce all opened widgets\n // proportionally with its size.\n newSize.forEach((_, idx) => {\n if (idx !== index) {\n newSize[idx] -=\n (widgetSizes[idx] / totalSize) * (previousSize - delta);\n }\n });\n } else {\n newSize[widgetToCollapse] -= previousSize - delta;\n }\n }\n return newSize.map(sz => sz / (totalSize + delta));\n }\n /**\n * Handle the `'click'` event for the accordion panel\n */\n private _evtClick(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this._toggleExpansion(index);\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the accordion panel.\n */\n private _eventKeyDown(event: KeyboardEvent): void {\n if (event.defaultPrevented) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n let handled = false;\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n const keyCode = event.keyCode.toString();\n\n // If Space or Enter is pressed on title, emulate click event\n if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n target.click();\n handled = true;\n } else if (\n this.orientation === 'horizontal'\n ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n ) {\n // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n const direction =\n event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n ? -1\n : 1;\n const length = this.titles.length;\n const newIndex = (index + length + direction) % length;\n\n this.titles[newIndex].focus();\n handled = true;\n } else if (event.key === 'End' || keyCode === '35') {\n // If End is pressed on title, focus on the last title\n this.titles[this.titles.length - 1].focus();\n handled = true;\n } else if (event.key === 'Home' || keyCode === '36') {\n // If Home is pressed on title, focus on the first title\n this.titles[0].focus();\n handled = true;\n }\n }\n\n if (handled) {\n event.preventDefault();\n }\n }\n }\n\n private _toggleExpansion(index: number) {\n const title = this.titles[index];\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n const newSize = this._computeWidgetSize(index);\n if (newSize) {\n this.setRelativeSizes(newSize, false);\n }\n\n if (widget.isHidden) {\n title.classList.add('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'true');\n widget.show();\n } else {\n title.classList.remove('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'false');\n widget.hide();\n }\n\n // Emit the expansion state signal.\n this._expansionToggled.emit(index);\n }\n\n private _widgetSizesCache: WeakMap = new WeakMap();\n private _expansionToggled = new Signal(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n /**\n * A type alias for a accordion panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a accordion panel renderer.\n */\n export type IRenderer = AccordionLayout.IRenderer;\n\n /**\n * An options object for initializing a accordion panel.\n */\n export interface IOptions extends Partial {\n /**\n * The accordion layout to use for the accordion panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `AccordionLayout`.\n */\n layout?: AccordionLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer extends SplitPanel.Renderer implements IRenderer {\n constructor() {\n super();\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches any title node in the accordion.\n */\n readonly titleClassName = 'lm-AccordionPanel-title';\n\n /**\n * Render the collapse indicator for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the collapse indicator.\n */\n createCollapseIcon(data: Title): HTMLElement {\n return document.createElement('span');\n }\n\n /**\n * Render the element for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(data: Title): HTMLElement {\n const handle = document.createElement('h3');\n handle.setAttribute('tabindex', '0');\n handle.id = this.createTitleKey(data);\n handle.className = this.titleClassName;\n for (const aData in data.dataset) {\n handle.dataset[aData] = data.dataset[aData];\n }\n\n const collapser = handle.appendChild(this.createCollapseIcon(data));\n collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n const label = handle.appendChild(document.createElement('span'));\n label.className = 'lm-AccordionPanel-titleLabel';\n label.textContent = data.label;\n label.title = data.caption || data.label;\n\n return handle;\n }\n\n /**\n * Create a unique render key for the title.\n *\n * @param data - The data to use for the title.\n *\n * @returns The unique render key for the title.\n *\n * #### Notes\n * This method caches the key against the section title the first time\n * the key is generated.\n */\n createTitleKey(data: Title): string {\n let key = this._titleKeys.get(data);\n if (key === undefined) {\n key = `title-key-${this._uuid}-${this._titleID++}`;\n this._titleKeys.set(data, key);\n }\n return key;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _titleID = 0;\n private _titleKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n /**\n * Create an accordion layout for the given panel options.\n *\n * @param options Panel options\n * @returns Panel layout\n */\n export function createLayout(\n options: AccordionPanel.IOptions\n ): AccordionLayout {\n return (\n options.layout ||\n new AccordionLayout({\n renderer: options.renderer || AccordionPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing,\n titleSpace: options.titleSpace\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n /**\n * Construct a new box layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: BoxLayout.IOptions = {}) {\n super();\n if (options.direction !== undefined) {\n this._direction = options.direction;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the layout direction for the box layout.\n */\n get direction(): BoxLayout.Direction {\n return this._direction;\n }\n\n /**\n * Set the layout direction for the box layout.\n */\n set direction(value: BoxLayout.Direction) {\n if (this._direction === value) {\n return;\n }\n this._direction = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['direction'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the box layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the box layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['direction'] = this.direction;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Create and add a new sizer for the widget.\n ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Move the sizer for the widget.\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Remove the sizer for the widget.\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Update the fixed space for the visible items.\n this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n // Setup the computed minimum size.\n let horz = Private.isHorizontal(this._direction);\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the size basis and stretch factor.\n sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n sizer.stretch = BoxLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Distribute the layout space and adjust the start position.\n let delta: number;\n switch (this._direction) {\n case 'left-to-right':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n break;\n case 'top-to-bottom':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n break;\n case 'right-to-left':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n left += width;\n break;\n case 'bottom-to-top':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n top += height;\n break;\n default:\n throw 'unreachable';\n }\n\n // Setup the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the computed size for the widget.\n let size = this._sizers[i].size;\n\n // Update the widget geometry and advance the relevant edge.\n switch (this._direction) {\n case 'left-to-right':\n item.update(left + offset, top, size + extra, height);\n left += size + extra + this._spacing;\n break;\n case 'top-to-bottom':\n item.update(left, top + offset, width, size + extra);\n top += size + extra + this._spacing;\n break;\n case 'right-to-left':\n item.update(left - offset - size - extra, top, size + extra, height);\n left -= size + extra + this._spacing;\n break;\n case 'bottom-to-top':\n item.update(left, top - offset - size - extra, width, size + extra);\n top -= size + extra + this._spacing;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: BoxLayout.Alignment = 'start';\n private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n /**\n * A type alias for a box layout direction.\n */\n export type Direction =\n | 'left-to-right'\n | 'right-to-left'\n | 'top-to-bottom'\n | 'bottom-to-top';\n\n /**\n * A type alias for a box layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a box layout.\n */\n export interface IOptions {\n /**\n * The direction of the layout.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * Get the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n\n /**\n * Get the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return Private.sizeBasisProperty.get(widget);\n }\n\n /**\n * Set the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n Private.sizeBasisProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * The property descriptor for a widget size basis.\n */\n export const sizeBasisProperty = new AttachedProperty({\n name: 'sizeBasis',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Test whether a direction has horizontal orientation.\n */\n export function isHorizontal(dir: BoxLayout.Direction): boolean {\n return dir === 'left-to-right' || dir === 'right-to-left';\n }\n\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n export function clampSpacing(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof BoxLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n /**\n * Construct a new box panel.\n *\n * @param options - The options for initializing the box panel.\n */\n constructor(options: BoxPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-BoxPanel');\n }\n\n /**\n * Get the layout direction for the box panel.\n */\n get direction(): BoxPanel.Direction {\n return (this.layout as BoxLayout).direction;\n }\n\n /**\n * Set the layout direction for the box panel.\n */\n set direction(value: BoxPanel.Direction) {\n (this.layout as BoxLayout).direction = value;\n }\n\n /**\n * Get the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxPanel.Alignment {\n return (this.layout as BoxLayout).alignment;\n }\n\n /**\n * Set the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxPanel.Alignment) {\n (this.layout as BoxLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the box panel.\n */\n get spacing(): number {\n return (this.layout as BoxLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the box panel.\n */\n set spacing(value: number) {\n (this.layout as BoxLayout).spacing = value;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-BoxPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-BoxPanel-child');\n }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n /**\n * A type alias for a box panel direction.\n */\n export type Direction = BoxLayout.Direction;\n\n /**\n * A type alias for a box panel alignment.\n */\n export type Alignment = BoxLayout.Alignment;\n\n /**\n * An options object for initializing a box panel.\n */\n export interface IOptions {\n /**\n * The layout direction of the panel.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The box layout to use for the box panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `BoxLayout`.\n */\n layout?: BoxLayout;\n }\n\n /**\n * Get the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return BoxLayout.getStretch(widget);\n }\n\n /**\n * Set the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n BoxLayout.setStretch(widget, value);\n }\n\n /**\n * Get the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return BoxLayout.getSizeBasis(widget);\n }\n\n /**\n * Set the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n BoxLayout.setSizeBasis(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a box layout for the given panel options.\n */\n export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n return options.layout || new BoxLayout(options);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n /**\n * Construct a new command palette.\n *\n * @param options - The options for initializing the palette.\n */\n constructor(options: CommandPalette.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-CommandPalette');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || CommandPalette.defaultRenderer;\n this.commands.commandChanged.connect(this._onGenericChange, this);\n this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._items.length = 0;\n this._results = null;\n super.dispose();\n }\n\n /**\n * The command registry used by the command palette.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the command palette.\n */\n readonly renderer: CommandPalette.IRenderer;\n\n /**\n * The command palette search node.\n *\n * #### Notes\n * This is the node which contains the search-related elements.\n */\n get searchNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-search'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The command palette input node.\n *\n * #### Notes\n * This is the actual input node for the search area.\n */\n get inputNode(): HTMLInputElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-input'\n )[0] as HTMLInputElement;\n }\n\n /**\n * The command palette content node.\n *\n * #### Notes\n * This is the node which holds the command item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * A read-only array of the command items in the palette.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Add a command item to the command palette.\n *\n * @param options - The options for creating the command item.\n *\n * @returns The command item added to the palette.\n */\n addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n // Create a new command item for the options.\n let item = Private.createItem(this.commands, options);\n\n // Add the item to the array.\n this._items.push(item);\n\n // Refresh the search results.\n this.refresh();\n\n // Return the item added to the palette.\n return item;\n }\n\n /**\n * Adds command items to the command palette.\n *\n * @param items - An array of options for creating each command item.\n *\n * @returns The command items added to the palette.\n */\n addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n const newItems = items.map(item => Private.createItem(this.commands, item));\n newItems.forEach(item => this._items.push(item));\n this.refresh();\n return newItems;\n }\n\n /**\n * Remove an item from the command palette.\n *\n * @param item - The item to remove from the palette.\n *\n * #### Notes\n * This is a no-op if the item is not in the palette.\n */\n removeItem(item: CommandPalette.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the command palette.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Remove all items from the command palette.\n */\n clearItems(): void {\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the array of items.\n this._items.length = 0;\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Clear the search results and schedule an update.\n *\n * #### Notes\n * This should be called whenever the search results of the palette\n * should be updated.\n *\n * This is typically called automatically by the palette as needed,\n * but can be called manually if the input text is programatically\n * changed.\n *\n * The rendered results are updated asynchronously.\n */\n refresh(): void {\n this._results = null;\n if (this.inputNode.value !== '') {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'inherit';\n } else {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'none';\n }\n this.update();\n }\n\n /**\n * Handle the DOM events for the command palette.\n *\n * @param event - The DOM event sent to the command palette.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the command palette's DOM node.\n * It should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'input':\n this.refresh();\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('input', this);\n this.node.addEventListener('focus', this, true);\n this.node.addEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('input', this);\n this.node.removeEventListener('focus', this, true);\n this.node.removeEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n */\n protected onAfterShow(msg: Message): void {\n this.update();\n super.onAfterShow(msg);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n let input = this.inputNode;\n input.focus();\n input.select();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.isHidden) {\n return;\n }\n\n // Fetch the current query text and content node.\n let query = this.inputNode.value;\n let contentNode = this.contentNode;\n\n // Ensure the search results are generated.\n let results = this._results;\n if (!results) {\n // Generate and store the new search results.\n results = this._results = Private.search(this._items, query);\n\n // Reset the active index.\n this._activeIndex = query\n ? ArrayExt.findFirstIndex(results, Private.canActivate)\n : -1;\n }\n\n // If there is no query and no results, clear the content.\n if (!query && results.length === 0) {\n VirtualDOM.render(null, contentNode);\n return;\n }\n\n // If the is a query but no results, render the empty message.\n if (query && results.length === 0) {\n let content = this.renderer.renderEmptyMessage({ query });\n VirtualDOM.render(content, contentNode);\n return;\n }\n\n // Create the render content for the search results.\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let content = new Array(results.length);\n for (let i = 0, n = results.length; i < n; ++i) {\n let result = results[i];\n if (result.type === 'header') {\n let indices = result.indices;\n let category = result.category;\n content[i] = renderer.renderHeader({ category, indices });\n } else {\n let item = result.item;\n let indices = result.indices;\n let active = i === activeIndex;\n content[i] = renderer.renderItem({ item, indices, active });\n }\n }\n\n // Render the search result content.\n VirtualDOM.render(content, contentNode);\n\n // Adjust the scroll position as needed.\n if (activeIndex < 0 || activeIndex >= results.length) {\n contentNode.scrollTop = 0;\n } else {\n let element = contentNode.children[activeIndex];\n ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n }\n }\n\n /**\n * Handle the `'click'` event for the command palette.\n */\n private _evtClick(event: MouseEvent): void {\n // Bail if the click is not the left button.\n if (event.button !== 0) {\n return;\n }\n\n // Clear input if the target is clear button\n if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n this.inputNode.value = '';\n this.refresh();\n return;\n }\n\n // Find the index of the item which was clicked.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return node.contains(event.target as HTMLElement);\n });\n\n // Bail if the click was not on an item.\n if (index === -1) {\n return;\n }\n\n // Kill the event when a content item is clicked.\n event.preventDefault();\n event.stopPropagation();\n\n // Execute the item if possible.\n this._execute(index);\n }\n\n /**\n * Handle the `'keydown'` event for the command palette.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n return;\n }\n switch (event.keyCode) {\n case 13: // Enter\n event.preventDefault();\n event.stopPropagation();\n this._execute(this._activeIndex);\n break;\n case 38: // Up Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activatePreviousItem();\n break;\n case 40: // Down Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activateNextItem();\n break;\n }\n }\n\n /**\n * Activate the next enabled command item.\n */\n private _activateNextItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the next enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this._activeIndex = ArrayExt.findFirstIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Activate the previous enabled command item.\n */\n private _activatePreviousItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the previous enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this._activeIndex = ArrayExt.findLastIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Execute the command item at the given index, if possible.\n */\n private _execute(index: number): void {\n // Bail if there are no search results.\n if (!this._results) {\n return;\n }\n\n // Bail if the index is out of range.\n let part = this._results[index];\n if (!part) {\n return;\n }\n\n // Update the search text if the item is a header.\n if (part.type === 'header') {\n let input = this.inputNode;\n input.value = `${part.category.toLowerCase()} `;\n input.focus();\n this.refresh();\n return;\n }\n\n // Bail if item is not enabled.\n if (!part.item.isEnabled) {\n return;\n }\n\n // Execute the item.\n this.commands.execute(part.item.command, part.item.args);\n\n // Clear the query text.\n this.inputNode.value = '';\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Toggle the focused modifier based on the input node focus state.\n */\n private _toggleFocused(): void {\n let focused = document.activeElement === this.inputNode;\n this.toggleClass('lm-mod-focused', focused);\n }\n\n /**\n * A signal handler for generic command changes.\n */\n private _onGenericChange(): void {\n this.refresh();\n }\n\n private _activeIndex = -1;\n private _items: CommandPalette.IItem[] = [];\n private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n /**\n * An options object for creating a command palette.\n */\n export interface IOptions {\n /**\n * The command registry for use with the command palette.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the command palette.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for creating a command item.\n */\n export interface IItemOptions {\n /**\n * The category for the item.\n */\n category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n command: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n *\n * The rank is used as a tie-breaker when ordering command items\n * for display. Items are sorted in the following order:\n * 1. Text match (lower is better)\n * 2. Category (locale order)\n * 3. Rank (lower is better)\n * 4. Label (locale order)\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n\n /**\n * An object which represents an item in a command palette.\n *\n * #### Notes\n * Item objects are created automatically by a command palette.\n */\n export interface IItem {\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n readonly label: string;\n\n /**\n * The display caption for the command item.\n */\n readonly caption: string;\n\n /**\n * The icon renderer for the command item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the command item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the command item.\n */\n readonly iconLabel: string;\n\n /**\n * The extra class name for the command item.\n */\n readonly className: string;\n\n /**\n * The dataset for the command item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the command item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the command item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the command item is toggleable.\n */\n readonly isToggleable: boolean;\n\n /**\n * Whether the command item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the command item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * The render data for a command palette header.\n */\n export interface IHeaderRenderData {\n /**\n * The category of the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched characters in the category.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * The render data for a command palette item.\n */\n export interface IItemRenderData {\n /**\n * The command palette item to render.\n */\n readonly item: IItem;\n\n /**\n * The indices of the matched characters in the label.\n */\n readonly indices: ReadonlyArray | null;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n }\n\n /**\n * The render data for a command palette empty message.\n */\n export interface IEmptyMessageRenderData {\n /**\n * The query which failed to match any commands.\n */\n query: string;\n }\n\n /**\n * A renderer for use with a command palette.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement;\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n *\n * #### Notes\n * The command palette will not render invisible items.\n */\n renderItem(data: IItemRenderData): VirtualElement;\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement {\n let content = this.formatHeader(data);\n return h.li({ className: 'lm-CommandPalette-header' }, content);\n }\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IItemRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n if (data.item.isToggleable) {\n return h.li(\n {\n className,\n dataset,\n role: 'menuitemcheckbox',\n 'aria-checked': `${data.item.isToggled}`\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n return h.li(\n {\n className,\n dataset,\n role: 'menuitem'\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n let content = this.formatEmptyMessage(data);\n return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n }\n\n /**\n * Render the icon for a command palette item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the icon.\n */\n renderItemIcon(data: IItemRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the content for a command palette item.\n *\n * @param data - The data to use for rendering the content.\n *\n * @returns A virtual element representing the content.\n */\n renderItemContent(data: IItemRenderData): VirtualElement {\n return h.div(\n { className: 'lm-CommandPalette-itemContent' },\n this.renderItemLabel(data),\n this.renderItemCaption(data)\n );\n }\n\n /**\n * Render the label for a command palette item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the label.\n */\n renderItemLabel(data: IItemRenderData): VirtualElement {\n let content = this.formatItemLabel(data);\n return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n }\n\n /**\n * Render the caption for a command palette item.\n *\n * @param data - The data to use for rendering the caption.\n *\n * @returns A virtual element representing the caption.\n */\n renderItemCaption(data: IItemRenderData): VirtualElement {\n let content = this.formatItemCaption(data);\n return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n }\n\n /**\n * Render the shortcut for a command palette item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the shortcut.\n */\n renderItemShortcut(data: IItemRenderData): VirtualElement {\n let content = this.formatItemShortcut(data);\n return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n }\n\n /**\n * Create the class name for the command palette item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the command palette item.\n */\n createItemClass(data: IItemRenderData): string {\n // Set up the initial class name.\n let name = 'lm-CommandPalette-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the command palette item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the command palette item.\n */\n createItemDataset(data: IItemRenderData): ElementDataset {\n return { ...data.item.dataset, command: data.item.command };\n }\n\n /**\n * Create the class name for the command item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IItemRenderData): string {\n let name = 'lm-CommandPalette-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the header node.\n *\n * @param data - The data to use for the header content.\n *\n * @returns The content to add to the header node.\n */\n formatHeader(data: IHeaderRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.category;\n }\n return StringExt.highlight(data.category, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the empty message node.\n *\n * @param data - The data to use for the empty message content.\n *\n * @returns The content to add to the empty message node.\n */\n formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n return `No commands found that match '${data.query}'`;\n }\n\n /**\n * Create the render content for the item shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatItemShortcut(data: IItemRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n\n /**\n * Create the render content for the item label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatItemLabel(data: IItemRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.item.label;\n }\n return StringExt.highlight(data.item.label, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the item caption node.\n *\n * @param data - The data to use for the caption content.\n *\n * @returns The content to add to the caption node.\n */\n formatItemCaption(data: IItemRenderData): h.Child {\n return data.item.caption;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a command palette.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let search = document.createElement('div');\n let wrapper = document.createElement('div');\n let input = document.createElement('input');\n let content = document.createElement('ul');\n let clear = document.createElement('button');\n search.className = 'lm-CommandPalette-search';\n wrapper.className = 'lm-CommandPalette-wrapper';\n input.className = 'lm-CommandPalette-input';\n clear.className = 'lm-close-icon';\n\n content.className = 'lm-CommandPalette-content';\n content.setAttribute('role', 'menu');\n input.spellcheck = false;\n wrapper.appendChild(input);\n wrapper.appendChild(clear);\n search.appendChild(wrapper);\n node.appendChild(search);\n node.appendChild(content);\n return node;\n }\n\n /**\n * Create a new command item from a command registry and options.\n */\n export function createItem(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ): CommandPalette.IItem {\n return new CommandItem(commands, options);\n }\n\n /**\n * A search result object for a header label.\n */\n export interface IHeaderResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'header';\n\n /**\n * The category for the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched category characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A search result object for a command item.\n */\n export interface IItemResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'item';\n\n /**\n * The command item which was matched.\n */\n readonly item: CommandPalette.IItem;\n\n /**\n * The indices of the matched label characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A type alias for a search result item.\n */\n export type SearchResult = IHeaderResult | IItemResult;\n\n /**\n * Search an array of command items for fuzzy matches.\n */\n export function search(\n items: CommandPalette.IItem[],\n query: string\n ): SearchResult[] {\n // Fuzzy match the items for the query.\n let scores = matchItems(items, query);\n\n // Sort the items based on their score.\n scores.sort(scoreCmp);\n\n // Create the results for the search.\n return createResults(scores);\n }\n\n /**\n * Test whether a result item can be activated.\n */\n export function canActivate(result: SearchResult): boolean {\n return result.type === 'item' && result.item.isEnabled;\n }\n\n /**\n * Normalize a category for a command item.\n */\n function normalizeCategory(category: string): string {\n return category.trim().replace(/\\s+/g, ' ');\n }\n\n /**\n * Normalize the query text for a fuzzy search.\n */\n function normalizeQuery(text: string): string {\n return text.replace(/\\s+/g, '').toLowerCase();\n }\n\n /**\n * An enum of the supported match types.\n */\n const enum MatchType {\n Label,\n Category,\n Split,\n Default\n }\n\n /**\n * A text match score with associated command item.\n */\n interface IScore {\n /**\n * The numerical type for the text match.\n */\n matchType: MatchType;\n\n /**\n * The numerical score for the text match.\n */\n score: number;\n\n /**\n * The indices of the matched category characters.\n */\n categoryIndices: number[] | null;\n\n /**\n * The indices of the matched label characters.\n */\n labelIndices: number[] | null;\n\n /**\n * The command item associated with the match.\n */\n item: CommandPalette.IItem;\n }\n\n /**\n * Perform a fuzzy match on an array of command items.\n */\n function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n // Normalize the query text to lower case with no whitespace.\n query = normalizeQuery(query);\n\n // Create the array to hold the scores.\n let scores: IScore[] = [];\n\n // Iterate over the items and match against the query.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Ignore items which are not visible.\n let item = items[i];\n if (!item.isVisible) {\n continue;\n }\n\n // If the query is empty, all items are matched by default.\n if (!query) {\n scores.push({\n matchType: MatchType.Default,\n categoryIndices: null,\n labelIndices: null,\n score: 0,\n item\n });\n continue;\n }\n\n // Run the fuzzy search for the item and query.\n let score = fuzzySearch(item, query);\n\n // Ignore the item if it is not a match.\n if (!score) {\n continue;\n }\n\n // Penalize disabled items.\n // TODO - push disabled items all the way down in sort cmp?\n if (!item.isEnabled) {\n score.score += 1000;\n }\n\n // Add the score to the results.\n scores.push(score);\n }\n\n // Return the final array of scores.\n return scores;\n }\n\n /**\n * Perform a fuzzy search on a single command item.\n */\n function fuzzySearch(\n item: CommandPalette.IItem,\n query: string\n ): IScore | null {\n // Create the source text to be searched.\n let category = item.category.toLowerCase();\n let label = item.label.toLowerCase();\n let source = `${category} ${label}`;\n\n // Set up the match score and indices array.\n let score = Infinity;\n let indices: number[] | null = null;\n\n // The regex for search word boundaries\n let rgx = /\\b\\w/g;\n\n // Search the source by word boundary.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Find the next word boundary in the source.\n let rgxMatch = rgx.exec(source);\n\n // Break if there is no more source context.\n if (!rgxMatch) {\n break;\n }\n\n // Run the string match on the relevant substring.\n let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n // Break if there is no match.\n if (!match) {\n break;\n }\n\n // Update the match if the score is better.\n if (match.score <= score) {\n score = match.score;\n indices = match.indices;\n }\n }\n\n // Bail if there was no match.\n if (!indices || score === Infinity) {\n return null;\n }\n\n // Compute the pivot index between category and label text.\n let pivot = category.length + 1;\n\n // Find the slice index to separate matched indices.\n let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n // Extract the matched category and label indices.\n let categoryIndices = indices.slice(0, j);\n let labelIndices = indices.slice(j);\n\n // Adjust the label indices for the pivot offset.\n for (let i = 0, n = labelIndices.length; i < n; ++i) {\n labelIndices[i] -= pivot;\n }\n\n // Handle a pure label match.\n if (categoryIndices.length === 0) {\n return {\n matchType: MatchType.Label,\n categoryIndices: null,\n labelIndices,\n score,\n item\n };\n }\n\n // Handle a pure category match.\n if (labelIndices.length === 0) {\n return {\n matchType: MatchType.Category,\n categoryIndices,\n labelIndices: null,\n score,\n item\n };\n }\n\n // Handle a split match.\n return {\n matchType: MatchType.Split,\n categoryIndices,\n labelIndices,\n score,\n item\n };\n }\n\n /**\n * A sort comparison function for a match score.\n */\n function scoreCmp(a: IScore, b: IScore): number {\n // First compare based on the match type\n let m1 = a.matchType - b.matchType;\n if (m1 !== 0) {\n return m1;\n }\n\n // Otherwise, compare based on the match score.\n let d1 = a.score - b.score;\n if (d1 !== 0) {\n return d1;\n }\n\n // Find the match index based on the match type.\n let i1 = 0;\n let i2 = 0;\n switch (a.matchType) {\n case MatchType.Label:\n i1 = a.labelIndices![0];\n i2 = b.labelIndices![0];\n break;\n case MatchType.Category:\n case MatchType.Split:\n i1 = a.categoryIndices![0];\n i2 = b.categoryIndices![0];\n break;\n }\n\n // Compare based on the match index.\n if (i1 !== i2) {\n return i1 - i2;\n }\n\n // Otherwise, compare by category.\n let d2 = a.item.category.localeCompare(b.item.category);\n if (d2 !== 0) {\n return d2;\n }\n\n // Otherwise, compare by rank.\n let r1 = a.item.rank;\n let r2 = b.item.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity safe\n }\n\n // Finally, compare by label.\n return a.item.label.localeCompare(b.item.label);\n }\n\n /**\n * Create the results from an array of sorted scores.\n */\n function createResults(scores: IScore[]): SearchResult[] {\n // Set up the search results array.\n let results: SearchResult[] = [];\n\n // Iterate over each score in the array.\n for (let i = 0, n = scores.length; i < n; ++i) {\n // Extract the current item and indices.\n let { item, categoryIndices, labelIndices } = scores[i];\n\n // Extract the category for the current item.\n let category = item.category;\n\n // Is this the same category as the preceding result?\n if (i === 0 || category !== scores[i - 1].item.category) {\n // Add the header result for the category.\n results.push({ type: 'header', category, indices: categoryIndices });\n }\n\n // Create the item result for the score.\n results.push({ type: 'item', item, indices: labelIndices });\n }\n\n // Return the final results.\n return results;\n }\n\n /**\n * A concrete implementation of `CommandPalette.IItem`.\n */\n class CommandItem implements CommandPalette.IItem {\n /**\n * Construct a new command item.\n */\n constructor(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ) {\n this._commands = commands;\n this.category = normalizeCategory(options.category);\n this.command = options.command;\n this.args = options.args || JSONExt.emptyObject;\n this.rank = options.rank !== undefined ? options.rank : Infinity;\n }\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n get label(): string {\n return this._commands.label(this.command, this.args);\n }\n\n /**\n * The icon renderer for the command item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._commands.icon(this.command, this.args);\n }\n\n /**\n * The icon class for the command item.\n */\n get iconClass(): string {\n return this._commands.iconClass(this.command, this.args);\n }\n\n /**\n * The icon label for the command item.\n */\n get iconLabel(): string {\n return this._commands.iconLabel(this.command, this.args);\n }\n\n /**\n * The display caption for the command item.\n */\n get caption(): string {\n return this._commands.caption(this.command, this.args);\n }\n\n /**\n * The extra class name for the command item.\n */\n get className(): string {\n return this._commands.className(this.command, this.args);\n }\n\n /**\n * The dataset for the command item.\n */\n get dataset(): CommandRegistry.Dataset {\n return this._commands.dataset(this.command, this.args);\n }\n\n /**\n * Whether the command item is enabled.\n */\n get isEnabled(): boolean {\n return this._commands.isEnabled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggled.\n */\n get isToggled(): boolean {\n return this._commands.isToggled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggleable.\n */\n get isToggleable(): boolean {\n return this._commands.isToggleable(this.command, this.args);\n }\n\n /**\n * Whether the command item is visible.\n */\n get isVisible(): boolean {\n return this._commands.isVisible(this.command, this.args);\n }\n\n /**\n * The key binding for the command item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ARIAAttrNames,\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n pageXOffset: number;\n pageYOffset: number;\n clientWidth: number;\n clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n /**\n * Construct a new menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: Menu.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-Menu');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || Menu.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the menu.\n */\n dispose(): void {\n this.close();\n this._items.length = 0;\n super.dispose();\n }\n\n /**\n * A signal emitted just before the menu is closed.\n *\n * #### Notes\n * This signal is emitted when the menu receives a `'close-request'`\n * message, just before it removes itself from the DOM.\n *\n * This signal is not emitted if the menu is already detached from\n * the DOM when it receives the `'close-request'` message.\n */\n get aboutToClose(): ISignal {\n return this._aboutToClose;\n }\n\n /**\n * A signal emitted when a new menu is requested by the user.\n *\n * #### Notes\n * This signal is emitted whenever the user presses the right or left\n * arrow keys, and a submenu cannot be opened or closed in response.\n *\n * This signal is useful when implementing menu bars in order to open\n * the next or previous menu in response to a user key press.\n *\n * This signal is only emitted for the root menu in a hierarchy.\n */\n get menuRequested(): ISignal {\n return this._menuRequested;\n }\n\n /**\n * The command registry used by the menu.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the menu.\n */\n readonly renderer: Menu.IRenderer;\n\n /**\n * The parent menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu is an open submenu.\n */\n get parentMenu(): Menu | null {\n return this._parentMenu;\n }\n\n /**\n * The child menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu has an open submenu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The root menu of the menu hierarchy.\n */\n get rootMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._parentMenu) {\n menu = menu._parentMenu;\n }\n return menu;\n }\n\n /**\n * The leaf menu of the menu hierarchy.\n */\n get leafMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._childMenu) {\n menu = menu._childMenu;\n }\n return menu;\n }\n\n /**\n * The menu content node.\n *\n * #### Notes\n * This is the node which holds the menu item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-Menu-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu item.\n */\n get activeItem(): Menu.IItem | null {\n return this._items[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the item will be set to `null`.\n */\n set activeItem(value: Menu.IItem | null) {\n this.activeIndex = value ? this._items.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu item.\n *\n * #### Notes\n * This will be `-1` if no menu item is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._items.length) {\n value = -1;\n }\n\n // Ensure the item can be activated.\n if (value !== -1 && !Private.canActivate(this._items[value])) {\n value = -1;\n }\n\n // Bail if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Make active element in focus\n if (\n this._activeIndex >= 0 &&\n this.contentNode.childNodes[this._activeIndex]\n ) {\n (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n }\n\n // schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menu items in the menu.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Activate the next selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activateNextItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this.activeIndex = ArrayExt.findFirstIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Activate the previous selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activatePreviousItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this.activeIndex = ArrayExt.findLastIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Trigger the active menu item.\n *\n * #### Notes\n * If the active item is a submenu, it will be opened and the first\n * item will be activated.\n *\n * If the active item is a command, the command will be executed.\n *\n * If the menu is not attached, this is a no-op.\n *\n * If there is no active item, this is a no-op.\n */\n triggerActiveItem(): void {\n // Bail if the menu is not attached.\n if (!this.isAttached) {\n return;\n }\n\n // Bail if there is no active item.\n let item = this.activeItem;\n if (!item) {\n return;\n }\n\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // If the item is a submenu, open it.\n if (item.type === 'submenu') {\n this._openChildMenu(true);\n return;\n }\n\n // Close the root menu before executing the command.\n this.rootMenu.close();\n\n // Execute the command for the item.\n let { command, args } = item;\n if (this.commands.isEnabled(command, args)) {\n this.commands.execute(command, args);\n } else {\n console.log(`Command '${command}' is disabled.`);\n }\n }\n\n /**\n * Add a menu item to the end of the menu.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n */\n addItem(options: Menu.IItemOptions): Menu.IItem {\n return this.insertItem(this._items.length, options);\n }\n\n /**\n * Insert a menu item into the menu at the specified index.\n *\n * @param index - The index at which to insert the item.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n *\n * #### Notes\n * The index will be clamped to the bounds of the items.\n */\n insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Clamp the insert index to the array bounds.\n let i = Math.max(0, Math.min(index, this._items.length));\n\n // Create the item for the options.\n let item = Private.createItem(this, options);\n\n // Insert the item into the array.\n ArrayExt.insert(this._items, i, item);\n\n // Schedule an update of the items.\n this.update();\n\n // Return the item added to the menu.\n return item;\n }\n\n /**\n * Remove an item from the menu.\n *\n * @param item - The item to remove from the menu.\n *\n * #### Notes\n * This is a no-op if the item is not in the menu.\n */\n removeItem(item: Menu.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the menu.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Remove all menu items from the menu.\n */\n clearItems(): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the items.\n this._items.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Open the menu at the specified location.\n *\n * @param x - The client X coordinate of the menu location.\n *\n * @param y - The client Y coordinate of the menu location.\n *\n * @param options - The additional options for opening the menu.\n *\n * #### Notes\n * The menu will be opened at the given location unless it will not\n * fully fit on the screen. If it will not fit, it will be adjusted\n * to fit naturally on the screen.\n *\n * The menu will be attached under the `host` element in the DOM\n * (or `document.body` if `host` is `null`) and before the `ref`\n * element (or as the last child of `host` if `ref` is `null`).\n * The menu may be displayed outside of the `host` element\n * following the rules of CSS absolute positioning.\n *\n * This is a no-op if the menu is already attached to the DOM.\n */\n open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n // Bail early if the menu is already attached.\n if (this.isAttached) {\n return;\n }\n\n // Extract the menu options.\n let forceX = options.forceX || false;\n let forceY = options.forceY || false;\n const host = options.host ?? null;\n const ref = options.ref ?? null;\n\n // Open the menu as a root menu.\n Private.openRootMenu(this, x, y, forceX, forceY, host, ref);\n\n // Activate the menu to accept keyboard input.\n this.activate();\n }\n\n /**\n * Handle the DOM events for the menu.\n *\n * @param event - The DOM event sent to the menu.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu's DOM nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseenter':\n this._evtMouseEnter(event as MouseEvent);\n break;\n case 'mouseleave':\n this._evtMouseLeave(event as MouseEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mouseup', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseenter', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('contextmenu', this);\n this.node.ownerDocument.addEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mouseup', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseenter', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('contextmenu', this);\n this.node.ownerDocument.removeEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this.node.focus();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let items = this._items;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let collapsedFlags = Private.computeCollapsed(items);\n let content = new Array(items.length);\n for (let i = 0, n = items.length; i < n; ++i) {\n let item = items[i];\n let active = i === activeIndex;\n let collapsed = collapsedFlags[i];\n content[i] = renderer.renderItem({\n item,\n active,\n collapsed,\n onfocus: () => {\n this.activeIndex = i;\n }\n });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n */\n protected onCloseRequest(msg: Message): void {\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Close any open child menu.\n let childMenu = this._childMenu;\n if (childMenu) {\n this._childIndex = -1;\n this._childMenu = null;\n childMenu._parentMenu = null;\n childMenu.close();\n }\n\n // Remove this menu from its parent and activate the parent.\n let parentMenu = this._parentMenu;\n if (parentMenu) {\n this._parentMenu = null;\n parentMenu._childIndex = -1;\n parentMenu._childMenu = null;\n parentMenu.activate();\n }\n\n // Emit the `aboutToClose` signal if the menu is attached.\n if (this.isAttached) {\n this._aboutToClose.emit(undefined);\n }\n\n // Finish closing the menu.\n super.onCloseRequest(msg);\n }\n\n /**\n * Handle the `'keydown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // A menu handles all keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Enter\n if (kc === 13) {\n this.triggerActiveItem();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this.close();\n return;\n }\n\n // Left Arrow\n if (kc === 37) {\n if (this._parentMenu) {\n this.close();\n } else {\n this._menuRequested.emit('previous');\n }\n return;\n }\n\n // Up Arrow\n if (kc === 38) {\n this.activatePreviousItem();\n return;\n }\n\n // Right Arrow\n if (kc === 39) {\n let item = this.activeItem;\n if (item && item.type === 'submenu') {\n this.triggerActiveItem();\n } else {\n this.rootMenu._menuRequested.emit('next');\n }\n return;\n }\n\n // Down Arrow\n if (kc === 40) {\n this.activateNextItem();\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._items, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that item is triggered.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.triggerActiveItem();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n }\n }\n\n /**\n * Handle the `'mouseup'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseUp(event: MouseEvent): void {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.triggerActiveItem();\n }\n\n /**\n * Handle the `'mousemove'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Hit test the item nodes for the item under the mouse.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the mouse is already over the active index.\n if (index === this._activeIndex) {\n return;\n }\n\n // Update and coerce the active index.\n this.activeIndex = index;\n index = this.activeIndex;\n\n // If the index is the current child index, cancel the timers.\n if (index === this._childIndex) {\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n return;\n }\n\n // If a child menu is currently open, start the close timer.\n if (this._childIndex !== -1) {\n this._startCloseTimer();\n }\n\n // Cancel the open timer to give a full delay for opening.\n this._cancelOpenTimer();\n\n // Bail if the active item is not a valid submenu item.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n return;\n }\n\n // Start the open timer to open the active item submenu.\n this._startOpenTimer();\n }\n\n /**\n * Handle the `'mouseenter'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseEnter(event: MouseEvent): void {\n // Synchronize the active ancestor items.\n for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n menu._cancelOpenTimer();\n menu._cancelCloseTimer();\n menu.activeIndex = menu._childIndex;\n }\n }\n\n /**\n * Handle the `'mouseleave'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseLeave(event: MouseEvent): void {\n // Cancel any pending submenu opening.\n this._cancelOpenTimer();\n\n // If there is no open child menu, just reset the active index.\n if (!this._childMenu) {\n this.activeIndex = -1;\n return;\n }\n\n // If the mouse is over the child menu, cancel the close timer.\n let { clientX, clientY } = event;\n if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n this._cancelCloseTimer();\n return;\n }\n\n // Otherwise, reset the active index and start the close timer.\n this.activeIndex = -1;\n this._startCloseTimer();\n }\n\n /**\n * Handle the `'mousedown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the document node.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the menu is not a root menu.\n if (this._parentMenu) {\n return;\n }\n\n // The mouse button which is pressed is irrelevant. If the press\n // is not on a menu, the entire hierarchy is closed and the event\n // is allowed to propagate. This allows other code to act on the\n // event, such as focusing the clicked element.\n if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n event.preventDefault();\n event.stopPropagation();\n } else {\n this.close();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if the active item is not a valid submenu.\n */\n private _openChildMenu(activateFirst = false): void {\n // If the item is not a valid submenu, close the child menu.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n this._closeChildMenu();\n return;\n }\n\n // Do nothing if the child menu will not change.\n let submenu = item.submenu;\n if (submenu === this._childMenu) {\n return;\n }\n\n // Prior to any DOM modifications save window data\n Menu.saveWindowData();\n\n // Ensure the current child menu is closed.\n this._closeChildMenu();\n\n // Update the private child state.\n this._childMenu = submenu;\n this._childIndex = this._activeIndex;\n\n // Set the parent menu reference for the child.\n submenu._parentMenu = this;\n\n // Ensure the menu is updated and lookup the item node.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n let itemNode = this.contentNode.children[this._activeIndex];\n\n // Open the submenu at the active node.\n Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n // Activate the first item if desired.\n if (activateFirst) {\n submenu.activeIndex = -1;\n submenu.activateNextItem();\n }\n\n // Activate the child menu.\n submenu.activate();\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n if (this._childMenu) {\n this._childMenu.close();\n }\n }\n\n /**\n * Start the open timer, unless it is already pending.\n */\n private _startOpenTimer(): void {\n if (this._openTimerID === 0) {\n this._openTimerID = window.setTimeout(() => {\n this._openTimerID = 0;\n this._openChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Start the close timer, unless it is already pending.\n */\n private _startCloseTimer(): void {\n if (this._closeTimerID === 0) {\n this._closeTimerID = window.setTimeout(() => {\n this._closeTimerID = 0;\n this._closeChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Cancel the open timer, if the timer is pending.\n */\n private _cancelOpenTimer(): void {\n if (this._openTimerID !== 0) {\n clearTimeout(this._openTimerID);\n this._openTimerID = 0;\n }\n }\n\n /**\n * Cancel the close timer, if the timer is pending.\n */\n private _cancelCloseTimer(): void {\n if (this._closeTimerID !== 0) {\n clearTimeout(this._closeTimerID);\n this._closeTimerID = 0;\n }\n }\n\n /**\n * Save window data used for menu positioning in transient cache.\n *\n * In order to avoid layout trashing it is recommended to invoke this\n * method immediately prior to opening the menu and any DOM modifications\n * (like closing previously visible menu, or adding a class to menu widget).\n *\n * The transient cache will be released upon `open()` call.\n */\n static saveWindowData(): void {\n Private.saveWindowData();\n }\n\n private _childIndex = -1;\n private _activeIndex = -1;\n private _openTimerID = 0;\n private _closeTimerID = 0;\n private _items: Menu.IItem[] = [];\n private _childMenu: Menu | null = null;\n private _parentMenu: Menu | null = null;\n private _aboutToClose = new Signal(this);\n private _menuRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n /**\n * An options object for creating a menu.\n */\n export interface IOptions {\n /**\n * The command registry for use with the menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the menu.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for the `open` method on a menu.\n */\n export interface IOpenOptions {\n /**\n * Whether to force the X position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * X coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceX?: boolean;\n\n /**\n * Whether to force the Y position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * Y coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceY?: boolean;\n\n /**\n * The DOM node to use as the menu's host.\n *\n * If not specified then uses `document.body`.\n */\n host?: HTMLElement;\n\n /**\n * The child of `host` to use as the reference element.\n * If this is provided, the menu will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * menu to be added as the last child of the host.\n */\n ref?: HTMLElement;\n }\n\n /**\n * A type alias for a menu item type.\n */\n export type ItemType = 'command' | 'submenu' | 'separator';\n\n /**\n * An options object for creating a menu item.\n */\n export interface IItemOptions {\n /**\n * The type of the menu item.\n *\n * The default value is `'command'`.\n */\n type?: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n *\n * The default value is an empty string.\n */\n command?: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n *\n * The default value is `null`.\n */\n submenu?: Menu | null;\n }\n\n /**\n * An object which represents a menu item.\n *\n * #### Notes\n * Item objects are created automatically by a menu.\n */\n export interface IItem {\n /**\n * The type of the menu item.\n */\n readonly type: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n readonly label: string;\n\n /**\n * The mnemonic index for the menu item.\n */\n readonly mnemonic: number;\n\n /**\n * The icon renderer for the menu item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the menu item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the menu item.\n */\n readonly iconLabel: string;\n\n /**\n * The display caption for the menu item.\n */\n readonly caption: string;\n\n /**\n * The extra class name for the menu item.\n */\n readonly className: string;\n\n /**\n * The dataset for the menu item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the menu item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the menu item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the menu item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the menu item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * An object which holds the data to render a menu item.\n */\n export interface IRenderData {\n /**\n * The item to be rendered.\n */\n readonly item: IItem;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the item should be collapsed.\n */\n readonly collapsed: boolean;\n\n /**\n * Handler for when element is in focus.\n */\n readonly onfocus?: () => void;\n }\n\n /**\n * A renderer for use with a menu.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n tabindex: '0',\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderShortcut(data),\n this.renderSubmenu(data)\n );\n }\n\n /**\n * Render the icon element for a menu item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-Menu-itemLabel' }, content);\n }\n\n /**\n * Render the shortcut element for a menu item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the item shortcut.\n */\n renderShortcut(data: IRenderData): VirtualElement {\n let content = this.formatShortcut(data);\n return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n }\n\n /**\n * Render the submenu icon element for a menu item.\n *\n * @param data - The data to use for rendering the submenu icon.\n *\n * @returns A virtual element representing the submenu icon.\n */\n renderSubmenu(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n }\n\n /**\n * Create the class name for the menu item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n // Setup the initial class name.\n let name = 'lm-Menu-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (!data.item.isVisible) {\n name += ' lm-mod-hidden';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n if (data.collapsed) {\n name += ' lm-mod-collapsed';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the menu item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the menu item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n let result: ElementDataset;\n let { type, command, dataset } = data.item;\n if (type === 'command') {\n result = { ...dataset, type, command };\n } else {\n result = { ...dataset, type };\n }\n return result;\n }\n\n /**\n * Create the class name for the menu item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-Menu-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the aria attributes for menu item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n let aria: { [T in ARIAAttrNames]?: string } = {};\n switch (data.item.type) {\n case 'separator':\n aria.role = 'presentation';\n break;\n case 'submenu':\n aria['aria-haspopup'] = 'true';\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n break;\n default:\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n aria.role = 'menuitem';\n }\n return aria;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.item;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n\n /**\n * Create the render content for the shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatShortcut(data: IRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The ms delay for opening and closing a submenu.\n */\n export const TIMER_DELAY = 300;\n\n /**\n * The horizontal pixel overlap for an open submenu.\n */\n export const SUBMENU_OVERLAP = 3;\n\n let transientWindowDataCache: IWindowData | null = null;\n let transientCacheCounter: number = 0;\n\n function getWindowData(): IWindowData {\n // if transient cache is in use, take one from it\n if (transientCacheCounter > 0) {\n transientCacheCounter--;\n return transientWindowDataCache!;\n }\n return _getWindowData();\n }\n\n /**\n * Store window data in transient cache.\n *\n * The transient cache will be released upon `getWindowData()` call.\n * If this function is called multiple times, the cache will be\n * retained until as many calls to `getWindowData()` were made.\n *\n * Note: should be called before any DOM modifications.\n */\n export function saveWindowData(): void {\n transientWindowDataCache = _getWindowData();\n transientCacheCounter++;\n }\n\n /**\n * Create the DOM node for a menu.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-Menu-content';\n node.appendChild(content);\n content.setAttribute('role', 'menu');\n node.tabIndex = 0;\n return node;\n }\n\n /**\n * Test whether a menu item can be activated.\n */\n export function canActivate(item: Menu.IItem): boolean {\n return item.type !== 'separator' && item.isEnabled && item.isVisible;\n }\n\n /**\n * Create a new menu item for an owner menu.\n */\n export function createItem(\n owner: Menu,\n options: Menu.IItemOptions\n ): Menu.IItem {\n return new MenuItem(owner.commands, options);\n }\n\n /**\n * Hit test a menu hierarchy starting at the given root.\n */\n export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n if (ElementExt.hitTest(temp.node, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Compute which extra separator items should be collapsed.\n */\n export function computeCollapsed(\n items: ReadonlyArray\n ): boolean[] {\n // Allocate the return array and fill it with `false`.\n let result = new Array(items.length);\n ArrayExt.fill(result, false);\n\n // Collapse the leading separators.\n let k1 = 0;\n let n = items.length;\n for (; k1 < n; ++k1) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k1] = true;\n }\n\n // Hide the trailing separators.\n let k2 = n - 1;\n for (; k2 >= 0; --k2) {\n let item = items[k2];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k2] = true;\n }\n\n // Hide the remaining consecutive separators.\n let hide = false;\n while (++k1 < k2) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n hide = false;\n } else if (hide) {\n result[k1] = true;\n } else {\n hide = true;\n }\n }\n\n // Return the resulting flags.\n return result;\n }\n\n function _getWindowData(): IWindowData {\n return {\n pageXOffset: window.pageXOffset,\n pageYOffset: window.pageYOffset,\n clientWidth: document.documentElement.clientWidth,\n clientHeight: document.documentElement.clientHeight\n };\n }\n\n /**\n * Open a menu as a root menu at the target location.\n */\n export function openRootMenu(\n menu: Menu,\n x: number,\n y: number,\n forceX: boolean,\n forceY: boolean,\n host: HTMLElement | null,\n ref: HTMLElement | null\n ): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before attaching and measuring.\n MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch - (forceY ? y : 0);\n\n // Fetch common variables.\n let node = menu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(menu, host || document.body, ref);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Adjust the X position of the menu to fit on-screen.\n if (!forceX && x + width > px + cw) {\n x = px + cw - width;\n }\n\n // Adjust the Y position of the menu to fit on-screen.\n if (!forceY && y + height > py + ch) {\n if (y > py + ch) {\n y = py + ch - height;\n } else {\n y = y - height;\n }\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * Open a menu as a submenu using an item node for positioning.\n */\n export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before opening.\n MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch;\n\n // Fetch common variables.\n let node = submenu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(submenu, itemNode.ownerDocument.body);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Compute the box sizing for the menu.\n let box = ElementExt.boxSizing(submenu.node);\n\n // Get the bounding rect for the target item node.\n let itemRect = itemNode.getBoundingClientRect();\n\n // Compute the target X position.\n let x = itemRect.right - SUBMENU_OVERLAP;\n\n // Adjust the X position to fit on the screen.\n if (x + width > px + cw) {\n x = itemRect.left + SUBMENU_OVERLAP - width;\n }\n\n // Compute the target Y position.\n let y = itemRect.top - box.borderTop - box.paddingTop;\n\n // Adjust the Y position to fit on the screen.\n if (y + height > py + ch) {\n y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n items: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Lookup the item\n let item = items[k];\n\n // Ignore items which cannot be activated.\n if (!canActivate(item)) {\n continue;\n }\n\n // Ignore items with an empty label.\n let label = item.label;\n if (label.length === 0) {\n continue;\n }\n\n // Lookup the mnemonic index for the label.\n let mn = item.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < label.length) {\n if (label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n\n /**\n * A concrete implementation of `Menu.IItem`.\n */\n class MenuItem implements Menu.IItem {\n /**\n * Construct a new menu item.\n */\n constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n this._commands = commands;\n this.type = options.type || 'command';\n this.command = options.command || '';\n this.args = options.args || JSONExt.emptyObject;\n this.submenu = options.submenu || null;\n }\n\n /**\n * The type of the menu item.\n */\n readonly type: Menu.ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n get label(): string {\n if (this.type === 'command') {\n return this._commands.label(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.label;\n }\n return '';\n }\n\n /**\n * The mnemonic index for the menu item.\n */\n get mnemonic(): number {\n if (this.type === 'command') {\n return this._commands.mnemonic(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.mnemonic;\n }\n return -1;\n }\n\n /**\n * The icon renderer for the menu item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n if (this.type === 'command') {\n return this._commands.icon(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.icon;\n }\n return undefined;\n }\n\n /**\n * The icon class for the menu item.\n */\n get iconClass(): string {\n if (this.type === 'command') {\n return this._commands.iconClass(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconClass;\n }\n return '';\n }\n\n /**\n * The icon label for the menu item.\n */\n get iconLabel(): string {\n if (this.type === 'command') {\n return this._commands.iconLabel(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconLabel;\n }\n return '';\n }\n\n /**\n * The display caption for the menu item.\n */\n get caption(): string {\n if (this.type === 'command') {\n return this._commands.caption(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.caption;\n }\n return '';\n }\n\n /**\n * The extra class name for the menu item.\n */\n get className(): string {\n if (this.type === 'command') {\n return this._commands.className(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.className;\n }\n return '';\n }\n\n /**\n * The dataset for the menu item.\n */\n get dataset(): CommandRegistry.Dataset {\n if (this.type === 'command') {\n return this._commands.dataset(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.dataset;\n }\n return {};\n }\n\n /**\n * Whether the menu item is enabled.\n */\n get isEnabled(): boolean {\n if (this.type === 'command') {\n return this._commands.isEnabled(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * Whether the menu item is toggled.\n */\n get isToggled(): boolean {\n if (this.type === 'command') {\n return this._commands.isToggled(this.command, this.args);\n }\n return false;\n }\n\n /**\n * Whether the menu item is visible.\n */\n get isVisible(): boolean {\n if (this.type === 'command') {\n return this._commands.isVisible(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * The key binding for the menu item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n if (this.type === 'command') {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n return null;\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n /**\n * Construct a new context menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: ContextMenu.IOptions) {\n const { groupByTarget, sortBySelector, ...others } = options;\n this.menu = new Menu(others);\n this._groupByTarget = groupByTarget !== false;\n this._sortBySelector = sortBySelector !== false;\n }\n\n /**\n * The menu widget which displays the matched context items.\n */\n readonly menu: Menu;\n\n /**\n * Add an item to the context menu.\n *\n * @param options - The options for creating the item.\n *\n * @returns A disposable which will remove the item from the menu.\n */\n addItem(options: ContextMenu.IItemOptions): IDisposable {\n // Create an item from the given options.\n let item = Private.createItem(options, this._idTick++);\n\n // Add the item to the internal array.\n this._items.push(item);\n\n // Return a disposable which will remove the item.\n return new DisposableDelegate(() => {\n ArrayExt.removeFirstOf(this._items, item);\n });\n }\n\n /**\n * Open the context menu in response to a `'contextmenu'` event.\n *\n * @param event - The `'contextmenu'` event of interest.\n *\n * @returns `true` if the menu was opened, or `false` if no items\n * matched the event and the menu was not opened.\n *\n * #### Notes\n * This method will populate the context menu with items which match\n * the propagation path of the event, then open the menu at the mouse\n * position indicated by the event.\n */\n open(event: MouseEvent): boolean {\n // Prior to any DOM modifications update the window data.\n Menu.saveWindowData();\n\n // Clear the current contents of the context menu.\n this.menu.clearItems();\n\n // Bail early if there are no items to match.\n if (this._items.length === 0) {\n return false;\n }\n\n // Find the matching items for the event.\n let items = Private.matchItems(\n this._items,\n event,\n this._groupByTarget,\n this._sortBySelector\n );\n\n // Bail if there are no matching items.\n if (!items || items.length === 0) {\n return false;\n }\n\n // Add the filtered items to the menu.\n for (const item of items) {\n this.menu.addItem(item);\n }\n\n // Open the context menu at the current mouse position.\n this.menu.open(event.clientX, event.clientY);\n\n // Indicate success.\n return true;\n }\n\n private _groupByTarget: boolean = true;\n private _idTick = 0;\n private _items: Private.IItem[] = [];\n private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n /**\n * An options object for initializing a context menu.\n */\n export interface IOptions {\n /**\n * The command registry to use with the context menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the context menu.\n */\n renderer?: Menu.IRenderer;\n\n /**\n * Whether to sort by selector and rank or only rank.\n *\n * Default true.\n */\n sortBySelector?: boolean;\n\n /**\n * Whether to group items following the DOM hierarchy.\n *\n * Default true.\n *\n * #### Note\n * If true, when the mouse event occurs on element `span` within `div.top`,\n * the items matching `div.top` will be shown before the ones matching `body`.\n */\n groupByTarget?: boolean;\n }\n\n /**\n * An options object for creating a context menu item.\n */\n export interface IItemOptions extends Menu.IItemOptions {\n /**\n * The CSS selector for the context menu item.\n *\n * The context menu item will only be displayed in the context menu\n * when the selector matches a node on the propagation path of the\n * contextmenu event. This allows the menu item to be restricted to\n * user-defined contexts.\n *\n * The selector must not contain commas.\n */\n selector: string;\n\n /**\n * The rank for the item.\n *\n * The rank is used as a tie-breaker when ordering context menu\n * items for display. Items are sorted in the following order:\n * 1. Depth in the DOM tree (deeper is better)\n * 2. Selector specificity (higher is better)\n * 3. Rank (lower is better)\n * 4. Insertion order\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A normalized item for a context menu.\n */\n export interface IItem extends Menu.IItemOptions {\n /**\n * The selector for the item.\n */\n selector: string;\n\n /**\n * The rank for the item.\n */\n rank: number;\n\n /**\n * The tie-breaking id for the item.\n */\n id: number;\n }\n\n /**\n * Create a normalized context menu item from an options object.\n */\n export function createItem(\n options: ContextMenu.IItemOptions,\n id: number\n ): IItem {\n let selector = validateSelector(options.selector);\n let rank = options.rank !== undefined ? options.rank : Infinity;\n return { ...options, selector, rank, id };\n }\n\n /**\n * Find the items which match a context menu event.\n *\n * The results are sorted by DOM level, specificity, and rank.\n */\n export function matchItems(\n items: IItem[],\n event: MouseEvent,\n groupByTarget: boolean,\n sortBySelector: boolean\n ): IItem[] | null {\n // Look up the target of the event.\n let target = event.target as Element | null;\n\n // Bail if there is no target.\n if (!target) {\n return null;\n }\n\n // Look up the current target of the event.\n let currentTarget = event.currentTarget as Element | null;\n\n // Bail if there is no current target.\n if (!currentTarget) {\n return null;\n }\n\n // There are some third party libraries that cause the `target` to\n // be detached from the DOM before lumino can process the event.\n // If that happens, search for a new target node by point. If that\n // node is still dangling, bail.\n if (!currentTarget.contains(target)) {\n target = document.elementFromPoint(event.clientX, event.clientY);\n if (!target || !currentTarget.contains(target)) {\n return null;\n }\n }\n\n // Set up the result array.\n let result: IItem[] = [];\n\n // Copy the items array to allow in-place modification.\n let availableItems: Array = items.slice();\n\n // Walk up the DOM hierarchy searching for matches.\n while (target !== null) {\n // Set up the match array for this DOM level.\n let matches: IItem[] = [];\n\n // Search the remaining items for matches.\n for (let i = 0, n = availableItems.length; i < n; ++i) {\n // Fetch the item.\n let item = availableItems[i];\n\n // Skip items which are already consumed.\n if (!item) {\n continue;\n }\n\n // Skip items which do not match the element.\n if (!Selector.matches(target, item.selector)) {\n continue;\n }\n\n // Add the matched item to the result for this DOM level.\n matches.push(item);\n\n // Mark the item as consumed.\n availableItems[i] = null;\n }\n\n // Sort the matches for this level and add them to the results.\n if (matches.length !== 0) {\n if (groupByTarget) {\n matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n result.push(...matches);\n }\n\n // Stop searching at the limits of the DOM range.\n if (target === currentTarget) {\n break;\n }\n\n // Step to the parent DOM level.\n target = target.parentElement;\n }\n\n if (!groupByTarget) {\n result.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n\n // Return the matched and sorted results.\n return result;\n }\n\n /**\n * Validate the selector for a menu item.\n *\n * This returns the validated selector, or throws if the selector is\n * invalid or contains commas.\n */\n function validateSelector(selector: string): string {\n if (selector.indexOf(',') !== -1) {\n throw new Error(`Selector cannot contain commas: ${selector}`);\n }\n if (!Selector.isValid(selector)) {\n throw new Error(`Invalid selector: ${selector}`);\n }\n return selector;\n }\n\n /**\n * A sort comparison function for a context menu item by ranks.\n */\n function itemCmpRank(a: IItem, b: IItem): number {\n // Sort based on rank.\n let r1 = a.rank;\n let r2 = b.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity-safe\n }\n\n // When all else fails, sort by item id.\n return a.id - b.id;\n }\n\n /**\n * A sort comparison function for a context menu item by selectors and ranks.\n */\n function itemCmp(a: IItem, b: IItem): number {\n // Sort first based on selector specificity.\n let s1 = Selector.calculateSpecificity(a.selector);\n let s2 = Selector.calculateSpecificity(b.selector);\n if (s1 !== s2) {\n return s2 - s1;\n }\n\n // If specificities are equal\n return itemCmpRank(a, b);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ElementARIAAttrs,\n ElementBaseAttrs,\n ElementDataset,\n ElementInlineStyle,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n 'ArrowLeft',\n 'ArrowUp',\n 'ArrowRight',\n 'ArrowDown',\n 'Home',\n 'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar extends Widget {\n /**\n * Construct a new tab bar.\n *\n * @param options - The options for initializing the tab bar.\n */\n constructor(options: TabBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-TabBar');\n this.contentNode.setAttribute('role', 'tablist');\n this.setFlag(Widget.Flag.DisallowLayout);\n this._document = options.document || document;\n this.tabsMovable = options.tabsMovable || false;\n this.titlesEditable = options.titlesEditable || false;\n this.allowDeselect = options.allowDeselect || false;\n this.addButtonEnabled = options.addButtonEnabled || false;\n this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n this.name = options.name || '';\n this.orientation = options.orientation || 'horizontal';\n this.removeBehavior = options.removeBehavior || 'select-tab-after';\n this.renderer = options.renderer || TabBar.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._releaseMouse();\n this._titles.length = 0;\n this._previousTitle = null;\n super.dispose();\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when a tab is moved by the user.\n *\n * #### Notes\n * This signal is emitted when a tab is moved by user interaction.\n *\n * This signal is not emitted when a tab is moved programmatically.\n */\n get tabMoved(): ISignal> {\n return this._tabMoved;\n }\n\n /**\n * A signal emitted when a tab is clicked by the user.\n *\n * #### Notes\n * If the clicked tab is not the current tab, the clicked tab will be\n * made current and the `currentChanged` signal will be emitted first.\n *\n * This signal is emitted even if the clicked tab is the current tab.\n */\n get tabActivateRequested(): ISignal<\n this,\n TabBar.ITabActivateRequestedArgs\n > {\n return this._tabActivateRequested;\n }\n\n /**\n * A signal emitted when the tab bar add button is clicked.\n */\n get addRequested(): ISignal {\n return this._addRequested;\n }\n\n /**\n * A signal emitted when a tab close icon is clicked.\n *\n * #### Notes\n * This signal is not emitted unless the tab title is `closable`.\n */\n get tabCloseRequested(): ISignal> {\n return this._tabCloseRequested;\n }\n\n /**\n * A signal emitted when a tab is dragged beyond the detach threshold.\n *\n * #### Notes\n * This signal is emitted when the user drags a tab with the mouse,\n * and mouse is dragged beyond the detach threshold.\n *\n * The consumer of the signal should call `releaseMouse` and remove\n * the tab in order to complete the detach.\n *\n * This signal is only emitted once per drag cycle.\n */\n get tabDetachRequested(): ISignal> {\n return this._tabDetachRequested;\n }\n\n /**\n * The renderer used by the tab bar.\n */\n readonly renderer: TabBar.IRenderer;\n\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n get document(): Document | ShadowRoot {\n return this._document;\n }\n\n /**\n * Whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n tabsMovable: boolean;\n\n /**\n * Whether the titles can be user-edited.\n *\n */\n get titlesEditable(): boolean {\n return this._titlesEditable;\n }\n\n /**\n * Set whether titles can be user edited.\n *\n */\n set titlesEditable(value: boolean) {\n this._titlesEditable = value;\n }\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * #### Notes\n * Tabs can be always be deselected programmatically.\n */\n allowDeselect: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n */\n insertBehavior: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n */\n removeBehavior: TabBar.RemoveBehavior;\n\n /**\n * Get the currently selected title.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get currentTitle(): Title | null {\n return this._titles[this._currentIndex] || null;\n }\n\n /**\n * Set the currently selected title.\n *\n * #### Notes\n * If the title does not exist, the title will be set to `null`.\n */\n set currentTitle(value: Title | null) {\n this.currentIndex = value ? this._titles.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this._currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `-1`.\n */\n set currentIndex(value: number) {\n // Adjust for an out of range index.\n if (value < 0 || value >= this._titles.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._currentIndex === value) {\n return;\n }\n\n // Look up the previous index and title.\n let pi = this._currentIndex;\n let pt = this._titles[pi] || null;\n\n // Look up the current index and title.\n let ci = value;\n let ct = this._titles[ci] || null;\n\n // Update the current index and previous title.\n this._currentIndex = ci;\n this._previousTitle = pt;\n\n // Schedule an update of the tabs.\n this.update();\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: ci,\n currentTitle: ct\n });\n }\n\n /**\n * Get the name of the tab bar.\n */\n get name(): string {\n return this._name;\n }\n\n /**\n * Set the name of the tab bar.\n */\n set name(value: string) {\n this._name = value;\n if (value) {\n this.contentNode.setAttribute('aria-label', value);\n } else {\n this.contentNode.removeAttribute('aria-label');\n }\n }\n\n /**\n * Get the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n get orientation(): TabBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n set orientation(value: TabBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Toggle the orientation values.\n this._orientation = value;\n this.dataset['orientation'] = value;\n this.contentNode.setAttribute('aria-orientation', value);\n }\n\n /**\n * Whether the add button is enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add button is enabled.\n */\n set addButtonEnabled(value: boolean) {\n // Do nothing if the value does not change.\n if (this._addButtonEnabled === value) {\n return;\n }\n\n this._addButtonEnabled = value;\n if (value) {\n this.addButtonNode.classList.remove('lm-mod-hidden');\n } else {\n this.addButtonNode.classList.add('lm-mod-hidden');\n }\n }\n\n /**\n * A read-only array of the titles in the tab bar.\n */\n get titles(): ReadonlyArray> {\n return this._titles;\n }\n\n /**\n * The tab bar content node.\n *\n * #### Notes\n * This is the node which holds the tab nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * The tab bar add button node.\n *\n * #### Notes\n * This is the node which holds the add button.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get addButtonNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-addButton'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Add a tab to the end of the tab bar.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * If the title is already added to the tab bar, it will be moved.\n */\n addTab(value: Title | Title.IOptions): Title {\n return this.insertTab(this._titles.length, value);\n }\n\n /**\n * Insert a tab into the tab bar at the specified index.\n *\n * @param index - The index at which to insert the tab.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the tabs.\n *\n * If the title is already added to the tab bar, it will be moved.\n */\n insertTab(index: number, value: Title | Title.IOptions): Title {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Coerce the value to a title.\n let title = Private.asTitle(value);\n\n // Look up the index of the title.\n let i = this._titles.indexOf(title);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._titles.length));\n\n // If the title is not in the array, insert it.\n if (i === -1) {\n // Insert the title into the array.\n ArrayExt.insert(this._titles, j, title);\n\n // Connect to the title changed signal.\n title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the insert.\n this._adjustCurrentForInsert(j, title);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n // Otherwise, the title exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._titles.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return title;\n }\n\n // Move the title to the new location.\n ArrayExt.move(this._titles, i, j);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n /**\n * Remove a tab from the tab bar.\n *\n * @param title - The title for the tab to remove.\n *\n * #### Notes\n * This is a no-op if the title is not in the tab bar.\n */\n removeTab(title: Title): void {\n this.removeTabAt(this._titles.indexOf(title));\n }\n\n /**\n * Remove the tab at a given index from the tab bar.\n *\n * @param index - The index of the tab to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeTabAt(index: number): void {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Remove the title from the array.\n let title = ArrayExt.removeAt(this._titles, index);\n\n // Bail if the index is out of range.\n if (!title) {\n return;\n }\n\n // Disconnect from the title changed signal.\n title.changed.disconnect(this._onTitleChanged, this);\n\n // Clear the previous title if it's being removed.\n if (title === this._previousTitle) {\n this._previousTitle = null;\n }\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the remove.\n this._adjustCurrentForRemove(index, title);\n }\n\n /**\n * Remove all tabs from the tab bar.\n */\n clearTabs(): void {\n // Bail if there is nothing to remove.\n if (this._titles.length === 0) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Disconnect from the title changed signals.\n for (let title of this._titles) {\n title.changed.disconnect(this._onTitleChanged, this);\n }\n\n // Get the current index and title.\n let pi = this.currentIndex;\n let pt = this.currentTitle;\n\n // Reset the current index and previous title.\n this._currentIndex = -1;\n this._previousTitle = null;\n\n // Clear the title array.\n this._titles.length = 0;\n\n // Schedule an update of the tabs.\n this.update();\n\n // If no tab was selected, there's nothing else to do.\n if (pi === -1) {\n return;\n }\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n *\n * #### Notes\n * This will cause the tab bar to stop handling mouse events and to\n * restore the tabs to their non-dragged positions.\n */\n releaseMouse(): void {\n this._releaseMouse();\n }\n\n /**\n * Handle the DOM events for the tab bar.\n *\n * @param event - The DOM event sent to the tab bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tab bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'dblclick':\n this._evtDblClick(event as MouseEvent);\n break;\n case 'keydown':\n event.eventPhase === Event.CAPTURING_PHASE\n ? this._evtKeyDownCapturing(event as KeyboardEvent)\n : this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n this.node.addEventListener('dblclick', this);\n this.node.addEventListener('keydown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this.node.removeEventListener('dblclick', this);\n this.node.removeEventListener('keydown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let titles = this._titles;\n let renderer = this.renderer;\n let currentTitle = this.currentTitle;\n let content = new Array(titles.length);\n // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n // If the add button handles it, no need to do anything. If no element of the tab\n // bar handles it, set it on the current or the first tab to ensure one element\n // handles it after update.\n const tabHandlingTabindex =\n this._getCurrentTabindex() ??\n (this._currentIndex > -1 ? this._currentIndex : 0);\n\n for (let i = 0, n = titles.length; i < n; ++i) {\n let title = titles[i];\n let current = title === currentTitle;\n let zIndex = current ? n : n - i - 1;\n let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * Get the index of the tab which handles tabindex=\"0\".\n * If the add button handles tabindex=\"0\", -1 is returned.\n * If none of the previous handles tabindex=\"0\", null is returned.\n */\n private _getCurrentTabindex(): number | null {\n let index = null;\n const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n if (elemTabindex) {\n index = [...this.contentNode.children].indexOf(elemTabindex);\n } else if (\n this._addButtonEnabled &&\n this.addButtonNode.getAttribute('tabindex') === '0'\n ) {\n index = -1;\n }\n return index;\n }\n\n /**\n * Handle the `'dblclick'` event for the tab bar.\n */\n private _evtDblClick(event: MouseEvent): void {\n // Do nothing if titles are not editable\n if (!this.titlesEditable) {\n return;\n }\n\n let tabs = this.contentNode.children;\n\n // Find the index of the targeted tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab.\n if (index === -1) {\n return;\n }\n\n let title = this.titles[index];\n let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n if (label && label.contains(event.target as HTMLElement)) {\n let value = title.label || '';\n\n // Clear the label element\n let oldValue = label.innerHTML;\n label.innerHTML = '';\n\n let input = document.createElement('input');\n input.classList.add('lm-TabBar-tabInput');\n input.value = value;\n label.appendChild(input);\n\n let onblur = () => {\n input.removeEventListener('blur', onblur);\n label.innerHTML = oldValue;\n this.node.addEventListener('keydown', this);\n };\n\n input.addEventListener('dblclick', (event: Event) =>\n event.stopPropagation()\n );\n input.addEventListener('blur', onblur);\n input.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n if (input.value !== '') {\n title.label = title.caption = input.value;\n }\n onblur();\n } else if (event.key === 'Escape') {\n onblur();\n }\n });\n this.node.removeEventListener('keydown', this);\n input.select();\n input.focus();\n\n if (label.children.length > 0) {\n (label.children[0] as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at capturing phase.\n */\n private _evtKeyDownCapturing(event: KeyboardEvent): void {\n if (event.eventPhase !== Event.CAPTURING_PHASE) {\n return;\n }\n\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.key === 'Escape') {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at target phase.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Allow for navigation using tab key\n if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n return;\n }\n\n // Check if Enter or Spacebar key has been pressed and open that tab\n if (\n event.key === 'Enter' ||\n event.key === 'Spacebar' ||\n event.key === ' '\n ) {\n // Get focus element that is in focus by the tab key\n const focusedElement = document.activeElement;\n\n // Test first if the focus is on the add button node\n if (\n this.addButtonEnabled &&\n this.addButtonNode.contains(focusedElement)\n ) {\n event.preventDefault();\n event.stopPropagation();\n this._addRequested.emit();\n } else {\n const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n tab.contains(focusedElement)\n );\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this.currentIndex = index;\n }\n }\n // Handle the arrow keys to switch tabs.\n } else if (ARROW_KEYS.includes(event.key)) {\n // Create a list of all focusable elements in the tab bar.\n const focusable: Element[] = [...this.contentNode.children];\n if (this.addButtonEnabled) {\n focusable.push(this.addButtonNode);\n }\n // If the tab bar contains only one element, nothing to do.\n if (focusable.length <= 1) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n\n // Get the current focused element.\n let focusedIndex = focusable.indexOf(document.activeElement as Element);\n if (focusedIndex === -1) {\n focusedIndex = this._currentIndex;\n }\n\n // Find the next element to focus on.\n let nextFocused: Element | null | undefined;\n if (\n (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowDown' && this._orientation === 'vertical')\n ) {\n nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n } else if (\n (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowUp' && this._orientation === 'vertical')\n ) {\n nextFocused =\n focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n } else if (event.key === 'Home') {\n nextFocused = focusable[0];\n } else if (event.key === 'End') {\n nextFocused = focusable[focusable.length - 1];\n }\n\n // Change the focused element and the tabindex value.\n if (nextFocused) {\n focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n nextFocused?.setAttribute('tabindex', '0');\n (nextFocused as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the tab bar.\n */\n private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse press.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if a drag is in progress.\n if (this._dragData) {\n return;\n }\n\n // Do nothing if a title editable input was clicked.\n if (\n (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n ) {\n return;\n }\n\n // Check if the add button was clicked.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the pressed tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab or the add button.\n if (index === -1 && !addButtonClicked) {\n return;\n }\n\n // Pressing on a tab stops the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Initialize the non-measured parts of the drag data.\n this._dragData = {\n tab: tabs[index] as HTMLElement,\n index: index,\n pressX: event.clientX,\n pressY: event.clientY,\n tabPos: -1,\n tabSize: -1,\n tabPressPos: -1,\n targetIndex: -1,\n tabLayout: null,\n contentRect: null,\n override: null,\n dragActive: false,\n dragAborted: false,\n detachRequested: false\n };\n\n // Add the document pointer up listener.\n this.document.addEventListener('pointerup', this, true);\n\n // Do nothing else if the middle button or add button is clicked.\n if (event.button === 1 || addButtonClicked) {\n return;\n }\n\n // Do nothing else if the close icon is clicked.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n return;\n }\n\n // Add the extra listeners if the tabs are movable.\n if (this.tabsMovable) {\n this.document.addEventListener('pointermove', this, true);\n this.document.addEventListener('keydown', this, true);\n this.document.addEventListener('contextmenu', this, true);\n }\n\n // Update the current index as appropriate.\n if (this.allowDeselect && this.currentIndex === index) {\n this.currentIndex = -1;\n } else {\n this.currentIndex = index;\n }\n\n // Do nothing else if there is no current tab.\n if (this.currentIndex === -1) {\n return;\n }\n\n // Emit the tab activate request signal.\n this._tabActivateRequested.emit({\n index: this.currentIndex,\n title: this.currentTitle!\n });\n }\n\n /**\n * Handle the `'pointermove'` event for the tab bar.\n */\n private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Suppress the event during a drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Bail early if the drag threshold has not been met.\n if (!data.dragActive && !Private.dragExceeded(data, event)) {\n return;\n }\n\n // Activate the drag if necessary.\n if (!data.dragActive) {\n // Fill in the rest of the drag data measurements.\n let tabRect = data.tab.getBoundingClientRect();\n if (this._orientation === 'horizontal') {\n data.tabPos = data.tab.offsetLeft;\n data.tabSize = tabRect.width;\n data.tabPressPos = data.pressX - tabRect.left;\n } else {\n data.tabPos = data.tab.offsetTop;\n data.tabSize = tabRect.height;\n data.tabPressPos = data.pressY - tabRect.top;\n }\n data.tabPressOffset = {\n x: data.pressX - tabRect.left,\n y: data.pressY - tabRect.top\n };\n data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n data.contentRect = this.contentNode.getBoundingClientRect();\n data.override = Drag.overrideCursor('default');\n\n // Add the dragging style classes.\n data.tab.classList.add('lm-mod-dragging');\n this.addClass('lm-mod-dragging');\n\n // Mark the drag as active.\n data.dragActive = true;\n }\n\n // Emit the detach requested signal if the threshold is exceeded.\n if (!data.detachRequested && Private.detachExceeded(data, event)) {\n // Only emit the signal once per drag cycle.\n data.detachRequested = true;\n\n // Setup the arguments for the signal.\n let index = data.index;\n let clientX = event.clientX;\n let clientY = event.clientY;\n let tab = tabs[index] as HTMLElement;\n let title = this._titles[index];\n\n // Emit the tab detach requested signal.\n this._tabDetachRequested.emit({\n index,\n title,\n tab,\n clientX,\n clientY,\n offset: data.tabPressOffset\n });\n\n // Bail if the signal handler aborted the drag.\n if (data.dragAborted) {\n return;\n }\n }\n\n // Update the positions of the tabs.\n Private.layoutTabs(tabs, data, event, this._orientation);\n }\n\n /**\n * Handle the `'pointerup'` event for the document.\n */\n private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse release.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if no drag is in progress.\n const data = this._dragData;\n if (!data) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Remove the extra mouse event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Handle a release when the drag is not active.\n if (!data.dragActive) {\n // Clear the drag data.\n this._dragData = null;\n\n // Handle clicking the add button.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n if (addButtonClicked) {\n this._addRequested.emit(undefined);\n return;\n }\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the released tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the release is not on the original pressed tab.\n if (index !== data.index) {\n return;\n }\n\n // Ignore the release if the title is not closable.\n let title = this._titles[index];\n if (!title.closable) {\n return;\n }\n\n // Emit the close requested signal if the middle button is released.\n if (event.button === 1) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Emit the close requested signal if the close icon was released.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Otherwise, there is nothing left to do.\n return;\n }\n\n // Do nothing if the left button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Position the tab at its final resting position.\n Private.finalizeTabPosition(data, this._orientation);\n\n // Remove the dragging class from the tab so it can be transitioned.\n data.tab.classList.remove('lm-mod-dragging');\n\n // Parse the transition duration for releasing the tab.\n let duration = Private.parseTransitionDuration(data.tab);\n\n // Complete the release on a timer to allow the tab to transition.\n setTimeout(() => {\n // Do nothing if the drag has been aborted.\n if (data.dragAborted) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Reset the positions of the tabs.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor grab.\n data.override!.dispose();\n\n // Remove the remaining dragging style.\n this.removeClass('lm-mod-dragging');\n\n // If the tab was not moved, there is nothing else to do.\n let i = data.index;\n let j = data.targetIndex;\n if (j === -1 || i === j) {\n return;\n }\n\n // Move the title to the new locations.\n ArrayExt.move(this._titles, i, j);\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Emit the tab moved signal.\n this._tabMoved.emit({\n fromIndex: i,\n toIndex: j,\n title: this._titles[j]\n });\n\n // Update the tabs immediately to prevent flicker.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n }, duration);\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n */\n private _releaseMouse(): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Remove the extra document event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Indicate the drag has been aborted. This allows the mouse\n // event handlers to return early when the drag is canceled.\n data.dragAborted = true;\n\n // If the drag is not active, there's nothing more to do.\n if (!data.dragActive) {\n return;\n }\n\n // Reset the tabs to their non-dragged positions.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor override.\n data.override!.dispose();\n\n // Clear the dragging style classes.\n data.tab.classList.remove('lm-mod-dragging');\n this.removeClass('lm-mod-dragging');\n }\n\n /**\n * Adjust the current index for a tab insert operation.\n *\n * This method accounts for the tab bar's insertion behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForInsert(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ct = this.currentTitle;\n let ci = this._currentIndex;\n let bh = this.insertBehavior;\n\n // TODO: do we need to do an update to update the aria-selected attribute?\n\n // Handle the behavior where the new tab is always selected,\n // or the behavior where the new tab is selected if needed.\n if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n this._currentIndex = i;\n this._previousTitle = ct;\n this._currentChanged.emit({\n previousIndex: ci,\n previousTitle: ct,\n currentIndex: i,\n currentTitle: title\n });\n return;\n }\n\n // Otherwise, silently adjust the current index if needed.\n if (ci >= i) {\n this._currentIndex++;\n }\n }\n\n /**\n * Adjust the current index for a tab move operation.\n *\n * This method will not cause the actual current tab to change.\n * It silently adjusts the index to account for the given move.\n */\n private _adjustCurrentForMove(i: number, j: number): void {\n if (this._currentIndex === i) {\n this._currentIndex = j;\n } else if (this._currentIndex < i && this._currentIndex >= j) {\n this._currentIndex++;\n } else if (this._currentIndex > i && this._currentIndex <= j) {\n this._currentIndex--;\n }\n }\n\n /**\n * Adjust the current index for a tab remove operation.\n *\n * This method accounts for the tab bar's remove behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForRemove(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ci = this._currentIndex;\n let bh = this.removeBehavior;\n\n // Silently adjust the index if the current tab is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._currentIndex--;\n }\n return;\n }\n\n // TODO: do we need to do an update to adjust the aria-selected value?\n\n // No tab gets selected if the tab bar is empty.\n if (this._titles.length === 0) {\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n return;\n }\n\n // Handle behavior where the next sibling tab is selected.\n if (bh === 'select-tab-after') {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous sibling tab is selected.\n if (bh === 'select-tab-before') {\n this._currentIndex = Math.max(0, i - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous history tab is selected.\n if (bh === 'select-previous-tab') {\n if (this._previousTitle) {\n this._currentIndex = this._titles.indexOf(this._previousTitle);\n this._previousTitle = null;\n } else {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n }\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Otherwise, no tab gets selected.\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n this.update();\n }\n\n private _name: string;\n private _currentIndex = -1;\n private _titles: Title[] = [];\n private _orientation: TabBar.Orientation;\n private _document: Document | ShadowRoot;\n private _titlesEditable: boolean = false;\n private _previousTitle: Title | null = null;\n private _dragData: Private.IDragData | null = null;\n private _addButtonEnabled: boolean = false;\n private _tabMoved = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n private _addRequested = new Signal(this);\n private _tabCloseRequested = new Signal<\n this,\n TabBar.ITabCloseRequestedArgs\n >(this);\n private _tabDetachRequested = new Signal<\n this,\n TabBar.ITabDetachRequestedArgs\n >(this);\n private _tabActivateRequested = new Signal<\n this,\n TabBar.ITabActivateRequestedArgs\n >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n /**\n * A type alias for a tab bar orientation.\n */\n export type Orientation =\n | /**\n * The tabs are arranged in a single row, left-to-right.\n *\n * The tab text orientation is horizontal.\n */\n 'horizontal'\n\n /**\n * The tabs are arranged in a single column, top-to-bottom.\n *\n * The tab text orientation is horizontal.\n */\n | 'vertical';\n\n /**\n * A type alias for the selection behavior on tab insert.\n */\n export type InsertBehavior =\n | /**\n * The selected tab will not be changed.\n */\n 'none'\n\n /**\n * The inserted tab will be selected.\n */\n | 'select-tab'\n\n /**\n * The inserted tab will be selected if the current tab is null.\n */\n | 'select-tab-if-needed';\n\n /**\n * A type alias for the selection behavior on tab remove.\n */\n export type RemoveBehavior =\n | /**\n * No tab will be selected.\n */\n 'none'\n\n /**\n * The tab after the removed tab will be selected if possible.\n */\n | 'select-tab-after'\n\n /**\n * The tab before the removed tab will be selected if possible.\n */\n | 'select-tab-before'\n\n /**\n * The previously selected tab will be selected if possible.\n */\n | 'select-previous-tab';\n\n /**\n * An options object for creating a tab bar.\n */\n export interface IOptions {\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n\n /**\n * Name of the tab bar.\n *\n * This is used for accessibility reasons. The default is the empty string.\n */\n name?: string;\n\n /**\n * The layout orientation of the tab bar.\n *\n * The default is `horizontal`.\n */\n orientation?: TabBar.Orientation;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * The default is `false`.\n */\n allowDeselect?: boolean;\n\n /**\n * Whether the titles can be directly edited by the user.\n *\n * The default is `false`.\n */\n titlesEditable?: boolean;\n\n /**\n * Whether the add button is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n *\n * The default is `'select-tab-if-needed'`.\n */\n insertBehavior?: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n *\n * The default is `'select-tab-after'`.\n */\n removeBehavior?: TabBar.RemoveBehavior;\n\n /**\n * A renderer to use with the tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n readonly previousIndex: number;\n\n /**\n * The previously selected title.\n */\n readonly previousTitle: Title | null;\n\n /**\n * The currently selected index.\n */\n readonly currentIndex: number;\n\n /**\n * The currently selected title.\n */\n readonly currentTitle: Title | null;\n }\n\n /**\n * The arguments object for the `tabMoved` signal.\n */\n export interface ITabMovedArgs {\n /**\n * The previous index of the tab.\n */\n readonly fromIndex: number;\n\n /**\n * The current index of the tab.\n */\n readonly toIndex: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabActivateRequested` signal.\n */\n export interface ITabActivateRequestedArgs {\n /**\n * The index of the tab to activate.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabCloseRequested` signal.\n */\n export interface ITabCloseRequestedArgs {\n /**\n * The index of the tab to close.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabDetachRequested` signal.\n */\n export interface ITabDetachRequestedArgs {\n /**\n * The index of the tab to detach.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n\n /**\n * The node representing the tab.\n */\n readonly tab: HTMLElement;\n\n /**\n * The current client X position of the mouse.\n */\n readonly clientX: number;\n\n /**\n * The current client Y position of the mouse.\n */\n readonly clientY: number;\n\n /**\n * The mouse position in the tab coordinate.\n */\n readonly offset?: { x: number; y: number };\n }\n\n /**\n * An object which holds the data to render a tab.\n */\n export interface IRenderData {\n /**\n * The title associated with the tab.\n */\n readonly title: Title;\n\n /**\n * Whether the tab is the current tab.\n */\n readonly current: boolean;\n\n /**\n * The z-index for the tab.\n */\n readonly zIndex: number;\n\n /**\n * The tabindex value for the tab.\n */\n readonly tabIndex?: number;\n }\n\n /**\n * A renderer for use with a tab bar.\n */\n export interface IRenderer {\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector: string;\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n constructor() {\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement {\n let title = data.title.caption;\n let key = this.createTabKey(data);\n let id = key;\n let style = this.createTabStyle(data);\n let className = this.createTabClass(data);\n let dataset = this.createTabDataset(data);\n let aria = this.createTabARIA(data);\n if (data.title.closable) {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderCloseIcon(data)\n );\n } else {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n }\n\n /**\n * Render the icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n const { title } = data;\n let className = this.createIconClass(data);\n\n // If title.icon is undefined, it will be ignored.\n return h.div({ className }, title.icon!, title.iconLabel);\n }\n\n /**\n * Render the label element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n }\n\n /**\n * Render the close icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab close icon.\n */\n renderCloseIcon(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n }\n\n /**\n * Create a unique render key for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The unique render key for the tab.\n *\n * #### Notes\n * This method caches the key against the tab title the first time\n * the key is generated. This enables efficient rendering of moved\n * tabs and avoids subtle hover style artifacts.\n */\n createTabKey(data: IRenderData): string {\n let key = this._tabKeys.get(data.title);\n if (key === undefined) {\n key = `tab-key-${this._uuid}-${this._tabID++}`;\n this._tabKeys.set(data.title, key);\n }\n return key;\n }\n\n /**\n * Create the inline style object for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The inline style data for the tab.\n */\n createTabStyle(data: IRenderData): ElementInlineStyle {\n return { zIndex: `${data.zIndex}` };\n }\n\n /**\n * Create the class name for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab.\n */\n createTabClass(data: IRenderData): string {\n let name = 'lm-TabBar-tab';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.title.closable) {\n name += ' lm-mod-closable';\n }\n if (data.current) {\n name += ' lm-mod-current';\n }\n return name;\n }\n\n /**\n * Create the dataset for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The dataset for the tab.\n */\n createTabDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the ARIA attributes for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The ARIA attributes for the tab.\n */\n createTabARIA(data: IRenderData): ElementARIAAttrs | ElementBaseAttrs {\n return {\n role: 'tab',\n 'aria-selected': data.current.toString(),\n tabindex: `${data.tabIndex ?? '-1'}`\n };\n }\n\n /**\n * Create the class name for the tab icon.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-TabBar-tabIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _tabID = 0;\n private _tabKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * A selector which matches the add button node in the tab bar.\n */\n export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The start drag distance threshold.\n */\n export const DRAG_THRESHOLD = 5;\n\n /**\n * The detach distance threshold.\n */\n export const DETACH_THRESHOLD = 20;\n\n /**\n * A struct which holds the drag data for a tab bar.\n */\n export interface IDragData {\n /**\n * The tab node being dragged.\n */\n tab: HTMLElement;\n\n /**\n * The index of the tab being dragged.\n */\n index: number;\n\n /**\n * The mouse press client X position.\n */\n pressX: number;\n\n /**\n * The mouse press client Y position.\n */\n pressY: number;\n\n /**\n * The offset left/top of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPos: number;\n\n /**\n * The offset width/height of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabSize: number;\n\n /**\n * The original mouse X/Y position in tab coordinates.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPressPos: number;\n\n /**\n * The original mouse position in tab coordinates.\n *\n * This is undefined if the drag is not active.\n */\n tabPressOffset?: { x: number; y: number };\n\n /**\n * The tab target index upon mouse release.\n *\n * This will be `-1` if the drag is not active.\n */\n targetIndex: number;\n\n /**\n * The array of tab layout objects snapped at drag start.\n *\n * This will be `null` if the drag is not active.\n */\n tabLayout: ITabLayout[] | null;\n\n /**\n * The bounding client rect of the tab bar content node.\n *\n * This will be `null` if the drag is not active.\n */\n contentRect: DOMRect | null;\n\n /**\n * The disposable to clean up the cursor override.\n *\n * This will be `null` if the drag is not active.\n */\n override: IDisposable | null;\n\n /**\n * Whether the drag is currently active.\n */\n dragActive: boolean;\n\n /**\n * Whether the drag has been aborted.\n */\n dragAborted: boolean;\n\n /**\n * Whether a detach request as been made.\n */\n detachRequested: boolean;\n }\n\n /**\n * An object which holds layout data for a tab.\n */\n export interface ITabLayout {\n /**\n * The left/top margin value for the tab.\n */\n margin: number;\n\n /**\n * The offset left/top position of the tab.\n */\n pos: number;\n\n /**\n * The offset width/height of the tab.\n */\n size: number;\n }\n\n /**\n * Create the DOM node for a tab bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.setAttribute('role', 'tablist');\n content.className = 'lm-TabBar-content';\n node.appendChild(content);\n\n let add = document.createElement('div');\n add.className = 'lm-TabBar-addButton lm-mod-hidden';\n add.setAttribute('tabindex', '-1');\n add.setAttribute('role', 'button');\n node.appendChild(add);\n return node;\n }\n\n /**\n * Coerce a title or options into a real title.\n */\n export function asTitle(value: Title | Title.IOptions): Title {\n return value instanceof Title ? value : new Title(value);\n }\n\n /**\n * Parse the transition duration for a tab node.\n */\n export function parseTransitionDuration(tab: HTMLElement): number {\n let style = window.getComputedStyle(tab);\n return 1000 * (parseFloat(style.transitionDuration!) || 0);\n }\n\n /**\n * Get a snapshot of the current tab layout values.\n */\n export function snapTabLayout(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): ITabLayout[] {\n let layout = new Array(tabs.length);\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let node = tabs[i] as HTMLElement;\n let style = window.getComputedStyle(node);\n if (orientation === 'horizontal') {\n layout[i] = {\n pos: node.offsetLeft,\n size: node.offsetWidth,\n margin: parseFloat(style.marginLeft!) || 0\n };\n } else {\n layout[i] = {\n pos: node.offsetTop,\n size: node.offsetHeight,\n margin: parseFloat(style.marginTop!) || 0\n };\n }\n }\n return layout;\n }\n\n /**\n * Test if the event exceeds the drag threshold.\n */\n export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n let dx = Math.abs(event.clientX - data.pressX);\n let dy = Math.abs(event.clientY - data.pressY);\n return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n }\n\n /**\n * Test if the event exceeds the drag detach threshold.\n */\n export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n let rect = data.contentRect!;\n return (\n event.clientX < rect.left - DETACH_THRESHOLD ||\n event.clientX >= rect.right + DETACH_THRESHOLD ||\n event.clientY < rect.top - DETACH_THRESHOLD ||\n event.clientY >= rect.bottom + DETACH_THRESHOLD\n );\n }\n\n /**\n * Update the relative tab positions and computed target index.\n */\n export function layoutTabs(\n tabs: HTMLCollection,\n data: IDragData,\n event: MouseEvent,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive values.\n let pressPos: number;\n let localPos: number;\n let clientPos: number;\n let clientSize: number;\n if (orientation === 'horizontal') {\n pressPos = data.pressX;\n localPos = event.clientX - data.contentRect!.left;\n clientPos = event.clientX;\n clientSize = data.contentRect!.width;\n } else {\n pressPos = data.pressY;\n localPos = event.clientY - data.contentRect!.top;\n clientPos = event.clientY;\n clientSize = data.contentRect!.height;\n }\n\n // Compute the target data.\n let targetIndex = data.index;\n let targetPos = localPos - data.tabPressPos;\n let targetEnd = targetPos + data.tabSize;\n\n // Update the relative tab positions.\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let pxPos: string;\n let layout = data.tabLayout![i];\n let threshold = layout.pos + (layout.size >> 1);\n if (i < data.index && targetPos < threshold) {\n pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n targetIndex = Math.min(targetIndex, i);\n } else if (i > data.index && targetEnd > threshold) {\n pxPos = `${-data.tabSize - layout.margin}px`;\n targetIndex = Math.max(targetIndex, i);\n } else if (i === data.index) {\n let ideal = clientPos - pressPos;\n let limit = clientSize - (data.tabPos + data.tabSize);\n pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n } else {\n pxPos = '';\n }\n if (orientation === 'horizontal') {\n (tabs[i] as HTMLElement).style.left = pxPos;\n } else {\n (tabs[i] as HTMLElement).style.top = pxPos;\n }\n }\n\n // Update the computed target index.\n data.targetIndex = targetIndex;\n }\n\n /**\n * Position the drag tab at its final resting relative position.\n */\n export function finalizeTabPosition(\n data: IDragData,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive client size.\n let clientSize: number;\n if (orientation === 'horizontal') {\n clientSize = data.contentRect!.width;\n } else {\n clientSize = data.contentRect!.height;\n }\n\n // Compute the ideal final tab position.\n let ideal: number;\n if (data.targetIndex === data.index) {\n ideal = 0;\n } else if (data.targetIndex > data.index) {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n } else {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos - data.tabPos;\n }\n\n // Compute the tab position limit.\n let limit = clientSize - (data.tabPos + data.tabSize);\n let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n // Set the final orientation-sensitive position.\n if (orientation === 'horizontal') {\n data.tab.style.left = `${final}px`;\n } else {\n data.tab.style.top = `${final}px`;\n }\n }\n\n /**\n * Reset the relative positions of the given tabs.\n */\n export function resetTabPositions(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): void {\n for (const tab of tabs) {\n if (orientation === 'horizontal') {\n (tab as HTMLElement).style.left = '';\n } else {\n (tab as HTMLElement).style.top = '';\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n /**\n * Construct a new dock layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: DockLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n this._document = options.document || document;\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n */\n dispose(): void {\n // Get an iterator over the widgets in the layout.\n let widgets = this[Symbol.iterator]();\n\n // Dispose of the layout items.\n this._items.forEach(item => {\n item.dispose();\n });\n\n // Clear the layout state before disposing the widgets.\n this._box = null;\n this._root = null;\n this._items.clear();\n\n // Dispose of the widgets contained in the old layout root.\n for (const widget of widgets) {\n widget.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The renderer used by the dock layout.\n */\n readonly renderer: DockLayout.IRenderer;\n\n /**\n * The method for hiding child widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n for (const bar of this.tabBars()) {\n if (bar.titles.length > 1) {\n for (const title of bar.titles) {\n title.owner.hiddenMode = this._hiddenMode;\n }\n }\n }\n }\n\n /**\n * Get the inter-element spacing for the dock layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the dock layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Whether the dock layout is empty.\n */\n get isEmpty(): boolean {\n return this._root === null;\n }\n\n /**\n * Create an iterator over all widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This iterator includes the generated tab bars.\n */\n [Symbol.iterator](): IterableIterator {\n return this._root ? this._root.iterAllWidgets() : empty();\n }\n\n /**\n * Create an iterator over the user widgets in the layout.\n *\n * @returns A new iterator over the user widgets in the layout.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n widgets(): IterableIterator {\n return this._root ? this._root.iterUserWidgets() : empty();\n }\n\n /**\n * Create an iterator over the selected widgets in the layout.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the layout.\n */\n selectedWidgets(): IterableIterator {\n return this._root ? this._root.iterSelectedWidgets() : empty();\n }\n\n /**\n * Create an iterator over the tab bars in the layout.\n *\n * @returns A new iterator over the tab bars in the layout.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n tabBars(): IterableIterator> {\n return this._root ? this._root.iterTabBars() : empty();\n }\n\n /**\n * Create an iterator over the handles in the layout.\n *\n * @returns A new iterator over the handles in the layout.\n */\n handles(): IterableIterator {\n return this._root ? this._root.iterHandles() : empty();\n }\n\n /**\n * Move a handle to the given offset position.\n *\n * @param handle - The handle to move.\n *\n * @param offsetX - The desired offset X position of the handle.\n *\n * @param offsetY - The desired offset Y position of the handle.\n *\n * #### Notes\n * If the given handle is not contained in the layout, this is no-op.\n *\n * The handle will be moved as close as possible to the desired\n * position without violating any of the layout constraints.\n *\n * Only one of the coordinates is used depending on the orientation\n * of the handle. This method accepts both coordinates to make it\n * easy to invoke from a mouse move event without needing to know\n * the handle orientation.\n */\n moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n // Bail early if there is no root or if the handle is hidden.\n let hidden = handle.classList.contains('lm-mod-hidden');\n if (!this._root || hidden) {\n return;\n }\n\n // Lookup the split node for the handle.\n let data = this._root.findSplitNode(handle);\n if (!data) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (data.node.orientation === 'horizontal') {\n delta = offsetX - handle.offsetLeft;\n } else {\n delta = offsetY - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent sibling resizing unless needed.\n data.node.holdSizes();\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Save the current configuration of the dock layout.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockLayout.ILayoutConfig {\n // Bail early if there is no root.\n if (!this._root) {\n return { main: null };\n }\n\n // Hold the current sizes in the layout tree.\n this._root.holdAllSizes();\n\n // Return the layout config.\n return { main: this._root.createConfig() };\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n */\n restoreLayout(config: DockLayout.ILayoutConfig): void {\n // Create the widget set for validating the config.\n let widgetSet = new Set();\n\n // Normalize the main area config and collect the widgets.\n let mainConfig: DockLayout.AreaConfig | null;\n if (config.main) {\n mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n } else {\n mainConfig = null;\n }\n\n // Create iterators over the old content.\n let oldWidgets = this.widgets();\n let oldTabBars = this.tabBars();\n let oldHandles = this.handles();\n\n // Clear the root before removing the old content.\n this._root = null;\n\n // Unparent the old widgets which are not in the new config.\n for (const widget of oldWidgets) {\n if (!widgetSet.has(widget)) {\n widget.parent = null;\n }\n }\n\n // Dispose of the old tab bars.\n for (const tabBar of oldTabBars) {\n tabBar.dispose();\n }\n\n // Remove the old handles.\n for (const handle of oldHandles) {\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n }\n\n // Reparent the new widgets to the current parent.\n for (const widget of widgetSet) {\n widget.parent = this.parent;\n }\n\n // Create the root node for the new config.\n if (mainConfig) {\n this._root = Private.realizeAreaConfig(\n mainConfig,\n {\n // Ignoring optional `document` argument as we must reuse `this._document`\n createTabBar: (document?: Document | ShadowRoot) =>\n this._createTabBar(),\n createHandle: () => this._createHandle()\n },\n this._document\n );\n } else {\n this._root = null;\n }\n\n // If there is no parent, there is nothing more to do.\n if (!this.parent) {\n return;\n }\n\n // Attach the new widgets to the parent.\n widgetSet.forEach(widget => {\n this.attachWidget(widget);\n });\n\n // Post a fit request to the parent.\n this.parent.fit();\n }\n\n /**\n * Add a widget to the dock layout.\n *\n * @param widget - The widget to add to the dock layout.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * The widget will be moved if it is already contained in the layout.\n *\n * An error will be thrown if the reference widget is invalid.\n */\n addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n // Parse the options.\n let ref = options.ref || null;\n let mode = options.mode || 'tab-after';\n\n // Find the tab node which holds the reference widget.\n let refNode: Private.TabLayoutNode | null = null;\n if (this._root && ref) {\n refNode = this._root.findTabNode(ref);\n }\n\n // Throw an error if the reference widget is invalid.\n if (ref && !refNode) {\n throw new Error('Reference widget is not in the layout.');\n }\n\n // Reparent the widget to the current layout parent.\n widget.parent = this.parent;\n\n // Insert the widget according to the insert mode.\n switch (mode) {\n case 'tab-after':\n this._insertTab(widget, ref, refNode, true);\n break;\n case 'tab-before':\n this._insertTab(widget, ref, refNode, false);\n break;\n case 'split-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false);\n break;\n case 'split-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false);\n break;\n case 'split-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true);\n break;\n case 'split-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true);\n break;\n case 'merge-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n break;\n case 'merge-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n break;\n case 'merge-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n break;\n case 'merge-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n break;\n }\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Ensure the widget is attached to the parent widget.\n this.attachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Remove the widget from its current layout location.\n this._removeWidget(widget);\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Detach the widget from the parent widget.\n this.detachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Find the tab area which contains the given client position.\n *\n * @param clientX - The client X position of interest.\n *\n * @param clientY - The client Y position of interest.\n *\n * @returns The geometry of the tab area at the given position, or\n * `null` if there is no tab area at the given position.\n */\n hitTestTabAreas(\n clientX: number,\n clientY: number\n ): DockLayout.ITabAreaGeometry | null {\n // Bail early if hit testing cannot produce valid results.\n if (!this._root || !this.parent || !this.parent.isVisible) {\n return null;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent.node);\n }\n\n // Convert from client to local coordinates.\n let rect = this.parent.node.getBoundingClientRect();\n let x = clientX - rect.left - this._box.borderLeft;\n let y = clientY - rect.top - this._box.borderTop;\n\n // Find the tab layout node at the local position.\n let tabNode = this._root.hitTestTabNodes(x, y);\n\n // Bail if a tab layout node was not found.\n if (!tabNode) {\n return null;\n }\n\n // Extract the data from the tab node.\n let { tabBar, top, left, width, height } = tabNode;\n\n // Compute the right and bottom edges of the tab area.\n let borderWidth = this._box.borderLeft + this._box.borderRight;\n let borderHeight = this._box.borderTop + this._box.borderBottom;\n let right = rect.width - borderWidth - (left + width);\n let bottom = rect.height - borderHeight - (top + height);\n\n // Return the hit test results.\n return { tabBar, x, y, top, left, right, bottom, width, height };\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n // Perform superclass initialization.\n super.init();\n\n // Attach each widget to the parent.\n for (const widget of this) {\n this.attachWidget(widget);\n }\n\n // Attach each handle to the parent.\n for (const handle of this.handles()) {\n this.parent!.node.appendChild(handle);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Attach the widget to the layout parent widget.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a no-op if the widget is already attached.\n */\n protected attachWidget(widget: Widget): void {\n // Do nothing if the widget is already attached.\n if (this.parent!.node === widget.node.parentNode) {\n return;\n }\n\n // Create the layout item for the widget.\n this._items.set(widget, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach the widget from the layout parent widget.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a no-op if the widget is not attached.\n */\n protected detachWidget(widget: Widget): void {\n // Do nothing if the widget is not attached.\n if (this.parent!.node !== widget.node.parentNode) {\n return;\n }\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Delete the layout item for the widget.\n let item = this._items.get(widget);\n if (item) {\n this._items.delete(widget);\n item.dispose();\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Remove the specified widget from the layout structure.\n *\n * #### Notes\n * This is a no-op if the widget is not in the layout tree.\n *\n * This does not detach the widget from the parent node.\n */\n private _removeWidget(widget: Widget): void {\n // Bail early if there is no layout root.\n if (!this._root) {\n return;\n }\n\n // Find the tab node which contains the given widget.\n let tabNode = this._root.findTabNode(widget);\n\n // Bail early if the tab node is not found.\n if (!tabNode) {\n return;\n }\n\n Private.removeAria(widget);\n\n // If there are multiple tabs, just remove the widget's tab.\n if (tabNode.tabBar.titles.length > 1) {\n tabNode.tabBar.removeTab(widget.title);\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n tabNode.tabBar.titles.length == 1\n ) {\n const existingWidget = tabNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Display;\n }\n return;\n }\n\n // Otherwise, the tab node needs to be removed...\n\n // Dispose the tab bar.\n tabNode.tabBar.dispose();\n\n // Handle the case where the tab node is the root.\n if (this._root === tabNode) {\n this._root = null;\n return;\n }\n\n // Otherwise, remove the tab node from its parent...\n\n // Prevent widget resizing unless needed.\n this._root.holdAllSizes();\n\n // Clear the parent reference on the tab node.\n let splitNode = tabNode.parent!;\n tabNode.parent = null;\n\n // Remove the tab node from its parent split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n ArrayExt.removeAt(splitNode.sizers, i);\n\n // Remove the handle from its parent DOM node.\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n\n // If there are multiple children, just update the handles.\n if (splitNode.children.length > 1) {\n splitNode.syncHandles();\n return;\n }\n\n // Otherwise, the split node also needs to be removed...\n\n // Clear the parent reference on the split node.\n let maybeParent = splitNode.parent;\n splitNode.parent = null;\n\n // Lookup the remaining child node and handle.\n let childNode = splitNode.children[0];\n let childHandle = splitNode.handles[0];\n\n // Clear the split node data.\n splitNode.children.length = 0;\n splitNode.handles.length = 0;\n splitNode.sizers.length = 0;\n\n // Remove the child handle from its parent node.\n if (childHandle.parentNode) {\n childHandle.parentNode.removeChild(childHandle);\n }\n\n // Handle the case where the split node is the root.\n if (this._root === splitNode) {\n childNode.parent = null;\n this._root = childNode;\n return;\n }\n\n // Otherwise, move the child node to the parent node...\n let parentNode = maybeParent!;\n\n // Lookup the index of the split node.\n let j = parentNode.children.indexOf(splitNode);\n\n // Handle the case where the child node is a tab node.\n if (childNode instanceof Private.TabLayoutNode) {\n childNode.parent = parentNode;\n parentNode.children[j] = childNode;\n return;\n }\n\n // Remove the split data from the parent.\n let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n ArrayExt.removeAt(parentNode.children, j);\n ArrayExt.removeAt(parentNode.sizers, j);\n\n // Remove the handle from its parent node.\n if (splitHandle.parentNode) {\n splitHandle.parentNode.removeChild(splitHandle);\n }\n\n // The child node and the split parent node will have the same\n // orientation. Merge the grand-children with the parent node.\n for (let i = 0, n = childNode.children.length; i < n; ++i) {\n let gChild = childNode.children[i];\n let gHandle = childNode.handles[i];\n let gSizer = childNode.sizers[i];\n ArrayExt.insert(parentNode.children, j + i, gChild);\n ArrayExt.insert(parentNode.handles, j + i, gHandle);\n ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n gChild.parent = parentNode;\n }\n\n // Clear the child node.\n childNode.children.length = 0;\n childNode.handles.length = 0;\n childNode.sizers.length = 0;\n childNode.parent = null;\n\n // Sync the handles on the parent node.\n parentNode.syncHandles();\n }\n\n /**\n * Create the tab layout node to hold the widget.\n */\n private _createTabNode(widget: Widget): Private.TabLayoutNode {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n Private.addAria(widget, tabNode.tabBar);\n return tabNode;\n }\n\n /**\n * Insert a widget next to an existing tab.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertTab(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n after: boolean\n ): void {\n // Do nothing if the tab is inserted next to itself.\n if (widget === ref) {\n return;\n }\n\n // Create the root if it does not exist.\n if (!this._root) {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n this._root = tabNode;\n Private.addAria(widget, tabNode.tabBar);\n return;\n }\n\n // Use the first tab node as the ref node if needed.\n if (!refNode) {\n refNode = this._root.findFirstTabNode()!;\n }\n\n // If the widget is not contained in the ref node, ensure it is\n // removed from the layout and hidden before being added again.\n if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n this._removeWidget(widget);\n widget.hide();\n }\n\n // Lookup the target index for inserting the tab.\n let index: number;\n if (ref) {\n index = refNode.tabBar.titles.indexOf(ref.title);\n } else {\n index = refNode.tabBar.currentIndex;\n }\n\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n if (refNode.tabBar.titles.length === 0) {\n // Singular tab should use display mode to limit number of layers.\n widget.hiddenMode = Widget.HiddenMode.Display;\n } else if (refNode.tabBar.titles.length == 1) {\n // If we are adding a second tab, switch the existing tab back to scale.\n const existingWidget = refNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n // For the third and subsequent tabs no special action is needed.\n widget.hiddenMode = Widget.HiddenMode.Scale;\n }\n } else {\n // For all other modes just propagate the current mode.\n widget.hiddenMode = this._hiddenMode;\n }\n\n // Insert the widget's tab relative to the target index.\n refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n Private.addAria(widget, refNode.tabBar);\n }\n\n /**\n * Insert a widget as a new split area.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertSplit(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n orientation: Private.Orientation,\n after: boolean,\n merge: boolean = false\n ): void {\n // Do nothing if there is no effective split.\n if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n return;\n }\n\n // Ensure the widget is removed from the current layout.\n this._removeWidget(widget);\n\n // Set the root if it does not exist.\n if (!this._root) {\n this._root = this._createTabNode(widget);\n return;\n }\n\n // If the ref node parent is null, split the root.\n if (!refNode || !refNode.parent) {\n // Ensure the root is split with the correct orientation.\n let root = this._splitRoot(orientation);\n\n // Determine the insert index for the new tab node.\n let i = after ? root.children.length : 0;\n\n // Normalize the split node.\n root.normalizeSizes();\n\n // Create the sizer for new tab node.\n let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n // Insert the tab node sized to the golden ratio.\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(root.children, i, tabNode);\n ArrayExt.insert(root.sizers, i, sizer);\n ArrayExt.insert(root.handles, i, this._createHandle());\n tabNode.parent = root;\n\n // Re-normalize the split node to maintain the ratios.\n root.normalizeSizes();\n\n // Finally, synchronize the visibility of the handles.\n root.syncHandles();\n return;\n }\n\n // Lookup the split node for the ref widget.\n let splitNode = refNode.parent;\n\n // If the split node already had the correct orientation,\n // the widget can be inserted into the split node directly.\n if (splitNode.orientation === orientation) {\n // Find the index of the ref node.\n let i = splitNode.children.indexOf(refNode);\n\n // Conditionally reuse a tab layout found in the wanted position.\n if (merge) {\n let j = i + (after ? 1 : -1);\n let sibling = splitNode.children[j];\n if (sibling instanceof Private.TabLayoutNode) {\n this._insertTab(widget, null, sibling, true);\n ++sibling.tabBar.currentIndex;\n return;\n }\n }\n\n // Normalize the split node.\n splitNode.normalizeSizes();\n\n // Consume half the space for the insert location.\n let s = (splitNode.sizers[i].sizeHint /= 2);\n\n // Insert the tab node sized to the other half.\n let j = i + (after ? 1 : 0);\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(splitNode.children, j, tabNode);\n ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n ArrayExt.insert(splitNode.handles, j, this._createHandle());\n tabNode.parent = splitNode;\n\n // Finally, synchronize the visibility of the handles.\n splitNode.syncHandles();\n return;\n }\n\n // Remove the ref node from the split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n // Create a new normalized split node for the children.\n let childNode = new Private.SplitLayoutNode(orientation);\n childNode.normalized = true;\n\n // Add the ref node sized to half the space.\n childNode.children.push(refNode);\n childNode.sizers.push(Private.createSizer(0.5));\n childNode.handles.push(this._createHandle());\n refNode.parent = childNode;\n\n // Add the tab node sized to the other half.\n let j = after ? 1 : 0;\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(childNode.children, j, tabNode);\n ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n ArrayExt.insert(childNode.handles, j, this._createHandle());\n tabNode.parent = childNode;\n\n // Synchronize the visibility of the handles.\n childNode.syncHandles();\n\n // Finally, add the new child node to the original split node.\n ArrayExt.insert(splitNode.children, i, childNode);\n childNode.parent = splitNode;\n }\n\n /**\n * Ensure the root is a split node with the given orientation.\n */\n private _splitRoot(\n orientation: Private.Orientation\n ): Private.SplitLayoutNode {\n // Bail early if the root already meets the requirements.\n let oldRoot = this._root;\n if (oldRoot instanceof Private.SplitLayoutNode) {\n if (oldRoot.orientation === orientation) {\n return oldRoot;\n }\n }\n\n // Create a new root node with the specified orientation.\n let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n // Add the old root to the new root.\n if (oldRoot) {\n newRoot.children.push(oldRoot);\n newRoot.sizers.push(Private.createSizer(0));\n newRoot.handles.push(this._createHandle());\n oldRoot.parent = newRoot;\n }\n\n // Return the new root as a convenience.\n return newRoot;\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the size limits for the layout tree.\n if (this._root) {\n let limits = this._root.fit(this._spacing, this._items);\n minW = limits.minWidth;\n minH = limits.minHeight;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Bail early if there is no root layout node.\n if (!this._root) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let x = this._box.paddingTop;\n let y = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the geometry of the layout tree.\n this._root.update(x, y, width, height, this._spacing, this._items);\n }\n\n /**\n * Create a new tab bar for use by the dock layout.\n *\n * #### Notes\n * The tab bar will be attached to the parent if it exists.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar using the renderer.\n let tabBar = this.renderer.createTabBar(this._document);\n\n // Enforce necessary tab bar behavior.\n tabBar.orientation = 'horizontal';\n\n // Attach the tab bar to the parent if possible.\n if (this.parent) {\n this.attachWidget(tabBar);\n }\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for the dock layout.\n *\n * #### Notes\n * The handle will be attached to the parent if it exists.\n */\n private _createHandle(): HTMLDivElement {\n // Create the handle using the renderer.\n let handle = this.renderer.createHandle();\n\n // Initialize the handle layout behavior.\n let style = handle.style;\n style.position = 'absolute';\n style.contain = 'strict';\n style.top = '0';\n style.left = '0';\n style.width = '0';\n style.height = '0';\n\n // Attach the handle to the parent if it exists.\n if (this.parent) {\n this.parent.node.appendChild(handle);\n }\n\n // Return the initialized handle.\n return handle;\n }\n\n private _spacing = 4;\n private _dirty = false;\n private _root: Private.LayoutNode | null = null;\n private _box: ElementExt.IBoxSizing | null = null;\n private _document: Document | ShadowRoot;\n private _hiddenMode: Widget.HiddenMode;\n private _items: Private.ItemMap = new Map();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n /**\n * An options object for creating a dock layout.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * The renderer to use for the dock layout.\n */\n renderer: IRenderer;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a dock layout.\n */\n export interface IRenderer {\n /**\n * Create a new tab bar for use with a dock layout.\n *\n * @returns A new tab bar for a dock layout.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar;\n\n /**\n * Create a new handle node for use with a dock layout.\n *\n * @returns A new handle node for a dock layout.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * A type alias for the supported insertion modes.\n *\n * An insert mode is used to specify how a widget should be added\n * to the dock layout relative to a reference widget.\n */\n export type InsertMode =\n | /**\n * The area to the top of the reference widget.\n *\n * The widget will be inserted just above the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the top edge of the dock layout.\n */\n 'split-top'\n\n /**\n * The area to the left of the reference widget.\n *\n * The widget will be inserted just left of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the left edge of the dock layout.\n */\n | 'split-left'\n\n /**\n * The area to the right of the reference widget.\n *\n * The widget will be inserted just right of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the right edge of the dock layout.\n */\n | 'split-right'\n\n /**\n * The area to the bottom of the reference widget.\n *\n * The widget will be inserted just below the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the bottom edge of the dock layout.\n */\n | 'split-bottom'\n\n /**\n * Like `split-top` but if a tab layout exists above the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-top'\n\n /**\n * Like `split-left` but if a tab layout exists left of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-left'\n\n /**\n * Like `split-right` but if a tab layout exists right of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-right'\n\n /**\n * Like `split-bottom` but if a tab layout exists below the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-bottom'\n\n /**\n * The tab position before the reference widget.\n *\n * The widget will be added as a tab before the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-before'\n\n /**\n * The tab position after the reference widget.\n *\n * The widget will be added as a tab after the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-after';\n\n /**\n * An options object for adding a widget to the dock layout.\n */\n export interface IAddOptions {\n /**\n * The insertion mode for adding the widget.\n *\n * The default is `'tab-after'`.\n */\n mode?: InsertMode;\n\n /**\n * The reference widget for the insert location.\n *\n * The default is `null`.\n */\n ref?: Widget | null;\n }\n\n /**\n * A layout config object for a tab area.\n */\n export interface ITabAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'tab-area';\n\n /**\n * The widgets contained in the tab area.\n */\n widgets: Widget[];\n\n /**\n * The index of the selected tab.\n */\n currentIndex: number;\n }\n\n /**\n * A layout config object for a split area.\n */\n export interface ISplitAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'split-area';\n\n /**\n * The orientation of the split area.\n */\n orientation: 'horizontal' | 'vertical';\n\n /**\n * The children in the split area.\n */\n children: AreaConfig[];\n\n /**\n * The relative sizes of the children.\n */\n sizes: number[];\n }\n\n /**\n * A type alias for a general area config.\n */\n export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n /**\n * A dock layout configuration object.\n */\n export interface ILayoutConfig {\n /**\n * The layout config for the main dock area.\n */\n main: AreaConfig | null;\n }\n\n /**\n * An object which represents the geometry of a tab area.\n */\n export interface ITabAreaGeometry {\n /**\n * The tab bar for the tab area.\n */\n tabBar: TabBar;\n\n /**\n * The local X position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the local X coordinate of the hit test query.\n */\n x: number;\n\n /**\n * The local Y position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the local Y coordinate of the hit test query.\n */\n y: number;\n\n /**\n * The local coordinate of the top edge of the tab area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the top edge of the tab area.\n */\n top: number;\n\n /**\n * The local coordinate of the left edge of the tab area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the left edge of the tab area.\n */\n left: number;\n\n /**\n * The local coordinate of the right edge of the tab area.\n *\n * #### Notes\n * This is the distance from the right edge of the layout parent\n * widget, to the right edge of the tab area.\n */\n right: number;\n\n /**\n * The local coordinate of the bottom edge of the tab area.\n *\n * #### Notes\n * This is the distance from the bottom edge of the layout parent\n * widget, to the bottom edge of the tab area.\n */\n bottom: number;\n\n /**\n * The width of the tab area.\n *\n * #### Notes\n * This is total width allocated for the tab area.\n */\n width: number;\n\n /**\n * The height of the tab area.\n *\n * #### Notes\n * This is total height allocated for the tab area.\n */\n height: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * A type alias for a dock layout node.\n */\n export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n /**\n * A type alias for the orientation of a split layout node.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a layout item map.\n */\n export type ItemMap = Map;\n\n /**\n * Create a box sizer with an initial size hint.\n */\n export function createSizer(hint: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = hint;\n sizer.size = hint;\n return sizer;\n }\n\n /**\n * Normalize an area config object and collect the visited widgets.\n */\n export function normalizeAreaConfig(\n config: DockLayout.AreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n let result: DockLayout.AreaConfig | null;\n if (config.type === 'tab-area') {\n result = normalizeTabAreaConfig(config, widgetSet);\n } else {\n result = normalizeSplitAreaConfig(config, widgetSet);\n }\n return result;\n }\n\n /**\n * Convert a normalized area config into a layout tree.\n */\n export function realizeAreaConfig(\n config: DockLayout.AreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): LayoutNode {\n let node: LayoutNode;\n if (config.type === 'tab-area') {\n node = realizeTabAreaConfig(config, renderer, document);\n } else {\n node = realizeSplitAreaConfig(config, renderer, document);\n }\n return node;\n }\n\n /**\n * A layout node which holds the data for a tabbed area.\n */\n export class TabLayoutNode {\n /**\n * Construct a new tab layout node.\n *\n * @param tabBar - The tab bar to use for the layout node.\n */\n constructor(tabBar: TabBar) {\n let tabSizer = new BoxSizer();\n let widgetSizer = new BoxSizer();\n tabSizer.stretch = 0;\n widgetSizer.stretch = 1;\n this.tabBar = tabBar;\n this.sizers = [tabSizer, widgetSizer];\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * The tab bar for the layout node.\n */\n readonly tabBar: TabBar;\n\n /**\n * The sizers for the layout node.\n */\n readonly sizers: [BoxSizer, BoxSizer];\n\n /**\n * The most recent value for the `top` edge of the layout box.\n */\n get top(): number {\n return this._top;\n }\n\n /**\n * The most recent value for the `left` edge of the layout box.\n */\n get left(): number {\n return this._left;\n }\n\n /**\n * The most recent value for the `width` of the layout box.\n */\n get width(): number {\n return this._width;\n }\n\n /**\n * The most recent value for the `height` of the layout box.\n */\n get height(): number {\n return this._height;\n }\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n yield this.tabBar;\n yield* this.iterUserWidgets();\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const title of this.tabBar.titles) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n let title = this.tabBar.currentTitle;\n if (title) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n yield this.tabBar;\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n // eslint-disable-next-line require-yield\n *iterHandles(): IterableIterator {\n return;\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n return this;\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n if (x < this._left || x >= this._left + this._width) {\n return null;\n }\n if (y < this._top || y >= this._top + this._height) {\n return null;\n }\n return this;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ITabAreaConfig {\n let widgets = this.tabBar.titles.map(title => title.owner);\n let currentIndex = this.tabBar.currentIndex;\n return { type: 'tab-area', widgets, currentIndex };\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n return;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Set up the limit variables.\n let minWidth = 0;\n let minHeight = 0;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Lookup the tab bar and widget sizers.\n let [tabBarSizer, widgetSizer] = this.sizers;\n\n // Update the tab bar limits.\n if (tabBarItem) {\n tabBarItem.fit();\n }\n\n // Update the widget limits.\n if (widgetItem) {\n widgetItem.fit();\n }\n\n // Update the results and sizer for the tab bar.\n if (tabBarItem && !tabBarItem.isHidden) {\n minWidth = Math.max(minWidth, tabBarItem.minWidth);\n minHeight += tabBarItem.minHeight;\n tabBarSizer.minSize = tabBarItem.minHeight;\n tabBarSizer.maxSize = tabBarItem.maxHeight;\n } else {\n tabBarSizer.minSize = 0;\n tabBarSizer.maxSize = 0;\n }\n\n // Update the results and sizer for the current widget.\n if (widgetItem && !widgetItem.isHidden) {\n minWidth = Math.max(minWidth, widgetItem.minWidth);\n minHeight += widgetItem.minHeight;\n widgetSizer.minSize = widgetItem.minHeight;\n widgetSizer.maxSize = Infinity;\n } else {\n widgetSizer.minSize = 0;\n widgetSizer.maxSize = Infinity;\n }\n\n // Return the computed size limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Update the layout box values.\n this._top = top;\n this._left = left;\n this._width = width;\n this._height = height;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, height);\n\n // Update the tab bar item using the computed size.\n if (tabBarItem && !tabBarItem.isHidden) {\n let size = this.sizers[0].size;\n tabBarItem.update(left, top, width, size);\n top += size;\n }\n\n // Layout the widget using the computed size.\n if (widgetItem && !widgetItem.isHidden) {\n let size = this.sizers[1].size;\n widgetItem.update(left, top, width, size);\n }\n }\n\n private _top = 0;\n private _left = 0;\n private _width = 0;\n private _height = 0;\n }\n\n /**\n * A layout node which holds the data for a split area.\n */\n export class SplitLayoutNode {\n /**\n * Construct a new split layout node.\n *\n * @param orientation - The orientation of the node.\n */\n constructor(orientation: Orientation) {\n this.orientation = orientation;\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * Whether the sizers have been normalized.\n */\n normalized = false;\n\n /**\n * The orientation of the node.\n */\n readonly orientation: Orientation;\n\n /**\n * The child nodes for the split node.\n */\n readonly children: LayoutNode[] = [];\n\n /**\n * The box sizers for the layout children.\n */\n readonly sizers: BoxSizer[] = [];\n\n /**\n * The handles for the layout children.\n */\n readonly handles: HTMLDivElement[] = [];\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterAllWidgets();\n }\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterUserWidgets();\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterSelectedWidgets();\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n for (const child of this.children) {\n yield* child.iterTabBars();\n }\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n *iterHandles(): IterableIterator {\n yield* this.handles;\n for (const child of this.children) {\n yield* child.iterHandles();\n }\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findTabNode(widget);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n let index = this.handles.indexOf(handle);\n if (index !== -1) {\n return { index, node: this };\n }\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findSplitNode(handle);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n if (this.children.length === 0) {\n return null;\n }\n return this.children[0].findFirstTabNode();\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].hitTestTabNodes(x, y);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ISplitAreaConfig {\n let orientation = this.orientation;\n let sizes = this.createNormalizedSizes();\n let children = this.children.map(child => child.createConfig());\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Sync the visibility and orientation of the handles.\n */\n syncHandles(): void {\n this.handles.forEach((handle, i) => {\n handle.setAttribute('data-orientation', this.orientation);\n if (i === this.handles.length - 1) {\n handle.classList.add('lm-mod-hidden');\n } else {\n handle.classList.remove('lm-mod-hidden');\n }\n });\n }\n\n /**\n * Hold the current sizes of the box sizers.\n *\n * This sets the size hint of each sizer to its current size.\n */\n holdSizes(): void {\n for (const sizer of this.sizers) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n for (const child of this.children) {\n child.holdAllSizes();\n }\n this.holdSizes();\n }\n\n /**\n * Normalize the sizes of the split layout node.\n */\n normalizeSizes(): void {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return;\n }\n\n // Hold the current sizes of the sizers.\n this.holdSizes();\n\n // Compute the sum of the sizes.\n let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint = 1 / n;\n }\n } else {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint /= sum;\n }\n }\n\n // Mark the sizes as normalized.\n this.normalized = true;\n }\n\n /**\n * Snap the normalized sizes of the split layout node.\n */\n createNormalizedSizes(): number[] {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return [];\n }\n\n // Grab the current sizes of the sizers.\n let sizes = this.sizers.map(sizer => sizer.size);\n\n // Compute the sum of the sizes.\n let sum = sizes.reduce((v, size) => v + size, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] = 1 / n;\n }\n } else {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] /= sum;\n }\n }\n\n // Return the normalized sizes.\n return sizes;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Compute the required fixed space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n // Set up the limit variables.\n let minWidth = horizontal ? fixed : 0;\n let minHeight = horizontal ? 0 : fixed;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Fit the children and update the limits.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let limits = this.children[i].fit(spacing, items);\n if (horizontal) {\n minHeight = Math.max(minHeight, limits.minHeight);\n minWidth += limits.minWidth;\n this.sizers[i].minSize = limits.minWidth;\n } else {\n minWidth = Math.max(minWidth, limits.minWidth);\n minHeight += limits.minHeight;\n this.sizers[i].minSize = limits.minHeight;\n }\n }\n\n // Return the computed limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Compute the available layout space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n // De-normalize the sizes if needed.\n if (this.normalized) {\n for (const sizer of this.sizers) {\n sizer.sizeHint *= space;\n }\n this.normalized = false;\n }\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, space);\n\n // Update the geometry of the child nodes and handles.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let child = this.children[i];\n let size = this.sizers[i].size;\n let handleStyle = this.handles[i].style;\n if (horizontal) {\n child.update(left, top, size, height, spacing, items);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${spacing}px`;\n handleStyle.height = `${height}px`;\n left += spacing;\n } else {\n child.update(left, top, width, size, spacing, items);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${spacing}px`;\n top += spacing;\n }\n }\n }\n }\n\n export function addAria(widget: Widget, tabBar: TabBar): void {\n widget.node.setAttribute('role', 'tabpanel');\n let renderer = tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n export function removeAria(widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n }\n\n /**\n * Normalize a tab area config and collect the visited widgets.\n */\n function normalizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n widgetSet: Set\n ): DockLayout.ITabAreaConfig | null {\n // Bail early if there is no content.\n if (config.widgets.length === 0) {\n return null;\n }\n\n // Setup the filtered widgets array.\n let widgets: Widget[] = [];\n\n // Filter the config for unique widgets.\n for (const widget of config.widgets) {\n if (!widgetSet.has(widget)) {\n widgetSet.add(widget);\n widgets.push(widget);\n }\n }\n\n // Bail if there are no effective widgets.\n if (widgets.length === 0) {\n return null;\n }\n\n // Normalize the current index.\n let index = config.currentIndex;\n if (index !== -1 && (index < 0 || index >= widgets.length)) {\n index = 0;\n }\n\n // Return a normalized config object.\n return { type: 'tab-area', widgets, currentIndex: index };\n }\n\n /**\n * Normalize a split area config and collect the visited widgets.\n */\n function normalizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n // Set up the result variables.\n let orientation = config.orientation;\n let children: DockLayout.AreaConfig[] = [];\n let sizes: number[] = [];\n\n // Normalize the config children.\n for (let i = 0, n = config.children.length; i < n; ++i) {\n // Normalize the child config.\n let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n // Ignore an empty child.\n if (!child) {\n continue;\n }\n\n // Add the child or hoist its content as appropriate.\n if (child.type === 'tab-area' || child.orientation !== orientation) {\n children.push(child);\n sizes.push(Math.abs(config.sizes[i] || 0));\n } else {\n children.push(...child.children);\n sizes.push(...child.sizes);\n }\n }\n\n // Bail if there are no effective children.\n if (children.length === 0) {\n return null;\n }\n\n // If there is only one effective child, return that child.\n if (children.length === 1) {\n return children[0];\n }\n\n // Return a normalized config object.\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Convert a normalized tab area config into a layout tree.\n */\n function realizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): TabLayoutNode {\n // Create the tab bar for the layout node.\n let tabBar = renderer.createTabBar(document);\n\n // Hide each widget and add it to the tab bar.\n for (const widget of config.widgets) {\n widget.hide();\n tabBar.addTab(widget.title);\n Private.addAria(widget, tabBar);\n }\n\n // Set the current index of the tab bar.\n tabBar.currentIndex = config.currentIndex;\n\n // Return the new tab layout node.\n return new TabLayoutNode(tabBar);\n }\n\n /**\n * Convert a normalized split area config into a layout tree.\n */\n function realizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): SplitLayoutNode {\n // Create the split layout node.\n let node = new SplitLayoutNode(config.orientation);\n\n // Add each child to the layout node.\n config.children.forEach((child, i) => {\n // Create the child data for the layout node.\n let childNode = realizeAreaConfig(child, renderer, document);\n let sizer = createSizer(config.sizes[i]);\n let handle = renderer.createHandle();\n\n // Add the child data to the layout node.\n node.children.push(childNode);\n node.handles.push(handle);\n node.sizers.push(sizer);\n\n // Update the parent for the child node.\n childNode.parent = node;\n });\n\n // Synchronize the handle state for the layout node.\n node.syncHandles();\n\n // Normalize the sizes for the layout node.\n node.normalizeSizes();\n\n // Return the new layout node.\n return node;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n */\nexport class DockPanel extends Widget {\n /**\n * Construct a new dock panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: DockPanel.IOptions = {}) {\n super();\n this.addClass('lm-DockPanel');\n this._document = options.document || document;\n this._mode = options.mode || 'multiple-document';\n this._renderer = options.renderer || DockPanel.defaultRenderer;\n this._edges = options.edges || Private.DEFAULT_EDGES;\n if (options.tabsMovable !== undefined) {\n this._tabsMovable = options.tabsMovable;\n }\n if (options.tabsConstrained !== undefined) {\n this._tabsConstrained = options.tabsConstrained;\n }\n if (options.addButtonEnabled !== undefined) {\n this._addButtonEnabled = options.addButtonEnabled;\n }\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = this._mode;\n\n // Create the delegate renderer for the layout.\n let renderer: DockPanel.IRenderer = {\n createTabBar: () => this._createTabBar(),\n createHandle: () => this._createHandle()\n };\n\n // Set up the dock layout for the panel.\n this.layout = new DockLayout({\n document: this._document,\n renderer,\n spacing: options.spacing,\n hiddenMode: options.hiddenMode\n });\n\n // Set up the overlay drop indicator.\n this.overlay = options.overlay || new DockPanel.Overlay();\n this.node.appendChild(this.overlay.node);\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n // Ensure the mouse is released.\n this._releaseMouse();\n\n // Hide the overlay.\n this.overlay.hide(0);\n\n // Cancel a drag if one is in progress.\n if (this._drag) {\n this._drag.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The method for hiding widgets.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as DockLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as DockLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when the layout configuration is modified.\n *\n * #### Notes\n * This signal is emitted whenever the current layout configuration\n * may have changed.\n *\n * This signal is emitted asynchronously in a collapsed fashion, so\n * that multiple synchronous modifications results in only a single\n * emit of the signal.\n */\n get layoutModified(): ISignal {\n return this._layoutModified;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The overlay used by the dock panel.\n */\n readonly overlay: DockPanel.IOverlay;\n\n /**\n * The renderer used by the dock panel.\n */\n get renderer(): DockPanel.IRenderer {\n return (this.layout as DockLayout).renderer;\n }\n\n /**\n * Get the spacing between the widgets.\n */\n get spacing(): number {\n return (this.layout as DockLayout).spacing;\n }\n\n /**\n * Set the spacing between the widgets.\n */\n set spacing(value: number) {\n (this.layout as DockLayout).spacing = value;\n }\n\n /**\n * Get the mode for the dock panel.\n */\n get mode(): DockPanel.Mode {\n return this._mode;\n }\n\n /**\n * Set the mode for the dock panel.\n *\n * #### Notes\n * Changing the mode is a destructive operation with respect to the\n * panel's layout configuration. If layout state must be preserved,\n * save the current layout config before changing the mode.\n */\n set mode(value: DockPanel.Mode) {\n // Bail early if the mode does not change.\n if (this._mode === value) {\n return;\n }\n\n // Update the internal mode.\n this._mode = value;\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = value;\n\n // Get the layout for the panel.\n let layout = this.layout as DockLayout;\n\n // Configure the layout for the specified mode.\n switch (value) {\n case 'multiple-document':\n for (const tabBar of layout.tabBars()) {\n tabBar.show();\n }\n break;\n case 'single-document':\n layout.restoreLayout(Private.createSingleDocumentConfig(this));\n break;\n default:\n throw 'unreachable';\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Whether the tabs can be dragged / moved at runtime.\n */\n get tabsMovable(): boolean {\n return this._tabsMovable;\n }\n\n /**\n * Enable / Disable draggable / movable tabs.\n */\n set tabsMovable(value: boolean) {\n this._tabsMovable = value;\n for (const tabBar of this.tabBars()) {\n tabBar.tabsMovable = value;\n }\n }\n\n /**\n * Whether the tabs are constrained to their source dock panel\n */\n get tabsConstrained(): boolean {\n return this._tabsConstrained;\n }\n\n /**\n * Constrain/Allow tabs to be dragged outside of this dock panel\n */\n set tabsConstrained(value: boolean) {\n this._tabsConstrained = value;\n }\n\n /**\n * Whether the add buttons for each tab bar are enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add buttons for each tab bar are enabled.\n */\n set addButtonEnabled(value: boolean) {\n this._addButtonEnabled = value;\n for (const tabBar of this.tabBars()) {\n tabBar.addButtonEnabled = value;\n }\n }\n\n /**\n * Whether the dock panel is empty.\n */\n get isEmpty(): boolean {\n return (this.layout as DockLayout).isEmpty;\n }\n\n /**\n * Create an iterator over the user widgets in the panel.\n *\n * @returns A new iterator over the user widgets in the panel.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n *widgets(): IterableIterator {\n yield* (this.layout as DockLayout).widgets();\n }\n\n /**\n * Create an iterator over the selected widgets in the panel.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the panel.\n */\n *selectedWidgets(): IterableIterator {\n yield* (this.layout as DockLayout).selectedWidgets();\n }\n\n /**\n * Create an iterator over the tab bars in the panel.\n *\n * @returns A new iterator over the tab bars in the panel.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n *tabBars(): IterableIterator> {\n yield* (this.layout as DockLayout).tabBars();\n }\n\n /**\n * Create an iterator over the handles in the panel.\n *\n * @returns A new iterator over the handles in the panel.\n */\n *handles(): IterableIterator {\n yield* (this.layout as DockLayout).handles();\n }\n\n /**\n * Select a specific widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will make the widget the current widget in its tab area.\n */\n selectWidget(widget: Widget): void {\n // Find the tab bar which contains the widget.\n let tabBar = find(this.tabBars(), bar => {\n return bar.titles.indexOf(widget.title) !== -1;\n });\n\n // Throw an error if no tab bar is found.\n if (!tabBar) {\n throw new Error('Widget is not contained in the dock panel.');\n }\n\n // Ensure the widget is the current widget.\n tabBar.currentTitle = widget.title;\n }\n\n /**\n * Activate a specified widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will select and activate the given widget.\n */\n activateWidget(widget: Widget): void {\n this.selectWidget(widget);\n widget.activate();\n }\n\n /**\n * Save the current layout configuration of the dock panel.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockPanel.ILayoutConfig {\n return (this.layout as DockLayout).saveLayout();\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n *\n * The dock panel automatically reverts to `'multiple-document'`\n * mode when a layout config is restored.\n */\n restoreLayout(config: DockPanel.ILayoutConfig): void {\n // Reset the mode.\n this._mode = 'multiple-document';\n\n // Restore the layout.\n (this.layout as DockLayout).restoreLayout(config);\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Add a widget to the dock panel.\n *\n * @param widget - The widget to add to the dock panel.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * If the panel is in single document mode, the options are ignored\n * and the widget is always added as tab in the hidden tab bar.\n */\n addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n // Add the widget to the layout.\n if (this._mode === 'single-document') {\n (this.layout as DockLayout).addWidget(widget);\n } else {\n (this.layout as DockLayout).addWidget(widget, options);\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n */\n processMessage(msg: Message): void {\n if (msg.type === 'layout-modified') {\n this._layoutModified.emit(undefined);\n } else {\n super.processMessage(msg);\n }\n }\n\n /**\n * Handle the DOM events for the dock panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'lm-dragenter':\n this._evtDragEnter(event as Drag.Event);\n break;\n case 'lm-dragleave':\n this._evtDragLeave(event as Drag.Event);\n break;\n case 'lm-dragover':\n this._evtDragOver(event as Drag.Event);\n break;\n case 'lm-drop':\n this._evtDrop(event as Drag.Event);\n break;\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('lm-dragenter', this);\n this.node.addEventListener('lm-dragleave', this);\n this.node.addEventListener('lm-dragover', this);\n this.node.addEventListener('lm-drop', this);\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('lm-dragenter', this);\n this.node.removeEventListener('lm-dragleave', this);\n this.node.removeEventListener('lm-dragover', this);\n this.node.removeEventListener('lm-drop', this);\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Add the widget class to the child.\n msg.child.addClass('lm-DockPanel-widget');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Remove the widget class from the child.\n msg.child.removeClass('lm-DockPanel-widget');\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `'lm-dragenter'` event for the dock panel.\n */\n private _evtDragEnter(event: Drag.Event): void {\n // If the factory mime type is present, mark the event as\n // handled in order to get the rest of the drag events.\n if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handle the `'lm-dragleave'` event for the dock panel.\n */\n private _evtDragLeave(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n if (this._tabsConstrained && event.source !== this) return;\n\n event.stopPropagation();\n\n // The new target might be a descendant, so we might still handle the drop.\n // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n // hide is cancelled by the lm-dragover handler's show overlay logic.\n this.overlay.hide(1);\n }\n\n /**\n * Handle the `'lm-dragover'` event for the dock panel.\n */\n private _evtDragOver(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Show the drop indicator overlay and update the drop\n // action based on the drop target zone under the mouse.\n if (\n (this._tabsConstrained && event.source !== this) ||\n this._showOverlay(event.clientX, event.clientY) === 'invalid'\n ) {\n event.dropAction = 'none';\n } else {\n event.stopPropagation();\n event.dropAction = event.proposedAction;\n }\n }\n\n /**\n * Handle the `'lm-drop'` event for the dock panel.\n */\n private _evtDrop(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Hide the drop indicator overlay.\n this.overlay.hide(0);\n\n // Bail if the proposed action is to do nothing.\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n\n // Find the drop target under the mouse.\n let { clientX, clientY } = event;\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // Bail if the drop zone is invalid.\n if (\n (this._tabsConstrained && event.source !== this) ||\n zone === 'invalid'\n ) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory mime type has invalid data.\n let mimeData = event.mimeData;\n let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n if (typeof factory !== 'function') {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory does not produce a widget.\n let widget = factory();\n if (!(widget instanceof Widget)) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the widget is an ancestor of the dock panel.\n if (widget.contains(this)) {\n event.dropAction = 'none';\n return;\n }\n\n // Find the reference widget for the drop target.\n let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n // Add the widget according to the indicated drop zone.\n switch (zone) {\n case 'root-all':\n this.addWidget(widget);\n break;\n case 'root-top':\n this.addWidget(widget, { mode: 'split-top' });\n break;\n case 'root-left':\n this.addWidget(widget, { mode: 'split-left' });\n break;\n case 'root-right':\n this.addWidget(widget, { mode: 'split-right' });\n break;\n case 'root-bottom':\n this.addWidget(widget, { mode: 'split-bottom' });\n break;\n case 'widget-all':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n case 'widget-top':\n this.addWidget(widget, { mode: 'split-top', ref });\n break;\n case 'widget-left':\n this.addWidget(widget, { mode: 'split-left', ref });\n break;\n case 'widget-right':\n this.addWidget(widget, { mode: 'split-right', ref });\n break;\n case 'widget-bottom':\n this.addWidget(widget, { mode: 'split-bottom', ref });\n break;\n case 'widget-tab':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n default:\n throw 'unreachable';\n }\n\n // Accept the proposed drop action.\n event.dropAction = event.proposedAction;\n\n // Stop propagation if we have not bailed so far.\n event.stopPropagation();\n\n // Activate the dropped widget.\n this.activateWidget(widget);\n }\n\n /**\n * Handle the `'keydown'` event for the dock panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the dock panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the left mouse button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the mouse target, if any.\n let layout = this.layout as DockLayout;\n let target = event.target as HTMLElement;\n let handle = find(layout.handles(), handle => handle.contains(target));\n if (!handle) {\n return;\n }\n\n // Stop the event when a handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n this._document.addEventListener('keydown', this, true);\n this._document.addEventListener('pointerup', this, true);\n this._document.addEventListener('pointermove', this, true);\n this._document.addEventListener('contextmenu', this, true);\n\n // Compute the offset deltas for the handle press.\n let rect = handle.getBoundingClientRect();\n let deltaX = event.clientX - rect.left;\n let deltaY = event.clientY - rect.top;\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!, this._document);\n this._pressData = { handle, deltaX, deltaY, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the dock panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event when dragging a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let rect = this.node.getBoundingClientRect();\n let xPos = event.clientX - rect.left - this._pressData.deltaX;\n let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n // Set the handle as close to the desired position as possible.\n let layout = this.layout as DockLayout;\n layout.moveHandle(this._pressData.handle, xPos, yPos);\n }\n\n /**\n * Handle the `'pointerup'` event for the dock panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the left mouse button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Release the mouse grab for the dock panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra document listeners.\n this._document.removeEventListener('keydown', this, true);\n this._document.removeEventListener('pointerup', this, true);\n this._document.removeEventListener('pointermove', this, true);\n this._document.removeEventListener('contextmenu', this, true);\n }\n\n /**\n * Show the overlay indicator at the given client position.\n *\n * Returns the drop zone at the specified client position.\n *\n * #### Notes\n * If the position is not over a valid zone, the overlay is hidden.\n */\n private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n // Find the dock target for the given client position.\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // If the drop zone is invalid, hide the overlay and bail.\n if (zone === 'invalid') {\n this.overlay.hide(100);\n return zone;\n }\n\n // Setup the variables needed to compute the overlay geometry.\n let top: number;\n let left: number;\n let right: number;\n let bottom: number;\n let box = ElementExt.boxSizing(this.node); // TODO cache this?\n let rect = this.node.getBoundingClientRect();\n\n // Compute the overlay geometry based on the dock zone.\n switch (zone) {\n case 'root-all':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-top':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = rect.height * Private.GOLDEN_RATIO;\n break;\n case 'root-left':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = rect.width * Private.GOLDEN_RATIO;\n bottom = box.paddingBottom;\n break;\n case 'root-right':\n top = box.paddingTop;\n left = rect.width * Private.GOLDEN_RATIO;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-bottom':\n top = rect.height * Private.GOLDEN_RATIO;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'widget-all':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-top':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height / 2;\n break;\n case 'widget-left':\n top = target!.top;\n left = target!.left;\n right = target!.right + target!.width / 2;\n bottom = target!.bottom;\n break;\n case 'widget-right':\n top = target!.top;\n left = target!.left + target!.width / 2;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-bottom':\n top = target!.top + target!.height / 2;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-tab': {\n const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height - tabHeight;\n break;\n }\n default:\n throw 'unreachable';\n }\n\n // Show the overlay with the computed geometry.\n this.overlay.show({ top, left, right, bottom });\n\n // Finally, return the computed drop zone.\n return zone;\n }\n\n /**\n * Create a new tab bar for use by the panel.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar.\n let tabBar = this._renderer.createTabBar(this._document);\n\n // Set the generated tab bar property for the tab bar.\n Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n // Hide the tab bar when in single document mode.\n if (this._mode === 'single-document') {\n tabBar.hide();\n }\n\n // Enforce necessary tab bar behavior.\n // TODO do we really want to enforce *all* of these?\n tabBar.tabsMovable = this._tabsMovable;\n tabBar.allowDeselect = false;\n tabBar.addButtonEnabled = this._addButtonEnabled;\n tabBar.removeBehavior = 'select-previous-tab';\n tabBar.insertBehavior = 'select-tab-if-needed';\n\n // Connect the signal handlers for the tab bar.\n tabBar.tabMoved.connect(this._onTabMoved, this);\n tabBar.currentChanged.connect(this._onCurrentChanged, this);\n tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for use by the panel.\n */\n private _createHandle(): HTMLDivElement {\n return this._renderer.createHandle();\n }\n\n /**\n * Handle the `tabMoved` signal from a tab bar.\n */\n private _onTabMoved(): void {\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `currentChanged` signal from a tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousTitle, currentTitle } = args;\n\n // Hide the previous widget.\n if (previousTitle) {\n previousTitle.owner.hide();\n }\n\n // Show the current widget.\n if (currentTitle) {\n currentTitle.owner.show();\n }\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `addRequested` signal from a tab bar.\n */\n private _onTabAddRequested(sender: TabBar): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from a tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from a tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabDetachRequested` signal from a tab bar.\n */\n private _onTabDetachRequested(\n sender: TabBar,\n args: TabBar.ITabDetachRequestedArgs\n ): void {\n // Do nothing if a drag is already in progress.\n if (this._drag) {\n return;\n }\n\n // Release the tab bar's hold on the mouse.\n sender.releaseMouse();\n\n // Extract the data from the args.\n let { title, tab, clientX, clientY, offset } = args;\n\n // Setup the mime data for the drag operation.\n let mimeData = new MimeData();\n let factory = () => title.owner;\n mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n // Create the drag image for the drag operation.\n let dragImage = tab.cloneNode(true) as HTMLElement;\n if (offset) {\n dragImage.style.top = `-${offset.y}px`;\n dragImage.style.left = `-${offset.x}px`;\n }\n\n // Create the drag object to manage the drag-drop operation.\n this._drag = new Drag({\n document: this._document,\n mimeData,\n dragImage,\n proposedAction: 'move',\n supportedActions: 'move',\n source: this\n });\n\n // Hide the tab node in the original tab.\n tab.classList.add('lm-mod-hidden');\n let cleanup = () => {\n this._drag = null;\n tab.classList.remove('lm-mod-hidden');\n };\n\n // Start the drag operation and cleanup when done.\n this._drag.start(clientX, clientY).then(cleanup);\n }\n\n private _edges: DockPanel.IEdges;\n private _document: Document | ShadowRoot;\n private _mode: DockPanel.Mode;\n private _drag: Drag | null = null;\n private _renderer: DockPanel.IRenderer;\n private _tabsMovable: boolean = true;\n private _tabsConstrained: boolean = false;\n private _addButtonEnabled: boolean = false;\n private _pressData: Private.IPressData | null = null;\n private _layoutModified = new Signal(this);\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n /**\n * An options object for creating a dock panel.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n /**\n * The overlay to use with the dock panel.\n *\n * The default is a new `Overlay` instance.\n */\n overlay?: IOverlay;\n\n /**\n * The renderer to use for the dock panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The spacing between the items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The mode for the dock panel.\n *\n * The default is `'multiple-document'`.\n */\n mode?: DockPanel.Mode;\n\n /**\n * The sizes of the edge drop zones, in pixels.\n * If not given, default values will be used.\n */\n edges?: IEdges;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * Allow tabs to be draggable / movable by user.\n *\n * The default is `'true'`.\n */\n tabsMovable?: boolean;\n\n /**\n * Constrain tabs to this dock panel\n *\n * The default is `'false'`.\n */\n tabsConstrained?: boolean;\n\n /**\n * Enable add buttons in each of the dock panel's tab bars.\n *\n * The default is `'false'`.\n */\n addButtonEnabled?: boolean;\n }\n\n /**\n * The sizes of the edge drop zones, in pixels.\n */\n export interface IEdges {\n /**\n * The size of the top edge drop zone.\n */\n top: number;\n\n /**\n * The size of the right edge drop zone.\n */\n right: number;\n\n /**\n * The size of the bottom edge drop zone.\n */\n bottom: number;\n\n /**\n * The size of the left edge drop zone.\n */\n left: number;\n }\n\n /**\n * A type alias for the supported dock panel modes.\n */\n export type Mode =\n | /**\n * The single document mode.\n *\n * In this mode, only a single widget is visible at a time, and that\n * widget fills the available layout space. No tab bars are visible.\n */\n 'single-document'\n\n /**\n * The multiple document mode.\n *\n * In this mode, multiple documents are displayed in separate tab\n * areas, and those areas can be individually resized by the user.\n */\n | 'multiple-document';\n\n /**\n * A type alias for a layout configuration object.\n */\n export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n /**\n * A type alias for the supported insertion modes.\n */\n export type InsertMode = DockLayout.InsertMode;\n\n /**\n * A type alias for the add widget options.\n */\n export type IAddOptions = DockLayout.IAddOptions;\n\n /**\n * An object which holds the geometry for overlay positioning.\n */\n export interface IOverlayGeometry {\n /**\n * The distance between the overlay and parent top edges.\n */\n top: number;\n\n /**\n * The distance between the overlay and parent left edges.\n */\n left: number;\n\n /**\n * The distance between the overlay and parent right edges.\n */\n right: number;\n\n /**\n * The distance between the overlay and parent bottom edges.\n */\n bottom: number;\n }\n\n /**\n * An object which manages the overlay node for a dock panel.\n */\n export interface IOverlay {\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n *\n * #### Notes\n * The given geometry values assume the node will use absolute\n * positioning.\n *\n * This is called on every mouse move event during a drag in order\n * to update the position of the overlay. It should be efficient.\n */\n show(geo: IOverlayGeometry): void;\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 should hide the overlay immediately.\n *\n * #### Notes\n * This is called whenever the overlay node should been hidden.\n */\n hide(delay: number): void;\n }\n\n /**\n * A concrete implementation of `IOverlay`.\n *\n * This is the default overlay implementation for a dock panel.\n */\n export class Overlay implements IOverlay {\n /**\n * Construct a new overlay.\n */\n constructor() {\n this.node = document.createElement('div');\n this.node.classList.add('lm-DockPanel-overlay');\n this.node.classList.add('lm-mod-hidden');\n this.node.style.position = 'absolute';\n this.node.style.contain = 'strict';\n }\n\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n */\n show(geo: IOverlayGeometry): void {\n // Update the position of the overlay.\n let style = this.node.style;\n style.top = `${geo.top}px`;\n style.left = `${geo.left}px`;\n style.right = `${geo.right}px`;\n style.bottom = `${geo.bottom}px`;\n\n // Clear any pending hide timer.\n clearTimeout(this._timer);\n this._timer = -1;\n\n // If the overlay is already visible, we're done.\n if (!this._hidden) {\n return;\n }\n\n // Clear the hidden flag.\n this._hidden = false;\n\n // Finally, show the overlay.\n this.node.classList.remove('lm-mod-hidden');\n }\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 will hide the overlay immediately.\n */\n hide(delay: number): void {\n // Do nothing if the overlay is already hidden.\n if (this._hidden) {\n return;\n }\n\n // Hide immediately if the delay is <= 0.\n if (delay <= 0) {\n clearTimeout(this._timer);\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n return;\n }\n\n // Do nothing if a hide is already pending.\n if (this._timer !== -1) {\n return;\n }\n\n // Otherwise setup the hide timer.\n this._timer = window.setTimeout(() => {\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n }, delay);\n }\n\n private _timer = -1;\n private _hidden = true;\n }\n\n /**\n * A type alias for a dock panel renderer;\n */\n export type IRenderer = DockLayout.IRenderer;\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new tab bar for use with a dock panel.\n *\n * @returns A new tab bar for a dock panel.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar {\n let bar = new TabBar({ document });\n bar.addClass('lm-DockPanel-tabBar');\n return bar;\n }\n\n /**\n * Create a new handle node for use with a dock panel.\n *\n * @returns A new handle node for a dock panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-DockPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * The default sizes for the edge drop zones, in pixels.\n */\n export const DEFAULT_EDGES = {\n /**\n * The size of the top edge dock zone for the root panel, in pixels.\n * This is different from the others to distinguish between the top\n * tab bar and the top root zone.\n */\n top: 12,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n right: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n bottom: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n left: 40\n };\n\n /**\n * A singleton `'layout-modified'` conflatable message.\n */\n export const LayoutModified = new ConflatableMessage('layout-modified');\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The handle which was pressed.\n */\n handle: HTMLDivElement;\n\n /**\n * The X offset of the press in handle coordinates.\n */\n deltaX: number;\n\n /**\n * The Y offset of the press in handle coordinates.\n */\n deltaY: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * A type alias for a drop zone.\n */\n export type DropZone =\n | /**\n * An invalid drop zone.\n */\n 'invalid'\n\n /**\n * The entirety of the root dock area.\n */\n | 'root-all'\n\n /**\n * The top portion of the root dock area.\n */\n | 'root-top'\n\n /**\n * The left portion of the root dock area.\n */\n | 'root-left'\n\n /**\n * The right portion of the root dock area.\n */\n | 'root-right'\n\n /**\n * The bottom portion of the root dock area.\n */\n | 'root-bottom'\n\n /**\n * The entirety of a tabbed widget area.\n */\n | 'widget-all'\n\n /**\n * The top portion of tabbed widget area.\n */\n | 'widget-top'\n\n /**\n * The left portion of tabbed widget area.\n */\n | 'widget-left'\n\n /**\n * The right portion of tabbed widget area.\n */\n | 'widget-right'\n\n /**\n * The bottom portion of tabbed widget area.\n */\n | 'widget-bottom'\n\n /**\n * The the bar of a tabbed widget area.\n */\n | 'widget-tab';\n\n /**\n * An object which holds the drop target zone and widget.\n */\n export interface IDropTarget {\n /**\n * The semantic zone for the mouse position.\n */\n zone: DropZone;\n\n /**\n * The tab area geometry for the drop zone, or `null`.\n */\n target: DockLayout.ITabAreaGeometry | null;\n }\n\n /**\n * An attached property used to track generated tab bars.\n */\n export const isGeneratedTabBarProperty = new AttachedProperty<\n Widget,\n boolean\n >({\n name: 'isGeneratedTabBar',\n create: () => false\n });\n\n /**\n * Create a single document config for the widgets in a dock panel.\n */\n export function createSingleDocumentConfig(\n panel: DockPanel\n ): DockPanel.ILayoutConfig {\n // Return an empty config if the panel is empty.\n if (panel.isEmpty) {\n return { main: null };\n }\n\n // Get a flat array of the widgets in the panel.\n let widgets = Array.from(panel.widgets());\n\n // Get the first selected widget in the panel.\n let selected = panel.selectedWidgets().next().value;\n\n // Compute the current index for the new config.\n let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n // Return the single document config.\n return { main: { type: 'tab-area', widgets, currentIndex } };\n }\n\n /**\n * Find the drop target at the given client position.\n */\n export function findDropTarget(\n panel: DockPanel,\n clientX: number,\n clientY: number,\n edges: DockPanel.IEdges\n ): IDropTarget {\n // Bail if the mouse is not over the dock panel.\n if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n return { zone: 'invalid', target: null };\n }\n\n // Look up the layout for the panel.\n let layout = panel.layout as DockLayout;\n\n // If the layout is empty, indicate the entire root drop zone.\n if (layout.isEmpty) {\n return { zone: 'root-all', target: null };\n }\n\n // Test the edge zones when in multiple document mode.\n if (panel.mode === 'multiple-document') {\n // Get the client rect for the dock panel.\n let panelRect = panel.node.getBoundingClientRect();\n\n // Compute the distance to each edge of the panel.\n let pl = clientX - panelRect.left + 1;\n let pt = clientY - panelRect.top + 1;\n let pr = panelRect.right - clientX;\n let pb = panelRect.bottom - clientY;\n\n // Find the minimum distance to an edge.\n let pd = Math.min(pt, pr, pb, pl);\n\n // Return a root zone if the mouse is within an edge.\n switch (pd) {\n case pt:\n if (pt < edges.top) {\n return { zone: 'root-top', target: null };\n }\n break;\n case pr:\n if (pr < edges.right) {\n return { zone: 'root-right', target: null };\n }\n break;\n case pb:\n if (pb < edges.bottom) {\n return { zone: 'root-bottom', target: null };\n }\n break;\n case pl:\n if (pl < edges.left) {\n return { zone: 'root-left', target: null };\n }\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Hit test the dock layout at the given client position.\n let target = layout.hitTestTabAreas(clientX, clientY);\n\n // Bail if no target area was found.\n if (!target) {\n return { zone: 'invalid', target: null };\n }\n\n // Return the whole tab area when in single document mode.\n if (panel.mode === 'single-document') {\n return { zone: 'widget-all', target };\n }\n\n // Compute the distance to each edge of the tab area.\n let al = target.x - target.left + 1;\n let at = target.y - target.top + 1;\n let ar = target.left + target.width - target.x;\n let ab = target.top + target.height - target.y;\n\n const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n if (at < tabHeight) {\n return { zone: 'widget-tab', target };\n }\n\n // Get the X and Y edge sizes for the area.\n let rx = Math.round(target.width / 3);\n let ry = Math.round(target.height / 3);\n\n // If the mouse is not within an edge, indicate the entire area.\n if (al > rx && ar > rx && at > ry && ab > ry) {\n return { zone: 'widget-all', target };\n }\n\n // Scale the distances by the slenderness ratio.\n al /= rx;\n at /= ry;\n ar /= rx;\n ab /= ry;\n\n // Find the minimum distance to the area edge.\n let ad = Math.min(al, at, ar, ab);\n\n // Find the widget zone for the area edge.\n let zone: DropZone;\n switch (ad) {\n case al:\n zone = 'widget-left';\n break;\n case at:\n zone = 'widget-top';\n break;\n case ar:\n zone = 'widget-right';\n break;\n case ab:\n zone = 'widget-bottom';\n break;\n default:\n throw 'unreachable';\n }\n\n // Return the final drop target.\n return { zone, target };\n }\n\n /**\n * Get the drop reference widget for a tab bar.\n */\n export function getDropRef(tabBar: TabBar): Widget | null {\n if (tabBar.titles.length === 0) {\n return null;\n }\n if (tabBar.currentTitle) {\n return tabBar.currentTitle.owner;\n }\n return tabBar.titles[tabBar.titles.length - 1].owner;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker implements IDisposable {\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose(): void {\n // Do nothing if the tracker is already disposed.\n if (this._counter < 0) {\n return;\n }\n\n // Mark the tracker as disposed.\n this._counter = -1;\n\n // Clear the connections for the tracker.\n Signal.clearData(this);\n\n // Remove all event listeners.\n for (const widget of this._widgets) {\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n }\n\n // Clear the internal data structures.\n this._activeWidget = null;\n this._currentWidget = null;\n this._nodes.clear();\n this._numbers.clear();\n this._widgets.length = 0;\n }\n\n /**\n * A signal emitted when the current widget has changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when the active widget has changed.\n */\n get activeChanged(): ISignal> {\n return this._activeChanged;\n }\n\n /**\n * A flag indicating whether the tracker is disposed.\n */\n get isDisposed(): boolean {\n return this._counter < 0;\n }\n\n /**\n * The current widget in the tracker.\n *\n * #### Notes\n * The current widget is the widget among the tracked widgets which\n * has the *descendant node* which has most recently been focused.\n *\n * The current widget will not be updated if the node loses focus. It\n * will only be updated when a different tracked widget gains focus.\n *\n * If the current widget is removed from the tracker, the previous\n * current widget will be restored.\n *\n * This behavior is intended to follow a user's conceptual model of\n * a semantically \"current\" widget, where the \"last thing of type X\"\n * to be interacted with is the \"current instance of X\", regardless\n * of whether that instance still has focus.\n */\n get currentWidget(): T | null {\n return this._currentWidget;\n }\n\n /**\n * The active widget in the tracker.\n *\n * #### Notes\n * The active widget is the widget among the tracked widgets which\n * has the *descendant node* which is currently focused.\n */\n get activeWidget(): T | null {\n return this._activeWidget;\n }\n\n /**\n * A read only array of the widgets being tracked.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Get the focus number for a particular widget in the tracker.\n *\n * @param widget - The widget of interest.\n *\n * @returns The focus number for the given widget, or `-1` if the\n * widget has not had focus since being added to the tracker, or\n * is not contained by the tracker.\n *\n * #### Notes\n * The focus number indicates the relative order in which the widgets\n * have gained focus. A widget with a larger number has gained focus\n * more recently than a widget with a smaller number.\n *\n * The `currentWidget` will always have the largest focus number.\n *\n * All widgets start with a focus number of `-1`, which indicates that\n * the widget has not been focused since being added to the tracker.\n */\n focusNumber(widget: T): number {\n let n = this._numbers.get(widget);\n return n === undefined ? -1 : n;\n }\n\n /**\n * Test whether the focus tracker contains a given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns `true` if the widget is tracked, `false` otherwise.\n */\n has(widget: T): boolean {\n return this._numbers.has(widget);\n }\n\n /**\n * Add a widget to the focus tracker.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is already tracked, this is a no-op.\n */\n add(widget: T): void {\n // Do nothing if the widget is already tracked.\n if (this._numbers.has(widget)) {\n return;\n }\n\n // Test whether the widget has focus.\n let focused = widget.node.contains(document.activeElement);\n\n // Set up the initial focus number.\n let n = focused ? this._counter++ : -1;\n\n // Add the widget to the internal data structures.\n this._widgets.push(widget);\n this._numbers.set(widget, n);\n this._nodes.set(widget.node, widget);\n\n // Set up the event listeners. The capturing phase must be used\n // since the 'focus' and 'blur' events don't bubble and Firefox\n // doesn't support the 'focusin' or 'focusout' events.\n widget.node.addEventListener('focus', this, true);\n widget.node.addEventListener('blur', this, true);\n\n // Connect the disposed signal handler.\n widget.disposed.connect(this._onWidgetDisposed, this);\n\n // Set the current and active widgets if needed.\n if (focused) {\n this._setWidgets(widget, widget);\n }\n }\n\n /**\n * Remove a widget from the focus tracker.\n *\n * #### Notes\n * If the widget is the `currentWidget`, the previous current widget\n * will become the new `currentWidget`.\n *\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is not tracked, this is a no-op.\n */\n remove(widget: T): void {\n // Bail early if the widget is not tracked.\n if (!this._numbers.has(widget)) {\n return;\n }\n\n // Disconnect the disposed signal handler.\n widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n // Remove the event listeners.\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n\n // Remove the widget from the internal data structures.\n ArrayExt.removeFirstOf(this._widgets, widget);\n this._nodes.delete(widget.node);\n this._numbers.delete(widget);\n\n // Bail early if the widget is not the current widget.\n if (this._currentWidget !== widget) {\n return;\n }\n\n // Filter the widgets for those which have had focus.\n let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n // Get the valid widget with the max focus number.\n let previous =\n max(valid, (first, second) => {\n let a = this._numbers.get(first)!;\n let b = this._numbers.get(second)!;\n return a - b;\n }) || null;\n\n // Set the current and active widgets.\n this._setWidgets(previous, null);\n }\n\n /**\n * Handle the DOM events for the focus tracker.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tracked nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n }\n }\n\n /**\n * Set the current and active widgets for the tracker.\n */\n private _setWidgets(current: T | null, active: T | null): void {\n // Swap the current widget.\n let oldCurrent = this._currentWidget;\n this._currentWidget = current;\n\n // Swap the active widget.\n let oldActive = this._activeWidget;\n this._activeWidget = active;\n\n // Emit the `currentChanged` signal if needed.\n if (oldCurrent !== current) {\n this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n }\n\n // Emit the `activeChanged` signal if needed.\n if (oldActive !== active) {\n this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n }\n }\n\n /**\n * Handle the `'focus'` event for a tracked widget.\n */\n private _evtFocus(event: FocusEvent): void {\n // Find the widget which gained focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Update the focus number if necessary.\n if (widget !== this._currentWidget) {\n this._numbers.set(widget, this._counter++);\n }\n\n // Set the current and active widgets.\n this._setWidgets(widget, widget);\n }\n\n /**\n * Handle the `'blur'` event for a tracked widget.\n */\n private _evtBlur(event: FocusEvent): void {\n // Find the widget which lost focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Get the node which being focused after this blur.\n let focusTarget = event.relatedTarget as HTMLElement;\n\n // If no other node is being focused, clear the active widget.\n if (!focusTarget) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n\n // Bail if the focus widget is not changing.\n if (widget.node.contains(focusTarget)) {\n return;\n }\n\n // If no tracked widget is being focused, clear the active widget.\n if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n }\n\n /**\n * Handle the `disposed` signal for a tracked widget.\n */\n private _onWidgetDisposed(sender: T): void {\n this.remove(sender);\n }\n\n private _counter = 0;\n private _widgets: T[] = [];\n private _activeWidget: T | null = null;\n private _currentWidget: T | null = null;\n private _numbers = new Map();\n private _nodes = new Map();\n private _activeChanged = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n /**\n * An arguments object for the changed signals.\n */\n export interface IChangedArgs {\n /**\n * The old value for the widget.\n */\n oldValue: T | null;\n\n /**\n * The new value for the widget.\n */\n newValue: T | null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n /**\n * Construct a new grid layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: GridLayout.IOptions = {}) {\n super(options);\n if (options.rowCount !== undefined) {\n Private.reallocSizers(this._rowSizers, options.rowCount);\n }\n if (options.columnCount !== undefined) {\n Private.reallocSizers(this._columnSizers, options.columnCount);\n }\n if (options.rowSpacing !== undefined) {\n this._rowSpacing = Private.clampValue(options.rowSpacing);\n }\n if (options.columnSpacing !== undefined) {\n this._columnSpacing = Private.clampValue(options.columnSpacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the widgets and layout items.\n for (const item of this._items) {\n let widget = item.widget;\n item.dispose();\n widget.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._rowStarts.length = 0;\n this._rowSizers.length = 0;\n this._columnStarts.length = 0;\n this._columnSizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the number of rows in the layout.\n */\n get rowCount(): number {\n return this._rowSizers.length;\n }\n\n /**\n * Set the number of rows in the layout.\n *\n * #### Notes\n * The minimum row count is `1`.\n */\n set rowCount(value: number) {\n // Do nothing if the row count does not change.\n if (value === this.rowCount) {\n return;\n }\n\n // Reallocate the row sizers.\n Private.reallocSizers(this._rowSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the number of columns in the layout.\n */\n get columnCount(): number {\n return this._columnSizers.length;\n }\n\n /**\n * Set the number of columns in the layout.\n *\n * #### Notes\n * The minimum column count is `1`.\n */\n set columnCount(value: number) {\n // Do nothing if the column count does not change.\n if (value === this.columnCount) {\n return;\n }\n\n // Reallocate the column sizers.\n Private.reallocSizers(this._columnSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the row spacing for the layout.\n */\n get rowSpacing(): number {\n return this._rowSpacing;\n }\n\n /**\n * Set the row spacing for the layout.\n */\n set rowSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._rowSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._rowSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the column spacing for the layout.\n */\n get columnSpacing(): number {\n return this._columnSpacing;\n }\n\n /**\n * Set the col spacing for the layout.\n */\n set columnSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._columnSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._columnSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @returns The stretch factor for the row.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n rowStretch(index: number): number {\n let sizer = this._rowSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @param value - The stretch factor for the row.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setRowStretch(index: number, value: number): void {\n // Look up the row sizer.\n let sizer = this._rowSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Get the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @returns The stretch factor for the column.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n columnStretch(index: number): number {\n let sizer = this._columnSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @param value - The stretch factor for the column.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setColumnStretch(index: number, value: number): void {\n // Look up the column sizer.\n let sizer = this._columnSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n for (const item of this._items) {\n yield item.widget;\n }\n }\n\n /**\n * Add a widget to the grid layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, this is no-op.\n */\n addWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is already in the layout.\n if (i !== -1) {\n return;\n }\n\n // Add the widget to the layout.\n this._items.push(new LayoutItem(widget));\n\n // Attach the widget to the parent.\n if (this.parent) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Remove a widget from the grid layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is not in the layout.\n if (i === -1) {\n return;\n }\n\n // Remove the widget from the layout.\n let item = ArrayExt.removeAt(this._items, i)!;\n\n // Detach the widget from the parent.\n if (this.parent) {\n this.detachWidget(widget);\n }\n\n // Dispose the layout item.\n item.dispose();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Reset the min sizes of the sizers.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n this._rowSizers[i].minSize = 0;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n this._columnSizers[i].minSize = 0;\n }\n\n // Filter for the visible layout items.\n let items = this._items.filter(it => !it.isHidden);\n\n // Fit the layout items.\n for (let i = 0, n = items.length; i < n; ++i) {\n items[i].fit();\n }\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Sort the items by row span.\n items.sort(Private.rowSpanCmp);\n\n // Update the min sizes of the row sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the row bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n // Distribute the minimum height to the sizers as needed.\n Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n }\n\n // Sort the items by column span.\n items.sort(Private.columnSpanCmp);\n\n // Update the min sizes of the column sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the column bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let c1 = Math.min(config.column, maxCol);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Distribute the minimum width to the sizers as needed.\n Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n }\n\n // If no size constraint is needed, just update the parent.\n if (this.fitPolicy === 'set-no-constraint') {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n return;\n }\n\n // Set up the computed min size.\n let minH = maxRow * this._rowSpacing;\n let minW = maxCol * this._columnSpacing;\n\n // Add the sizer minimums to the computed min size.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n minH += this._rowSizers[i].minSize;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n minW += this._columnSizers[i].minSize;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Compute the total fixed row and column space.\n let fixedRowSpace = maxRow * this._rowSpacing;\n let fixedColSpace = maxCol * this._columnSpacing;\n\n // Distribute the available space to the box sizers.\n BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n // Update the row start positions.\n for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n this._rowStarts[i] = pos;\n pos += this._rowSizers[i].size + this._rowSpacing;\n }\n\n // Update the column start positions.\n for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n this._columnStarts[i] = pos;\n pos += this._columnSizers[i].size + this._columnSpacing;\n }\n\n // Update the geometry of the layout items.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the cell bounds for the widget.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let c1 = Math.min(config.column, maxCol);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Compute the cell geometry.\n let x = this._columnStarts[c1];\n let y = this._rowStarts[r1];\n let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n // Update the geometry of the layout item.\n item.update(x, y, w, h);\n }\n }\n\n private _dirty = false;\n private _rowSpacing = 4;\n private _columnSpacing = 4;\n private _items: LayoutItem[] = [];\n private _rowStarts: number[] = [];\n private _columnStarts: number[] = [];\n private _rowSizers: BoxSizer[] = [new BoxSizer()];\n private _columnSizers: BoxSizer[] = [new BoxSizer()];\n private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n /**\n * An options object for initializing a grid layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The initial row count for the layout.\n *\n * The default is `1`.\n */\n rowCount?: number;\n\n /**\n * The initial column count for the layout.\n *\n * The default is `1`.\n */\n columnCount?: number;\n\n /**\n * The spacing between rows in the layout.\n *\n * The default is `4`.\n */\n rowSpacing?: number;\n\n /**\n * The spacing between columns in the layout.\n *\n * The default is `4`.\n */\n columnSpacing?: number;\n }\n\n /**\n * An object which holds the cell configuration for a widget.\n */\n export interface ICellConfig {\n /**\n * The row index for the widget.\n */\n readonly row: number;\n\n /**\n * The column index for the widget.\n */\n readonly column: number;\n\n /**\n * The row span for the widget.\n */\n readonly rowSpan: number;\n\n /**\n * The column span for the widget.\n */\n readonly columnSpan: number;\n }\n\n /**\n * Get the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The cell config for the widget.\n */\n export function getCellConfig(widget: Widget): ICellConfig {\n return Private.cellConfigProperty.get(widget);\n }\n\n /**\n * Set the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the cell config.\n */\n export function setCellConfig(\n widget: Widget,\n value: Partial\n ): void {\n Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for the widget cell config.\n */\n export const cellConfigProperty = new AttachedProperty<\n Widget,\n GridLayout.ICellConfig\n >({\n name: 'cellConfig',\n create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n changed: onChildCellConfigChanged\n });\n\n /**\n * Normalize a partial cell config object.\n */\n export function normalizeConfig(\n config: Partial\n ): GridLayout.ICellConfig {\n let row = Math.max(0, Math.floor(config.row || 0));\n let column = Math.max(0, Math.floor(config.column || 0));\n let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n return { row, column, rowSpan, columnSpan };\n }\n\n /**\n * Clamp a value to an integer >= 0.\n */\n export function clampValue(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * A sort comparison function for row spans.\n */\n export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.rowSpan - c2.rowSpan;\n }\n\n /**\n * A sort comparison function for column spans.\n */\n export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.columnSpan - c2.columnSpan;\n }\n\n /**\n * Reallocate the box sizers for the given grid dimensions.\n */\n export function reallocSizers(sizers: BoxSizer[], count: number): void {\n // Coerce the count to the valid range.\n count = Math.max(1, Math.floor(count));\n\n // Add the missing sizers.\n while (sizers.length < count) {\n sizers.push(new BoxSizer());\n }\n\n // Remove the extra sizers.\n if (sizers.length > count) {\n sizers.length = count;\n }\n }\n\n /**\n * Distribute a min size constraint across a range of sizers.\n */\n export function distributeMin(\n sizers: BoxSizer[],\n i1: number,\n i2: number,\n minSize: number\n ): void {\n // Sanity check the indices.\n if (i2 < i1) {\n return;\n }\n\n // Handle the simple case of no cell span.\n if (i1 === i2) {\n let sizer = sizers[i1];\n sizer.minSize = Math.max(sizer.minSize, minSize);\n return;\n }\n\n // Compute the total current min size of the span.\n let totalMin = 0;\n for (let i = i1; i <= i2; ++i) {\n totalMin += sizers[i].minSize;\n }\n\n // Do nothing if the total is greater than the required.\n if (totalMin >= minSize) {\n return;\n }\n\n // Compute the portion of the space to allocate to each sizer.\n let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n // Add the portion to each sizer.\n for (let i = i1; i <= i2; ++i) {\n sizers[i].minSize += portion;\n }\n }\n\n /**\n * The change handler for the child cell config property.\n */\n function onChildCellConfigChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof GridLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n */\nexport class MenuBar extends Widget {\n /**\n * Construct a new menu bar.\n *\n * @param options - The options for initializing the menu bar.\n */\n constructor(options: MenuBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-MenuBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.renderer = options.renderer || MenuBar.defaultRenderer;\n this._forceItemsPosition = options.forceItemsPosition || {\n forceX: true,\n forceY: true\n };\n this._overflowMenuOptions = options.overflowMenuOptions || {\n isVisible: true\n };\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._closeChildMenu();\n this._menus.length = 0;\n super.dispose();\n }\n\n /**\n * The renderer used by the menu bar.\n */\n readonly renderer: MenuBar.IRenderer;\n\n /**\n * The child menu of the menu bar.\n *\n * #### Notes\n * This will be `null` if the menu bar does not have an open menu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The overflow index of the menu bar.\n */\n get overflowIndex(): number {\n return this._overflowIndex;\n }\n\n /**\n * The overflow menu of the menu bar.\n */\n get overflowMenu(): Menu | null {\n return this._overflowMenu;\n }\n\n /**\n * Get the menu bar content node.\n *\n * #### Notes\n * This is the node which holds the menu title nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-MenuBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu.\n */\n get activeMenu(): Menu | null {\n return this._menus[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu.\n *\n * #### Notes\n * If the menu does not exist, the menu will be set to `null`.\n */\n set activeMenu(value: Menu | null) {\n this.activeIndex = value ? this._menus.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu.\n *\n * #### Notes\n * This will be `-1` if no menu is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu.\n *\n * #### Notes\n * If the menu cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._menus.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menus in the menu bar.\n */\n get menus(): ReadonlyArray {\n return this._menus;\n }\n\n /**\n * Open the active menu and activate its first menu item.\n *\n * #### Notes\n * If there is no active menu, this is a no-op.\n */\n openActiveMenu(): void {\n // Bail early if there is no active item.\n if (this._activeIndex === -1) {\n return;\n }\n\n // Open the child menu.\n this._openChildMenu();\n\n // Activate the first item in the child menu.\n if (this._childMenu) {\n this._childMenu.activeIndex = -1;\n this._childMenu.activateNextItem();\n }\n }\n\n /**\n * Add a menu to the end of the menu bar.\n *\n * @param menu - The menu to add to the menu bar.\n *\n * #### Notes\n * If the menu is already added to the menu bar, it will be moved.\n */\n addMenu(menu: Menu, update: boolean = true): void {\n this.insertMenu(this._menus.length, menu, update);\n }\n\n /**\n * Insert a menu into the menu bar at the specified index.\n *\n * @param index - The index at which to insert the menu.\n *\n * @param menu - The menu to insert into the menu bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the menus.\n *\n * If the menu is already added to the menu bar, it will be moved.\n */\n insertMenu(index: number, menu: Menu, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Look up the index of the menu.\n let i = this._menus.indexOf(menu);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._menus.length));\n\n // If the menu is not in the array, insert it.\n if (i === -1) {\n // Insert the menu into the array.\n ArrayExt.insert(this._menus, j, menu);\n\n // Add the styling class to the menu.\n menu.addClass('lm-MenuBar-menu');\n\n // Connect to the menu signals.\n menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n menu.menuRequested.connect(this._onMenuMenuRequested, this);\n menu.title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the menu exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._menus.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the menu to the new locations.\n ArrayExt.move(this._menus, i, j);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove a menu from the menu bar.\n *\n * @param menu - The menu to remove from the menu bar.\n *\n * #### Notes\n * This is a no-op if the menu is not in the menu bar.\n */\n removeMenu(menu: Menu, update: boolean = true): void {\n this.removeMenuAt(this._menus.indexOf(menu), update);\n }\n\n /**\n * Remove the menu at a given index from the menu bar.\n *\n * @param index - The index of the menu to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeMenuAt(index: number, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Remove the menu from the array.\n let menu = ArrayExt.removeAt(this._menus, index);\n\n // Bail if the index is out of range.\n if (!menu) {\n return;\n }\n\n // Disconnect from the menu signals.\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n\n // Remove the styling class from the menu.\n menu.removeClass('lm-MenuBar-menu');\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove all menus from the menu bar.\n */\n clearMenus(): void {\n // Bail if there is nothing to remove.\n if (this._menus.length === 0) {\n return;\n }\n\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Disconnect from the menu signals and remove the styling class.\n for (let menu of this._menus) {\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n menu.removeClass('lm-MenuBar-menu');\n }\n\n // Clear the menus array.\n this._menus.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Handle the DOM events for the menu bar.\n *\n * @param event - The DOM event sent to the menu bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu bar's DOM nodes. It\n * should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'focusout':\n this._evtFocusOut(event as FocusEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mousedown', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('focusout', this);\n this.node.addEventListener('contextmenu', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mousedown', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('focusout', this);\n this.node.removeEventListener('contextmenu', this);\n this._closeChildMenu();\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this._focusItemAt(0);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n this.update();\n super.onResize(msg);\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let menus = this._menus;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let tabFocusIndex =\n this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n ? this._tabFocusIndex\n : 0;\n let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n let totalMenuSize = 0;\n let isVisible = false;\n\n // Check that the overflow menu doesn't count\n length = this._overflowMenu !== null ? length - 1 : length;\n let content = new Array(length);\n\n // Render visible menus\n for (let i = 0; i < length; ++i) {\n content[i] = renderer.renderItem({\n title: menus[i].title,\n active: i === activeIndex,\n tabbable: i === tabFocusIndex,\n disabled: menus[i].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = i;\n this.activeIndex = i;\n }\n });\n // Calculate size of current menu\n totalMenuSize += this._menuItemSizes[i];\n // Check if overflow menu is already rendered\n if (menus[i].title.label === this._overflowMenuOptions.title) {\n isVisible = true;\n length--;\n }\n }\n // Render overflow menu if needed and active\n if (this._overflowMenuOptions.isVisible) {\n if (this._overflowIndex > -1 && !isVisible) {\n // Create overflow menu\n if (this._overflowMenu === null) {\n const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n this._overflowMenu.title.label = overflowMenuTitle;\n this._overflowMenu.title.mnemonic = 0;\n this.addMenu(this._overflowMenu, false);\n }\n // Move menus to overflow menu\n for (let i = menus.length - 2; i >= length; i--) {\n const submenu = this.menus[i];\n submenu.title.mnemonic = 0;\n this._overflowMenu.insertItem(0, {\n type: 'submenu',\n submenu: submenu\n });\n this.removeMenu(submenu, false);\n }\n content[length] = renderer.renderItem({\n title: this._overflowMenu.title,\n active: length === activeIndex && menus[length].items.length !== 0,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n } else if (this._overflowMenu !== null) {\n // Remove submenus from overflow menu\n let overflowMenuItems = this._overflowMenu.items;\n let screenSize = this.node.offsetWidth;\n let n = this._overflowMenu.items.length;\n for (let i = 0; i < n; ++i) {\n let index = menus.length - 1 - i;\n if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n let menu = overflowMenuItems[0].submenu as Menu;\n this._overflowMenu.removeItemAt(0);\n this.insertMenu(length, menu, false);\n content[length] = renderer.renderItem({\n title: menu.title,\n active: false,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n }\n }\n if (this._overflowMenu.items.length === 0) {\n this.removeMenu(this._overflowMenu, false);\n content.pop();\n this._overflowMenu = null;\n this._overflowIndex = -1;\n }\n }\n }\n VirtualDOM.render(content, this.contentNode);\n this._updateOverflowIndex();\n }\n\n /**\n * Calculate and update the current overflow index.\n */\n private _updateOverflowIndex(): void {\n if (!this._overflowMenuOptions.isVisible) {\n return;\n }\n\n // Get elements visible in the main menu bar\n const itemMenus = this.contentNode.childNodes;\n let screenSize = this.node.offsetWidth;\n let totalMenuSize = 0;\n let index = -1;\n let n = itemMenus.length;\n\n if (this._menuItemSizes.length == 0) {\n // Check if it is the first resize and get info about menu items sizes\n for (let i = 0; i < n; i++) {\n let item = itemMenus[i] as HTMLLIElement;\n // Add sizes to array\n totalMenuSize += item.offsetWidth;\n this._menuItemSizes.push(item.offsetWidth);\n if (totalMenuSize > screenSize && index === -1) {\n index = i;\n }\n }\n } else {\n // Calculate current menu size\n for (let i = 0; i < this._menuItemSizes.length; i++) {\n totalMenuSize += this._menuItemSizes[i];\n if (totalMenuSize > screenSize) {\n index = i;\n break;\n }\n }\n }\n this._overflowIndex = index;\n }\n\n /**\n * Handle the `'keydown'` event for the menu bar.\n *\n * #### Notes\n * All keys are trapped except the tab key that is ignored.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Reset the active index on tab, but do not trap the tab key.\n if (kc === 9) {\n this.activeIndex = -1;\n return;\n }\n\n // A menu bar handles all other keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Enter, Space, Up Arrow, Down Arrow\n if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n // The active index may have changed (for example, user hovers over an\n // item with the mouse), so be sure to use the focus index.\n this.activeIndex = this._tabFocusIndex;\n if (this.activeIndex !== this._tabFocusIndex) {\n // Bail if the setter refused to set activeIndex to tabFocusIndex\n // because it means that the item at tabFocusIndex cannot be opened (for\n // example, it has an empty menu)\n return;\n }\n this.openActiveMenu();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this._closeChildMenu();\n this._focusItemAt(this.activeIndex);\n return;\n }\n\n // Left or Right Arrow\n if (kc === 37 || kc === 39) {\n let direction = kc === 37 ? -1 : 1;\n let start = this._tabFocusIndex + direction;\n let n = this._menus.length;\n for (let i = 0; i < n; i++) {\n let index = (n + start + direction * i) % n;\n if (this._menus[index].items.length) {\n this._focusItemAt(index);\n return;\n }\n }\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._menus, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that menu is opened.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.openActiveMenu();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n this._focusItemAt(this.activeIndex);\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n this._focusItemAt(this.activeIndex);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the menu bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the mouse press was not on the menu bar. This can occur\n // when the document listener is installed for an active menu bar.\n if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n return;\n }\n\n // Stop the propagation of the event. Immediate propagation is\n // also stopped so that an open menu does not handle the event.\n event.stopPropagation();\n event.stopImmediatePropagation();\n\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // If the press was not on an item, close the child menu.\n if (index === -1) {\n this._closeChildMenu();\n return;\n }\n\n // If the press was not the left mouse button, do nothing further.\n if (event.button !== 0) {\n return;\n }\n\n // Otherwise, toggle the open state of the child menu.\n if (this._childMenu) {\n this._closeChildMenu();\n this.activeIndex = index;\n } else {\n // If we don't call preventDefault() here, then the item in the menu\n // bar will take focus over the menu that is being opened.\n event.preventDefault();\n const position = this._positionForMenu(index);\n Menu.saveWindowData();\n // Begin DOM modifications.\n this.activeIndex = index;\n this._openChildMenu(position);\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the menu bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the active index will not change.\n if (index === this._activeIndex) {\n return;\n }\n\n // Bail early if a child menu is open and the mouse is not over\n // an item. This allows the child menu to be kept open when the\n // mouse is over the empty part of the menu bar.\n if (index === -1 && this._childMenu) {\n return;\n }\n\n // Get position for the new menu >before< updating active index.\n const position =\n index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n // Before any modification, update window data.\n Menu.saveWindowData();\n\n // Begin DOM modifications.\n\n // Update the active index to the hovered item.\n this.activeIndex = index;\n\n // Open the new menu if a menu is already open.\n if (position) {\n this._openChildMenu(position);\n }\n }\n\n /**\n * Find initial position for the menu based on menubar item position.\n *\n * NOTE: this should be called before updating active index to avoid\n * an additional layout and style invalidation as changing active\n * index modifies DOM.\n */\n private _positionForMenu(index: number): Private.IPosition {\n let itemNode = this.contentNode.children[index];\n let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n return {\n top: bottom,\n left\n };\n }\n\n /**\n * Handle the `'focusout'` event for the menu bar.\n */\n private _evtFocusOut(event: FocusEvent): void {\n // Reset the active index if there is no open menu and the menubar is losing focus.\n if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n this.activeIndex = -1;\n }\n }\n\n /**\n * Focus an item in the menu bar.\n *\n * #### Notes\n * Does not open the associated menu.\n */\n private _focusItemAt(index: number): void {\n const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n if (itemNode) {\n itemNode.focus();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if there is no active menu.\n */\n private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n // If there is no active menu, close the current menu.\n let newMenu = this.activeMenu;\n if (!newMenu) {\n this._closeChildMenu();\n return;\n }\n\n // Bail if there is no effective menu change.\n let oldMenu = this._childMenu;\n if (oldMenu === newMenu) {\n return;\n }\n\n // Swap the internal menu reference.\n this._childMenu = newMenu;\n\n // Close the current menu, or setup for the new menu.\n if (oldMenu) {\n oldMenu.close();\n } else {\n document.addEventListener('mousedown', this, true);\n }\n\n // Update the tab focus index and ensure the menu bar is updated.\n this._tabFocusIndex = this.activeIndex;\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n // Get the positioning data for the new menu.\n let { left, top } = options;\n if (typeof left === 'undefined' || typeof top === 'undefined') {\n ({ left, top } = this._positionForMenu(this._activeIndex));\n }\n // Begin DOM modifications\n\n if (!oldMenu) {\n // Continue setup for new menu\n this.addClass('lm-mod-active');\n }\n\n // Open the new menu at the computed location.\n if (newMenu.items.length > 0) {\n newMenu.open(left, top, this._forceItemsPosition);\n }\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n // Bail if no child menu is open.\n if (!this._childMenu) {\n return;\n }\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n let menu = this._childMenu;\n this._childMenu = null;\n\n // Close the menu.\n menu.close();\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `aboutToClose` signal of a menu.\n */\n private _onMenuAboutToClose(sender: Menu): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n this._childMenu = null;\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `menuRequested` signal of a child menu.\n */\n private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Look up the active index and menu count.\n let i = this._activeIndex;\n let n = this._menus.length;\n\n // Active the next requested index.\n switch (args) {\n case 'next':\n this.activeIndex = i === n - 1 ? 0 : i + 1;\n break;\n case 'previous':\n this.activeIndex = i === 0 ? n - 1 : i - 1;\n break;\n }\n\n // Open the active menu.\n this.openActiveMenu();\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(): void {\n this.update();\n }\n\n // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n private _activeIndex = -1;\n // Track which item can be focused using the TAB key. Unlike _activeIndex will\n // always point to a menuitem. Whenever you update this value, it's important\n // to follow it with an \"update-request\" message so that the `tabindex`\n // attribute on each menubar item gets properly updated.\n private _tabFocusIndex = 0;\n private _forceItemsPosition: Menu.IOpenOptions;\n private _overflowMenuOptions: IOverflowMenuOptions;\n private _menus: Menu[] = [];\n private _childMenu: Menu | null = null;\n private _overflowMenu: Menu | null = null;\n private _menuItemSizes: number[] = [];\n private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n /**\n * An options object for creating a menu bar.\n */\n export interface IOptions {\n /**\n * A custom renderer for creating menu bar content.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n /**\n * Whether to force the position of the menu. The MenuBar forces the\n * coordinates of its menus by default. With this option you can disable it.\n *\n * Setting to `false` will enable the logic which repositions the\n * coordinates of the menu if it will not fit entirely on screen.\n *\n * The default is `true`.\n */\n forceItemsPosition?: Menu.IOpenOptions;\n /**\n * Whether to add a overflow menu if there's overflow.\n *\n * Setting to `true` will enable the logic that creates an overflow menu\n * to show the menu items that don't fit entirely on the screen.\n *\n * The default is `true`.\n */\n overflowMenuOptions?: IOverflowMenuOptions;\n }\n\n /**\n * An object which holds the data to render a menu bar item.\n */\n export interface IRenderData {\n /**\n * The title to be rendered.\n */\n readonly title: Title;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the user can tab to the item.\n */\n readonly tabbable: boolean;\n\n /**\n * Whether the item is disabled.\n *\n * #### Notes\n * A disabled item cannot be active.\n * A disabled item cannot be focussed.\n */\n readonly disabled?: boolean;\n\n readonly onfocus?: (event: FocusEvent) => void;\n }\n\n /**\n * A renderer for use with a menu bar.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n\n /**\n * Render the icon element for a menu bar item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.title.icon is undefined, it will be ignored.\n return h.div({ className }, data.title.icon!, data.title.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n }\n\n /**\n * Create the class name for the menu bar item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n let name = 'lm-MenuBar-item';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.active && !data.disabled) {\n name += ' lm-mod-active';\n }\n return name;\n }\n\n /**\n * Create the dataset for a menu bar item.\n *\n * @param data - The data to use for the item.\n *\n * @returns The dataset for the menu bar item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the aria attributes for menu bar item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n return {\n role: 'menuitem',\n 'aria-haspopup': 'true',\n 'aria-disabled': data.disabled ? 'true' : 'false'\n };\n }\n\n /**\n * Create the class name for the menu bar item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-MenuBar-itemIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.title;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n /**\n * Determines if a overflow menu appears when the menu items overflow.\n *\n * Defaults to `true`.\n */\n isVisible: boolean;\n /**\n * Determines the title of the overflow menu.\n *\n * Default: `...`.\n */\n title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a menu bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-MenuBar-content';\n node.appendChild(content);\n content.setAttribute('role', 'menubar');\n return node;\n }\n\n /**\n * Position for the menu relative to top-left screen corner.\n */\n export interface IPosition {\n /**\n * Pixels right from screen origin.\n */\n left: number;\n /**\n * Pixels down from screen origin.\n */\n top: number;\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n menus: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = menus.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Look up the menu title.\n let title = menus[k].title;\n\n // Ignore titles with an empty label.\n if (title.label.length === 0) {\n continue;\n }\n\n // Look up the mnemonic index for the label.\n let mn = title.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < title.label.length) {\n if (title.label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n /**\n * Construct a new scroll bar.\n *\n * @param options - The options for initializing the scroll bar.\n */\n constructor(options: ScrollBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-ScrollBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n\n // Set the orientation.\n this._orientation = options.orientation || 'vertical';\n this.dataset['orientation'] = this._orientation;\n\n // Parse the rest of the options.\n if (options.maximum !== undefined) {\n this._maximum = Math.max(0, options.maximum);\n }\n if (options.page !== undefined) {\n this._page = Math.max(0, options.page);\n }\n if (options.value !== undefined) {\n this._value = Math.max(0, Math.min(options.value, this._maximum));\n }\n }\n\n /**\n * A signal emitted when the user moves the scroll thumb.\n *\n * #### Notes\n * The payload is the current value of the scroll bar.\n */\n get thumbMoved(): ISignal {\n return this._thumbMoved;\n }\n\n /**\n * A signal emitted when the user clicks a step button.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get stepRequested(): ISignal {\n return this._stepRequested;\n }\n\n /**\n * A signal emitted when the user clicks the scroll track.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get pageRequested(): ISignal {\n return this._pageRequested;\n }\n\n /**\n * Get the orientation of the scroll bar.\n */\n get orientation(): ScrollBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the scroll bar.\n */\n set orientation(value: ScrollBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making changes.\n this._releaseMouse();\n\n // Update the internal orientation.\n this._orientation = value;\n this.dataset['orientation'] = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the current value of the scroll bar.\n */\n get value(): number {\n return this._value;\n }\n\n /**\n * Set the current value of the scroll bar.\n *\n * #### Notes\n * The value will be clamped to the range `[0, maximum]`.\n */\n set value(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Do nothing if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the page size of the scroll bar.\n *\n * #### Notes\n * The page size is the amount of visible content in the scrolled\n * region, expressed in data units. It determines the size of the\n * scroll bar thumb.\n */\n get page(): number {\n return this._page;\n }\n\n /**\n * Set the page size of the scroll bar.\n *\n * #### Notes\n * The page size will be clamped to the range `[0, Infinity]`.\n */\n set page(value: number) {\n // Clamp the page size to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._page === value) {\n return;\n }\n\n // Update the internal page size.\n this._page = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the maximum value of the scroll bar.\n */\n get maximum(): number {\n return this._maximum;\n }\n\n /**\n * Set the maximum value of the scroll bar.\n *\n * #### Notes\n * The max size will be clamped to the range `[0, Infinity]`.\n */\n set maximum(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._maximum === value) {\n return;\n }\n\n // Update the internal values.\n this._maximum = value;\n\n // Clamp the current value to the new range.\n this._value = Math.min(this._value, value);\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * The scroll bar decrement button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get decrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar increment button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get incrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[1] as HTMLDivElement;\n }\n\n /**\n * The scroll bar track node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get trackNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-track'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar thumb node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get thumbNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-thumb'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Handle the DOM events for the scroll bar.\n *\n * @param event - The DOM event sent to the scroll bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the scroll bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A method invoked on a 'before-attach' message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('mousedown', this);\n this.update();\n }\n\n /**\n * A method invoked on an 'after-detach' message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n }\n\n /**\n * A method invoked on an 'update-request' message.\n */\n protected onUpdateRequest(msg: Message): void {\n // Convert the value and page into percentages.\n let value = (this._value * 100) / this._maximum;\n let page = (this._page * 100) / (this._page + this._maximum);\n\n // Clamp the value and page to the relevant range.\n value = Math.max(0, Math.min(value, 100));\n page = Math.max(0, Math.min(page, 100));\n\n // Fetch the thumb style.\n let thumbStyle = this.thumbNode.style;\n\n // Update the thumb style for the current orientation.\n if (this._orientation === 'horizontal') {\n thumbStyle.top = '';\n thumbStyle.height = '';\n thumbStyle.left = `${value}%`;\n thumbStyle.width = `${page}%`;\n thumbStyle.transform = `translate(${-value}%, 0%)`;\n } else {\n thumbStyle.left = '';\n thumbStyle.width = '';\n thumbStyle.top = `${value}%`;\n thumbStyle.height = `${page}%`;\n thumbStyle.transform = `translate(0%, ${-value}%)`;\n }\n }\n\n /**\n * Handle the `'keydown'` event for the scroll bar.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Ignore anything except the `Escape` key.\n if (event.keyCode !== 27) {\n return;\n }\n\n // Fetch the previous scroll value.\n let value = this._pressData ? this._pressData.value : -1;\n\n // Release the mouse.\n this._releaseMouse();\n\n // Restore the old scroll value if possible.\n if (value !== -1) {\n this._moveThumb(value);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the scroll bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Do nothing if it's not a left mouse press.\n if (event.button !== 0) {\n return;\n }\n\n // Send an activate request to the scroll bar. This can be\n // used by message hooks to activate something relevant.\n this.activate();\n\n // Do nothing if the mouse is already captured.\n if (this._pressData) {\n return;\n }\n\n // Find the pressed scroll bar part.\n let part = Private.findPart(this, event.target as HTMLElement);\n\n // Do nothing if the part is not of interest.\n if (!part) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Override the mouse cursor.\n let override = Drag.overrideCursor('default');\n\n // Set up the press data.\n this._pressData = {\n part,\n override,\n delta: -1,\n value: -1,\n mouseX: event.clientX,\n mouseY: event.clientY\n };\n\n // Add the extra event listeners.\n document.addEventListener('mousemove', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Handle a thumb press.\n if (part === 'thumb') {\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Update the press data delta for the current orientation.\n if (this._orientation === 'horizontal') {\n this._pressData.delta = event.clientX - thumbRect.left;\n } else {\n this._pressData.delta = event.clientY - thumbRect.top;\n }\n\n // Add the active class to the thumb node.\n thumbNode.classList.add('lm-mod-active');\n\n // Store the current value in the press data.\n this._pressData.value = this._value;\n\n // Finished.\n return;\n }\n\n // Handle a track press.\n if (part === 'track') {\n // Fetch the client rect for the thumb.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n\n // Handle a decrement button press.\n if (part === 'decrement') {\n // Add the active class to the decrement node.\n this.decrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button press.\n if (part === 'increment') {\n // Add the active class to the increment node.\n this.incrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the scroll bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Do nothing if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Update the mouse position.\n this._pressData.mouseX = event.clientX;\n this._pressData.mouseY = event.clientY;\n\n // Bail if the thumb is not being dragged.\n if (this._pressData.part !== 'thumb') {\n return;\n }\n\n // Get the client rect for the thumb and track.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n let trackRect = this.trackNode.getBoundingClientRect();\n\n // Fetch the scroll geometry based on the orientation.\n let trackPos: number;\n let trackSpan: number;\n if (this._orientation === 'horizontal') {\n trackPos = event.clientX - trackRect.left - this._pressData.delta;\n trackSpan = trackRect.width - thumbRect.width;\n } else {\n trackPos = event.clientY - trackRect.top - this._pressData.delta;\n trackSpan = trackRect.height - thumbRect.height;\n }\n\n // Compute the desired value from the scroll geometry.\n let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n // Move the thumb to the computed value.\n this._moveThumb(value);\n }\n\n /**\n * Handle the `'mouseup'` event for the scroll bar.\n */\n private _evtMouseUp(event: MouseEvent): void {\n // Do nothing if it's not a left mouse release.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse and restore the node states.\n */\n private _releaseMouse(): void {\n // Bail if there is no press data.\n if (!this._pressData) {\n return;\n }\n\n // Clear the repeat timer.\n clearTimeout(this._repeatTimer);\n this._repeatTimer = -1;\n\n // Clear the press data.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra event listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n\n // Remove the active classes from the nodes.\n this.thumbNode.classList.remove('lm-mod-active');\n this.decrementNode.classList.remove('lm-mod-active');\n this.incrementNode.classList.remove('lm-mod-active');\n }\n\n /**\n * Move the thumb to the specified position.\n */\n private _moveThumb(value: number): void {\n // Clamp the value to the allowed range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Bail if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update of the scroll bar.\n this.update();\n\n // Emit the thumb moved signal.\n this._thumbMoved.emit(value);\n }\n\n /**\n * A timeout callback for repeating the mouse press.\n */\n private _onRepeat = () => {\n // Clear the repeat timer id.\n this._repeatTimer = -1;\n\n // Bail if the mouse has been released.\n if (!this._pressData) {\n return;\n }\n\n // Look up the part that was pressed.\n let part = this._pressData.part;\n\n // Bail if the thumb was pressed.\n if (part === 'thumb') {\n return;\n }\n\n // Schedule the timer for another repeat.\n this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n // Get the current mouse position.\n let mouseX = this._pressData.mouseX;\n let mouseY = this._pressData.mouseY;\n\n // Handle a decrement button repeat.\n if (part === 'decrement') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button repeat.\n if (part === 'increment') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n\n // Handle a track repeat.\n if (part === 'track') {\n // Bail if the mouse is not over the track.\n if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Bail if the mouse is over the thumb.\n if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n };\n\n private _value = 0;\n private _page = 10;\n private _maximum = 100;\n private _repeatTimer = -1;\n private _orientation: ScrollBar.Orientation;\n private _pressData: Private.IPressData | null = null;\n private _thumbMoved = new Signal(this);\n private _stepRequested = new Signal(this);\n private _pageRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n /**\n * A type alias for a scroll bar orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * An options object for creating a scroll bar.\n */\n export interface IOptions {\n /**\n * The orientation of the scroll bar.\n *\n * The default is `'vertical'`.\n */\n orientation?: Orientation;\n\n /**\n * The value for the scroll bar.\n *\n * The default is `0`.\n */\n value?: number;\n\n /**\n * The page size for the scroll bar.\n *\n * The default is `10`.\n */\n page?: number;\n\n /**\n * The maximum value for the scroll bar.\n *\n * The default is `100`.\n */\n maximum?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A type alias for the parts of a scroll bar.\n */\n export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The scroll bar part which was pressed.\n */\n part: ScrollBarPart;\n\n /**\n * The offset of the press in thumb coordinates, or -1.\n */\n delta: number;\n\n /**\n * The scroll value at the time the thumb was pressed, or -1.\n */\n value: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n\n /**\n * The current X position of the mouse.\n */\n mouseX: number;\n\n /**\n * The current Y position of the mouse.\n */\n mouseY: number;\n }\n\n /**\n * Create the DOM node for a scroll bar.\n */\n export function createNode(): HTMLElement {\n let node = document.createElement('div');\n let decrement = document.createElement('div');\n let increment = document.createElement('div');\n let track = document.createElement('div');\n let thumb = document.createElement('div');\n decrement.className = 'lm-ScrollBar-button';\n increment.className = 'lm-ScrollBar-button';\n decrement.dataset['action'] = 'decrement';\n increment.dataset['action'] = 'increment';\n track.className = 'lm-ScrollBar-track';\n thumb.className = 'lm-ScrollBar-thumb';\n track.appendChild(thumb);\n node.appendChild(decrement);\n node.appendChild(track);\n node.appendChild(increment);\n return node;\n }\n\n /**\n * Find the scroll bar part which contains the given target.\n */\n export function findPart(\n scrollBar: ScrollBar,\n target: HTMLElement\n ): ScrollBarPart | null {\n // Test the thumb.\n if (scrollBar.thumbNode.contains(target)) {\n return 'thumb';\n }\n\n // Test the track.\n if (scrollBar.trackNode.contains(target)) {\n return 'track';\n }\n\n // Test the decrement button.\n if (scrollBar.decrementNode.contains(target)) {\n return 'decrement';\n }\n\n // Test the increment button.\n if (scrollBar.incrementNode.contains(target)) {\n return 'increment';\n }\n\n // Indicate no match.\n return null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this._widget) {\n let widget = this._widget;\n this._widget = null;\n widget.dispose();\n }\n super.dispose();\n }\n\n /**\n * Get the child widget for the layout.\n */\n get widget(): Widget | null {\n return this._widget;\n }\n\n /**\n * Set the child widget for the layout.\n *\n * #### Notes\n * Setting the child widget will cause the old child widget to be\n * automatically disposed. If that is not desired, set the parent\n * of the old child to `null` before assigning a new child.\n */\n set widget(widget: Widget | null) {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n if (widget) {\n widget.parent = this.parent;\n }\n\n // Bail early if the widget does not change.\n if (this._widget === widget) {\n return;\n }\n\n // Dispose of the old child widget.\n if (this._widget) {\n this._widget.dispose();\n }\n\n // Update the internal widget.\n this._widget = widget;\n\n // Attach the new child widget if needed.\n if (this.parent && widget) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n if (this._widget) {\n yield this._widget;\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Bail early if the widget does not exist in the layout.\n if (this._widget !== widget) {\n return;\n }\n\n // Clear the internal widget.\n this._widget = null;\n\n // If the layout is parented, detach the widget from the DOM.\n if (this.parent) {\n this.detachWidget(widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n constructor(options: StackedLayout.IOptions = {}) {\n super(options);\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n if (this.widgets.length > 1) {\n this.widgets.forEach(w => {\n w.hiddenMode = this._hiddenMode;\n });\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n this._items.length > 0\n ) {\n if (this._items.length === 1) {\n this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n }\n widget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n widget.hiddenMode = Widget.HiddenMode.Display;\n }\n\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Reset the z-index for the widget.\n item!.widget.node.style.zIndex = '';\n\n // Reset the hidden mode for the widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n widget.hiddenMode = Widget.HiddenMode.Display;\n\n // Reset the hidden mode for the first widget if necessary.\n if (this._items.length === 1) {\n this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n }\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the computed minimum size.\n minW = Math.max(minW, item.minWidth);\n minH = Math.max(minH, item.minHeight);\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the widget stacking order and layout geometry.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Set the z-index for the widget.\n item.widget.node.style.zIndex = `${i}`;\n\n // Update the item geometry.\n item.update(left, top, width, height);\n }\n }\n\n private _dirty = false;\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n /**\n * An options object for initializing a stacked layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n /**\n * Construct a new stacked panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: StackedPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-StackedPanel');\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as StackedLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as StackedLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when a widget is removed from a stacked panel.\n */\n get widgetRemoved(): ISignal {\n return this._widgetRemoved;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-StackedPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-StackedPanel-child');\n this._widgetRemoved.emit(msg.child);\n }\n\n private _widgetRemoved = new Signal(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n /**\n * An options object for creating a stacked panel.\n */\n export interface IOptions {\n /**\n * The stacked layout to use for the stacked panel.\n *\n * The default is a new `StackedLayout`.\n */\n layout?: StackedLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a stacked layout for the given panel options.\n */\n export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n return options.layout || new StackedLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n constructor(options: TabPanel.IOptions = {}) {\n super();\n this.addClass('lm-TabPanel');\n\n // Create the tab bar and stacked panel.\n this.tabBar = new TabBar(options);\n this.tabBar.addClass('lm-TabPanel-tabBar');\n this.stackedPanel = new StackedPanel();\n this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n // Connect the tab bar signal handlers.\n this.tabBar.tabMoved.connect(this._onTabMoved, this);\n this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n this.tabBar.tabActivateRequested.connect(\n this._onTabActivateRequested,\n this\n );\n this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Connect the stacked panel signal handlers.\n this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n // Get the data related to the placement.\n this._tabPlacement = options.tabPlacement || 'top';\n let direction = Private.directionFromPlacement(this._tabPlacement);\n let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = this._tabPlacement;\n\n // Create the box layout.\n let layout = new BoxLayout({ direction, spacing: 0 });\n\n // Set the stretch factors for the child widgets.\n BoxLayout.setStretch(this.tabBar, 0);\n BoxLayout.setStretch(this.stackedPanel, 1);\n\n // Add the child widgets to the layout.\n layout.addWidget(this.tabBar);\n layout.addWidget(this.stackedPanel);\n\n // Install the layout on the tab panel.\n this.layout = layout;\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal {\n return this._currentChanged;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this.tabBar.currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `-1`.\n */\n set currentIndex(value: number) {\n this.tabBar.currentIndex = value;\n }\n\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get currentWidget(): Widget | null {\n let title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n }\n\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set currentWidget(value: Widget | null) {\n this.tabBar.currentTitle = value ? value.title : null;\n }\n\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get tabsMovable(): boolean {\n return this.tabBar.tabsMovable;\n }\n\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set tabsMovable(value: boolean) {\n this.tabBar.tabsMovable = value;\n }\n\n /**\n * Get the whether the add button is enabled.\n *\n */\n get addButtonEnabled(): boolean {\n return this.tabBar.addButtonEnabled;\n }\n\n /**\n * Set the whether the add button is enabled.\n *\n */\n set addButtonEnabled(value: boolean) {\n this.tabBar.addButtonEnabled = value;\n }\n\n /**\n * Get the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n get tabPlacement(): TabPanel.TabPlacement {\n return this._tabPlacement;\n }\n\n /**\n * Set the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n set tabPlacement(value: TabPanel.TabPlacement) {\n // Bail if the placement does not change.\n if (this._tabPlacement === value) {\n return;\n }\n\n // Update the internal value.\n this._tabPlacement = value;\n\n // Get the values related to the placement.\n let direction = Private.directionFromPlacement(value);\n let orientation = Private.orientationFromPlacement(value);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = value;\n\n // Update the layout direction.\n (this.layout as BoxLayout).direction = direction;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The tab bar used by the tab panel.\n *\n * #### Notes\n * Modifying the tab bar directly can lead to undefined behavior.\n */\n readonly tabBar: TabBar;\n\n /**\n * The stacked panel used by the tab panel.\n *\n * #### Notes\n * Modifying the panel directly can lead to undefined behavior.\n */\n readonly stackedPanel: StackedPanel;\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return this.stackedPanel.widgets;\n }\n\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this.widgets.length, widget);\n }\n\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n insertWidget(index: number, widget: Widget): void {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.stackedPanel.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n\n widget.node.setAttribute('role', 'tabpanel');\n\n let renderer = this.tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n // Extract the widgets from the titles.\n let previousWidget = previousTitle ? previousTitle.owner : null;\n let currentWidget = currentTitle ? currentTitle.owner : null;\n\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex,\n previousWidget,\n currentIndex,\n currentWidget\n });\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n }\n\n /**\n * Handle the `tabAddRequested` signal from the tab bar.\n */\n private _onTabAddRequested(sender: TabBar, args: void): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n private _onTabMoved(\n sender: TabBar,\n args: TabBar.ITabMovedArgs\n ): void {\n this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n }\n\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n this.tabBar.removeTab(widget.title);\n }\n\n private _tabPlacement: TabPanel.TabPlacement;\n private _currentChanged = new Signal(\n this\n );\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n /**\n * A type alias for tab placement in a tab bar.\n */\n export type TabPlacement =\n | /**\n * The tabs are placed as a row above the content.\n */\n 'top'\n\n /**\n * The tabs are placed as a column to the left of the content.\n */\n | 'left'\n\n /**\n * The tabs are placed as a column to the right of the content.\n */\n | 'right'\n\n /**\n * The tabs are placed as a row below the content.\n */\n | 'bottom';\n\n /**\n * An options object for initializing a tab panel.\n */\n export interface IOptions {\n /**\n * The document to use with the tab panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether the button to add new tabs is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The placement of the tab bar relative to the content.\n *\n * The default is `'top'`.\n */\n tabPlacement?: TabPlacement;\n\n /**\n * The renderer for the panel's tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: TabBar.IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n previousIndex: number;\n\n /**\n * The previously selected widget.\n */\n previousWidget: Widget | null;\n\n /**\n * The currently selected index.\n */\n currentIndex: number;\n\n /**\n * The currently selected widget.\n */\n currentWidget: Widget | null;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Convert a tab placement to tab bar orientation.\n */\n export function orientationFromPlacement(\n plc: TabPanel.TabPlacement\n ): TabBar.Orientation {\n return placementToOrientationMap[plc];\n }\n\n /**\n * Convert a tab placement to a box layout direction.\n */\n export function directionFromPlacement(\n plc: TabPanel.TabPlacement\n ): BoxLayout.Direction {\n return placementToDirectionMap[plc];\n }\n\n /**\n * A mapping of tab placement to tab bar orientation.\n */\n const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n top: 'horizontal',\n left: 'vertical',\n right: 'vertical',\n bottom: 'horizontal'\n };\n\n /**\n * A mapping of tab placement to box layout direction.\n */\n const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n top: 'top-to-bottom',\n left: 'left-to-right',\n right: 'right-to-left',\n bottom: 'bottom-to-top'\n };\n}\n"],"names":["BoxEngine","Signal","Private","MessageLoop","AttachedProperty","Message","ConflatableMessage","ElementExt","ArrayExt","Utils","UUID","Drag","VirtualDOM","h","StringExt","CommandRegistry","JSONExt","getKeyboardLayout","DisposableDelegate","Selector","empty","find","Platform","MimeData","max"],"mappings":";;;;;;IAAA;IACA;IACA;;;;;;IAM+E;IAE/E;;;;;;;;;IASG;UACU,QAAQ,CAAA;IAArB,IAAA,WAAA,GAAA;IACE;;;;;;;;;;;;IAYG;YACH,IAAQ,CAAA,QAAA,GAAG,CAAC,CAAC;IAEb;;;;;;;;;;;;IAYG;YACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;IAEZ;;;;;;;;;;;;IAYG;YACH,IAAO,CAAA,OAAA,GAAG,QAAQ,CAAC;IAEnB;;;;;;;;;;;;;;;IAeG;YACH,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;IAEZ;;;;;;;;;;;IAWG;YACH,IAAI,CAAA,IAAA,GAAG,CAAC,CAAC;IAET;;;;;;;IAOG;YACH,IAAI,CAAA,IAAA,GAAG,KAAK,CAAC;SACd;IAAA,CAAA;IAED;;IAEG;AACcA,+BA0XhB;IA1XD,CAAA,UAAiB,SAAS,EAAA;IACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6DG;IACH,IAAA,SAAgB,IAAI,CAAC,MAA2B,EAAE,KAAa,EAAA;;IAE7D,QAAA,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;YAC1B,IAAI,KAAK,KAAK,CAAC,EAAE;IACf,YAAA,OAAO,KAAK,CAAC;IACd,SAAA;;YAGD,IAAI,QAAQ,GAAG,CAAC,CAAC;YACjB,IAAI,QAAQ,GAAG,CAAC,CAAC;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MAAoB,EAAE,MAAc,EAAA;IAC3D,QAAA,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IACpC,QAAA,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACrC;IAQF,CAAA;IAgGD;;IAEG;IACH,IAAU,OAAO,CAsChB;IAtCD,CAAA,UAAU,OAAO,EAAA;IACf;;IAEG;QACH,SAAgB,wBAAwB,CACtC,GAA0B,EAAA;IAE1B,QAAA,OAAO,yBAAyB,CAAC,GAAG,CAAC,CAAC;SACvC;IAJe,IAAA,OAAA,CAAA,wBAAwB,2BAIvC,CAAA;IAED;;IAEG;QACH,SAAgB,sBAAsB,CACpC,GAA0B,EAAA;IAE1B,QAAA,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC;SACrC;IAJe,IAAA,OAAA,CAAA,sBAAsB,yBAIrC,CAAA;IAED;;IAEG;IACH,IAAA,MAAM,yBAAyB,GAA0C;IACvE,QAAA,GAAG,EAAE,YAAY;IACjB,QAAA,IAAI,EAAE,UAAU;IAChB,QAAA,KAAK,EAAE,UAAU;IACjB,QAAA,MAAM,EAAE,YAAY;SACrB,CAAC;IAEF;;IAEG;IACH,IAAA,MAAM,uBAAuB,GAA2C;IACtE,QAAA,GAAG,EAAE,eAAe;IACpB,QAAA,IAAI,EAAE,eAAe;IACrB,QAAA,KAAK,EAAE,eAAe;IACtB,QAAA,MAAM,EAAE,eAAe;SACxB,CAAC;IACJ,CAAC,EAtCS,OAAO,KAAP,OAAO,GAsChB,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} +\ No newline at end of file +diff --git a/node_modules/@lumino/widgets/dist/index.min.js b/node_modules/@lumino/widgets/dist/index.min.js +index 7b6ebcc..c227a41 100644 +--- a/node_modules/@lumino/widgets/dist/index.min.js ++++ b/node_modules/@lumino/widgets/dist/index.min.js +@@ -1,2 +1,2 @@ +-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lumino/algorithm"),require("@lumino/coreutils"),require("@lumino/domutils"),require("@lumino/messaging"),require("@lumino/properties"),require("@lumino/signaling"),require("@lumino/dragdrop"),require("@lumino/commands"),require("@lumino/virtualdom"),require("@lumino/disposable"),require("@lumino/keyboard")):"function"==typeof define&&define.amd?define(["exports","@lumino/algorithm","@lumino/coreutils","@lumino/domutils","@lumino/messaging","@lumino/properties","@lumino/signaling","@lumino/dragdrop","@lumino/commands","@lumino/virtualdom","@lumino/disposable","@lumino/keyboard"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lumino_widgets={},e.lumino_algorithm,e.lumino_coreutils,e.lumino_domutils,e.lumino_messaging,e.lumino_properties,e.lumino_signaling,e.lumino_dragdrop,e.lumino_commands,e.lumino_virtualdom,e.lumino_disposable,e.lumino_keyboard)}(this,(function(e,t,i,s,n,a,r,o,h,d,l,c){"use strict";class u{constructor(){this.sizeHint=0,this.minSize=0,this.maxSize=1/0,this.stretch=1,this.size=0,this.done=!1}}var m,g,p,_;e.BoxEngine=void 0,(m=e.BoxEngine||(e.BoxEngine={})).calc=function(e,t){let i=e.length;if(0===i)return t;let s=0,n=0,a=0,r=0,o=0;for(let t=0;t0&&(r+=i.stretch,o++)}if(t===a)return 0;if(t<=s){for(let t=0;t=n){for(let t=0;t0&&s>h;){let t=s,n=r;for(let a=0;a0&&s>h;){let t=s/d;for(let n=0;n0&&s>h;){let t=s,n=r;for(let a=0;a=i.maxSize?(s-=i.maxSize-i.size,r-=i.stretch,i.size=i.maxSize,i.done=!0,d--,o--):(s-=h,i.size+=h)}}for(;d>0&&s>h;){let t=s/d;for(let n=0;n=i.maxSize?(s-=i.maxSize-i.size,i.size=i.maxSize,i.done=!0,d--):(s-=t,i.size+=t))}}}return 0},m.adjust=function(e,t,i){0!==e.length&&0!==i&&(i>0?function(e,t,i){let s=0;for(let i=0;i<=t;++i){let t=e[i];s+=t.maxSize-t.size}let n=0;for(let i=t+1,s=e.length;i=0&&a>0;--i){let t=e[i],s=t.maxSize-t.size;s>=a?(t.sizeHint=t.size+a,a=0):(t.sizeHint=t.size+s,a-=s)}let r=i;for(let i=t+1,s=e.length;i0;++i){let t=e[i],s=t.size-t.minSize;s>=r?(t.sizeHint=t.size-r,r=0):(t.sizeHint=t.size-s,r-=s)}}(e,t,i):function(e,t,i){let s=0;for(let i=t+1,n=e.length;i0;++i){let t=e[i],s=t.maxSize-t.size;s>=a?(t.sizeHint=t.size+a,a=0):(t.sizeHint=t.size+s,a-=s)}let r=i;for(let i=t;i>=0&&r>0;--i){let t=e[i],s=t.size-t.minSize;s>=r?(t.sizeHint=t.size-r,r=0):(t.sizeHint=t.size-s,r-=s)}}(e,t,-i))};class f{constructor(e){this._label="",this._caption="",this._mnemonic=-1,this._icon=void 0,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new r.Signal(this),this._isDisposed=!1,this.owner=e.owner,void 0!==e.label&&(this._label=e.label),void 0!==e.mnemonic&&(this._mnemonic=e.mnemonic),void 0!==e.icon&&(this._icon=e.icon),void 0!==e.iconClass&&(this._iconClass=e.iconClass),void 0!==e.iconLabel&&(this._iconLabel=e.iconLabel),void 0!==e.caption&&(this._caption=e.caption),void 0!==e.className&&(this._className=e.className),void 0!==e.closable&&(this._closable=e.closable),this._dataset=e.dataset||{}}get changed(){return this._changed}get label(){return this._label}set label(e){this._label!==e&&(this._label=e,this._changed.emit(void 0))}get mnemonic(){return this._mnemonic}set mnemonic(e){this._mnemonic!==e&&(this._mnemonic=e,this._changed.emit(void 0))}get icon(){return this._icon}set icon(e){this._icon!==e&&(this._icon=e,this._changed.emit(void 0))}get iconClass(){return this._iconClass}set iconClass(e){this._iconClass!==e&&(this._iconClass=e,this._changed.emit(void 0))}get iconLabel(){return this._iconLabel}set iconLabel(e){this._iconLabel!==e&&(this._iconLabel=e,this._changed.emit(void 0))}get caption(){return this._caption}set caption(e){this._caption!==e&&(this._caption=e,this._changed.emit(void 0))}get className(){return this._className}set className(e){this._className!==e&&(this._className=e,this._changed.emit(void 0))}get closable(){return this._closable}set closable(e){this._closable!==e&&(this._closable=e,this._changed.emit(void 0))}get dataset(){return this._dataset}set dataset(e){this._dataset!==e&&(this._dataset=e,this._changed.emit(void 0))}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,r.Signal.clearData(this))}}class b{constructor(e={}){this._flags=0,this._layout=null,this._parent=null,this._disposed=new r.Signal(this),this._hiddenMode=b.HiddenMode.Display,this.node=g.createNode(e),this.addClass("lm-Widget")}dispose(){this.isDisposed||(this.setFlag(b.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&b.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),this.title.dispose(),r.Signal.clearData(this),n.MessageLoop.clearData(this),a.AttachedProperty.clearData(this))}get disposed(){return this._disposed}get isDisposed(){return this.testFlag(b.Flag.IsDisposed)}get isAttached(){return this.testFlag(b.Flag.IsAttached)}get isHidden(){return this.testFlag(b.Flag.IsHidden)}get isVisible(){return this.testFlag(b.Flag.IsVisible)}get title(){return g.titleProperty.get(this)}get id(){return this.node.id}set id(e){this.node.id=e}get dataset(){return this.node.dataset}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){this._hiddenMode!==e&&(this.isHidden&&this._toggleHidden(!1),e==b.HiddenMode.Scale?this.node.style.willChange="transform":this.node.style.willChange="auto",this._hiddenMode=e,this.isHidden&&this._toggleHidden(!0))}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(e&&this.contains(e))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){let e=new b.ChildMessage("child-removed",this);n.MessageLoop.sendMessage(this._parent,e)}if(this._parent=e,this._parent&&!this._parent.isDisposed){let e=new b.ChildMessage("child-added",this);n.MessageLoop.sendMessage(this._parent,e)}this.isDisposed||n.MessageLoop.sendMessage(this,b.Msg.ParentChanged)}}get layout(){return this._layout}set layout(e){if(this._layout!==e){if(this.testFlag(b.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(e.parent)throw new Error("Cannot change layout parent.");this._layout=e,e.parent=this}}*children(){this._layout&&(yield*this._layout)}contains(e){for(let t=e;t;t=t._parent)if(t===this)return!0;return!1}hasClass(e){return this.node.classList.contains(e)}addClass(e){this.node.classList.add(e)}removeClass(e){this.node.classList.remove(e)}toggleClass(e,t){return!0===t?(this.node.classList.add(e),!0):!1===t?(this.node.classList.remove(e),!1):this.node.classList.toggle(e)}update(){n.MessageLoop.postMessage(this,b.Msg.UpdateRequest)}fit(){n.MessageLoop.postMessage(this,b.Msg.FitRequest)}activate(){n.MessageLoop.postMessage(this,b.Msg.ActivateRequest)}close(){n.MessageLoop.sendMessage(this,b.Msg.CloseRequest)}show(){if(this.testFlag(b.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.BeforeShow),this.clearFlag(b.Flag.IsHidden),this._toggleHidden(!1),!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.AfterShow),this.parent)){let e=new b.ChildMessage("child-shown",this);n.MessageLoop.sendMessage(this.parent,e)}}hide(){if(!this.testFlag(b.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.BeforeHide),this.setFlag(b.Flag.IsHidden),this._toggleHidden(!0),!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.AfterHide),this.parent)){let e=new b.ChildMessage("child-hidden",this);n.MessageLoop.sendMessage(this.parent,e)}}setHidden(e){e?this.hide():this.show()}testFlag(e){return 0!=(this._flags&e)}setFlag(e){this._flags|=e}clearFlag(e){this._flags&=~e}processMessage(e){switch(e.type){case"resize":this.notifyLayout(e),this.onResize(e);break;case"update-request":this.notifyLayout(e),this.onUpdateRequest(e);break;case"fit-request":this.notifyLayout(e),this.onFitRequest(e);break;case"before-show":this.notifyLayout(e),this.onBeforeShow(e);break;case"after-show":this.setFlag(b.Flag.IsVisible),this.notifyLayout(e),this.onAfterShow(e);break;case"before-hide":this.notifyLayout(e),this.onBeforeHide(e);break;case"after-hide":this.clearFlag(b.Flag.IsVisible),this.notifyLayout(e),this.onAfterHide(e);break;case"before-attach":this.notifyLayout(e),this.onBeforeAttach(e);break;case"after-attach":this.isHidden||this.parent&&!this.parent.isVisible||this.setFlag(b.Flag.IsVisible),this.setFlag(b.Flag.IsAttached),this.notifyLayout(e),this.onAfterAttach(e);break;case"before-detach":this.notifyLayout(e),this.onBeforeDetach(e);break;case"after-detach":this.clearFlag(b.Flag.IsVisible),this.clearFlag(b.Flag.IsAttached),this.notifyLayout(e),this.onAfterDetach(e);break;case"activate-request":this.notifyLayout(e),this.onActivateRequest(e);break;case"close-request":this.notifyLayout(e),this.onCloseRequest(e);break;case"child-added":this.notifyLayout(e),this.onChildAdded(e);break;case"child-removed":this.notifyLayout(e),this.onChildRemoved(e);break;default:this.notifyLayout(e)}}notifyLayout(e){this._layout&&this._layout.processParentMessage(e)}onCloseRequest(e){this.parent?this.parent=null:this.isAttached&&b.detach(this)}onResize(e){}onUpdateRequest(e){}onFitRequest(e){}onActivateRequest(e){}onBeforeShow(e){}onAfterShow(e){}onBeforeHide(e){}onAfterHide(e){}onBeforeAttach(e){}onAfterAttach(e){}onBeforeDetach(e){}onAfterDetach(e){}onChildAdded(e){}onChildRemoved(e){}_toggleHidden(e){if(e)switch(this._hiddenMode){case b.HiddenMode.Display:this.addClass("lm-mod-hidden");break;case b.HiddenMode.Scale:this.node.style.transform="scale(0)",this.node.setAttribute("aria-hidden","true");break;case b.HiddenMode.ContentVisibility:this.node.style.contentVisibility="hidden",this.node.style.zIndex="-1"}else switch(this._hiddenMode){case b.HiddenMode.Display:this.removeClass("lm-mod-hidden");break;case b.HiddenMode.Scale:this.node.style.transform="",this.node.removeAttribute("aria-hidden");break;case b.HiddenMode.ContentVisibility:this.node.style.contentVisibility="",this.node.style.zIndex=""}}}!function(e){var t,i,s;(t=e.HiddenMode||(e.HiddenMode={}))[t.Display=0]="Display",t[t.Scale=1]="Scale",t[t.ContentVisibility=2]="ContentVisibility",(i=e.Flag||(e.Flag={}))[i.IsDisposed=1]="IsDisposed",i[i.IsAttached=2]="IsAttached",i[i.IsHidden=4]="IsHidden",i[i.IsVisible=8]="IsVisible",i[i.DisallowLayout=16]="DisallowLayout",(s=e.Msg||(e.Msg={})).BeforeShow=new n.Message("before-show"),s.AfterShow=new n.Message("after-show"),s.BeforeHide=new n.Message("before-hide"),s.AfterHide=new n.Message("after-hide"),s.BeforeAttach=new n.Message("before-attach"),s.AfterAttach=new n.Message("after-attach"),s.BeforeDetach=new n.Message("before-detach"),s.AfterDetach=new n.Message("after-detach"),s.ParentChanged=new n.Message("parent-changed"),s.UpdateRequest=new n.ConflatableMessage("update-request"),s.FitRequest=new n.ConflatableMessage("fit-request"),s.ActivateRequest=new n.ConflatableMessage("activate-request"),s.CloseRequest=new n.ConflatableMessage("close-request");class a extends n.Message{constructor(e,t){super(e),this.child=t}}e.ChildMessage=a;class r extends n.Message{constructor(e,t){super("resize"),this.width=e,this.height=t}}e.ResizeMessage=r,function(e){e.UnknownSize=new e(-1,-1)}(r=e.ResizeMessage||(e.ResizeMessage={})),e.attach=function(t,i,s=null){if(t.parent)throw new Error("Cannot attach a child widget.");if(t.isAttached||t.node.isConnected)throw new Error("Widget is already attached.");if(!i.isConnected)throw new Error("Host is not attached.");n.MessageLoop.sendMessage(t,e.Msg.BeforeAttach),i.insertBefore(t.node,s),n.MessageLoop.sendMessage(t,e.Msg.AfterAttach)},e.detach=function(t){if(t.parent)throw new Error("Cannot detach a child widget.");if(!t.isAttached||!t.node.isConnected)throw new Error("Widget is not attached.");n.MessageLoop.sendMessage(t,e.Msg.BeforeDetach),t.node.parentNode.removeChild(t.node),n.MessageLoop.sendMessage(t,e.Msg.AfterDetach)}}(b||(b={})),function(e){e.titleProperty=new a.AttachedProperty({name:"title",create:e=>new f({owner:e})}),e.createNode=function(e){return e.node||document.createElement(e.tag||"div")}}(g||(g={}));class v{constructor(e={}){this._disposed=!1,this._parent=null,this._fitPolicy=e.fitPolicy||"set-min-size"}dispose(){this._parent=null,this._disposed=!0,r.Signal.clearData(this),a.AttachedProperty.clearData(this)}get isDisposed(){return this._disposed}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(this._parent)throw new Error("Cannot change parent widget.");if(e.layout!==this)throw new Error("Invalid parent widget.");this._parent=e,this.init()}}get fitPolicy(){return this._fitPolicy}set fitPolicy(e){if(this._fitPolicy!==e&&(this._fitPolicy=e,this._parent)){let e=this._parent.node.style;e.minWidth="",e.minHeight="",e.maxWidth="",e.maxHeight="",this._parent.fit()}}processParentMessage(e){switch(e.type){case"resize":this.onResize(e);break;case"update-request":this.onUpdateRequest(e);break;case"fit-request":this.onFitRequest(e);break;case"before-show":this.onBeforeShow(e);break;case"after-show":this.onAfterShow(e);break;case"before-hide":this.onBeforeHide(e);break;case"after-hide":this.onAfterHide(e);break;case"before-attach":this.onBeforeAttach(e);break;case"after-attach":this.onAfterAttach(e);break;case"before-detach":this.onBeforeDetach(e);break;case"after-detach":this.onAfterDetach(e);break;case"child-removed":this.onChildRemoved(e);break;case"child-shown":this.onChildShown(e);break;case"child-hidden":this.onChildHidden(e)}}init(){for(const e of this)e.parent=this.parent}onResize(e){for(const e of this)n.MessageLoop.sendMessage(e,b.ResizeMessage.UnknownSize)}onUpdateRequest(e){for(const e of this)n.MessageLoop.sendMessage(e,b.ResizeMessage.UnknownSize)}onBeforeAttach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onAfterAttach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onBeforeDetach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onAfterDetach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onBeforeShow(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onAfterShow(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onBeforeHide(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onAfterHide(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onChildRemoved(e){this.removeWidget(e.child)}onFitRequest(e){}onChildShown(e){}onChildHidden(e){}}!function(e){e.getHorizontalAlignment=function(e){return p.horizontalAlignmentProperty.get(e)},e.setHorizontalAlignment=function(e,t){p.horizontalAlignmentProperty.set(e,t)},e.getVerticalAlignment=function(e){return p.verticalAlignmentProperty.get(e)},e.setVerticalAlignment=function(e,t){p.verticalAlignmentProperty.set(e,t)}}(v||(v={}));class x{constructor(e){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=e,this.widget.node.style.position="absolute",this.widget.node.style.contain="strict"}dispose(){if(this._disposed)return;this._disposed=!0;let e=this.widget.node.style;e.position="",e.top="",e.left="",e.width="",e.height="",e.contain=""}get minWidth(){return this._minWidth}get minHeight(){return this._minHeight}get maxWidth(){return this._maxWidth}get maxHeight(){return this._maxHeight}get isDisposed(){return this._disposed}get isHidden(){return this.widget.isHidden}get isVisible(){return this.widget.isVisible}get isAttached(){return this.widget.isAttached}fit(){let e=s.ElementExt.sizeLimits(this.widget.node);this._minWidth=e.minWidth,this._minHeight=e.minHeight,this._maxWidth=e.maxWidth,this._maxHeight=e.maxHeight}update(e,t,i,s){let a=Math.max(this._minWidth,Math.min(i,this._maxWidth)),r=Math.max(this._minHeight,Math.min(s,this._maxHeight));if(a"center",changed:t}),e.verticalAlignmentProperty=new a.AttachedProperty({name:"verticalAlignment",create:()=>"top",changed:t})}(p||(p={}));class M extends v{constructor(){super(...arguments),this._widgets=[]}dispose(){for(;this._widgets.length>0;)this._widgets.pop().dispose();super.dispose()}get widgets(){return this._widgets}*[Symbol.iterator](){yield*this._widgets}addWidget(e){this.insertWidget(this._widgets.length,e)}insertWidget(e,i){i.parent=this.parent;let s=this._widgets.indexOf(i),n=Math.max(0,Math.min(e,this._widgets.length));if(-1===s)return t.ArrayExt.insert(this._widgets,n,i),void(this.parent&&this.attachWidget(n,i));n===this._widgets.length&&n--,s!==n&&(t.ArrayExt.move(this._widgets,s,n),this.parent&&this.moveWidget(s,n,i))}removeWidget(e){this.removeWidgetAt(this._widgets.indexOf(e))}removeWidgetAt(e){let i=t.ArrayExt.removeAt(this._widgets,e);i&&this.parent&&this.detachWidget(e,i)}init(){super.init();let e=0;for(const t of this)this.attachWidget(e++,t)}attachWidget(e,t){let i=this.parent.node.children[e];this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.BeforeAttach),this.parent.node.insertBefore(t.node,i),this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.AfterAttach)}moveWidget(e,t,i){this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach);let s=this.parent.node.children[t];this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.insertBefore(i.node,s),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach)}detachWidget(e,t){this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.AfterDetach)}}!function(e){e.clampDimension=function(e){return Math.max(0,Math.floor(e))}}(_||(_={}));var y,w,A,E,C,S,I,z,L,T,D=_;class B extends M{constructor(e){super(),this.widgetOffset=0,this._fixed=0,this._spacing=4,this._dirty=!1,this._hasNormedSizes=!1,this._sizers=[],this._items=[],this._handles=[],this._box=null,this._alignment="start",this._orientation="horizontal",this.renderer=e.renderer,void 0!==e.orientation&&(this._orientation=e.orientation),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=_.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,super.dispose()}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._orientation=e,this.parent&&(this.parent.dataset.orientation=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=_.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get handles(){return this._handles}absoluteSizes(){return this._sizers.map((e=>e.size))}relativeSizes(){return y.normalize(this._sizers.map((e=>e.size)))}setRelativeSizes(e,t=!0){let i=this._sizers.length,s=e.slice(0,i);for(;s.length0&&(e.sizeHint=e.size);e.BoxEngine.adjust(this._sizers,t,s),this.parent&&this.parent.update()}}init(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,i){let s=new x(i),a=y.createHandle(this.renderer),r=y.averageSize(this._sizers),o=y.createSizer(r);t.ArrayExt.insert(this._items,e,s),t.ArrayExt.insert(this._sizers,e,o),t.ArrayExt.insert(this._handles,e,a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.node.appendChild(a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),t.ArrayExt.move(this._sizers,e,i),t.ArrayExt.move(this._handles,e,i),this.parent.fit()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e),a=t.ArrayExt.removeAt(this._handles,e);t.ArrayExt.removeAt(this._sizers,e),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.node.removeChild(a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}updateItemPosition(e,t,i,s,n,a,r){const o=this._items[e];if(o.isHidden)return;let h=this._handles[e].style;t?(i+=this.widgetOffset,o.update(i,s,r,n),i+=r,h.top=`${s}px`,h.left=`${i}px`,h.width=`${this._spacing}px`,h.height=`${n}px`):(s+=this.widgetOffset,o.update(i,s,a,r),s+=r,h.top=`${s}px`,h.left=`${i}px`,h.width=`${a}px`,h.height=`${this._spacing}px`)}_fit(){let e=0,t=-1;for(let i=0,s=this._items.length;i0&&(s.sizeHint=s.size),t.isHidden?(s.minSize=0,s.maxSize=0):(t.fit(),s.stretch=B.getStretch(t.widget),i?(s.minSize=t.minWidth,s.maxSize=t.maxWidth,a+=t.minWidth,r=Math.max(r,t.minHeight)):(s.minSize=t.minHeight,s.maxSize=t.maxHeight,r+=t.minHeight,a=Math.max(a,t.minWidth)))}let o=this._box=s.ElementExt.boxSizing(this.parent.node);a+=o.horizontalSum,r+=o.verticalSum;let h=this.parent.node.style;h.minWidth=`${a}px`,h.minHeight=`${r}px`,this._dirty=!0,this.parent.parent&&n.MessageLoop.sendMessage(this.parent.parent,b.Msg.FitRequest),this._dirty&&n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest)}_update(t,i){this._dirty=!1;let n=0;for(let e=0,t=this._items.length;e0){let t;if(t=c?Math.max(0,o-this._fixed):Math.max(0,h-this._fixed),this._hasNormedSizes){for(let e of this._sizers)e.sizeHint*=t;this._hasNormedSizes=!1}let i=e.BoxEngine.calc(this._sizers,t);if(i>0)switch(this._alignment){case"start":break;case"center":d=0,l=i/2;break;case"end":d=0,l=i;break;case"justify":d=i/n,l=0;break;default:throw"unreachable"}}for(let e=0,t=this._items.length;e0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:function(e){e.parent&&e.parent.layout instanceof B&&e.parent.fit()}}),e.createSizer=function(e){let t=new u;return t.sizeHint=Math.floor(e),t},e.createHandle=function(e){let t=e.createHandle();return t.style.position="absolute",t.style.contain="style",t},e.averageSize=function(e){return e.reduce(((e,t)=>e+t.size),0)/e.length||0},e.normalize=function(e){let t=e.length;if(0===t)return[];let i=e.reduce(((e,t)=>e+Math.abs(t)),0);return 0===i?e.map((e=>1/t)):e.map((e=>e/i))}}(y||(y={}));class k extends B{constructor(e){super({...e,orientation:e.orientation||"vertical"}),this._titles=[],this.titleSpace=e.titleSpace||22}get titleSpace(){return this.widgetOffset}set titleSpace(e){e=D.clampDimension(e),this.widgetOffset!==e&&(this.widgetOffset=e,this.parent&&this.parent.fit())}get titles(){return this._titles}dispose(){this.isDisposed||(this._titles.length=0,super.dispose())}updateTitle(e,t){const i=this._titles[e],s=i.classList.contains("lm-mod-expanded"),n=w.createTitle(this.renderer,t.title,s);this._titles[e]=n,this.parent.node.replaceChild(n,i)}insertWidget(e,t){t.id||(t.id=`id-${i.UUID.uuid4()}`),super.insertWidget(e,t)}attachWidget(e,i){const s=w.createTitle(this.renderer,i.title);t.ArrayExt.insert(this._titles,e,s),this.parent.node.appendChild(s),i.node.setAttribute("role","region"),i.node.setAttribute("aria-labelledby",s.id),super.attachWidget(e,i)}moveWidget(e,i,s){t.ArrayExt.move(this._titles,e,i),super.moveWidget(e,i,s)}detachWidget(e,i){const s=t.ArrayExt.removeAt(this._titles,e);this.parent.node.removeChild(s),super.detachWidget(e,i)}updateItemPosition(e,t,i,s,n,a,r){const o=this._titles[e].style;o.top=`${s}px`,o.left=`${i}px`,o.height=`${this.widgetOffset}px`,o.width=t?`${n}px`:`${a}px`,super.updateItemPosition(e,t,i,s,n,a,r)}}!function(e){e.createTitle=function(e,t,i=!0){const s=e.createSectionTitle(t);return s.style.position="absolute",s.style.contain="strict",s.setAttribute("aria-label",`${t.label} Section`),s.setAttribute("aria-expanded",i?"true":"false"),s.setAttribute("aria-controls",t.owner.id),i&&s.classList.add("lm-mod-expanded"),s}}(w||(w={}));class R extends b{constructor(e={}){super(),this.addClass("lm-Panel"),this.layout=A.createLayout(e)}get widgets(){return this.layout.widgets}addWidget(e){this.layout.addWidget(e)}insertWidget(e,t){this.layout.insertWidget(e,t)}}!function(e){e.createLayout=function(e){return e.layout||new M}}(A||(A={}));class N extends R{constructor(e={}){super({layout:E.createLayout(e)}),this._handleMoved=new r.Signal(this),this._pressData=null,this.addClass("lm-SplitPanel")}dispose(){this._releaseMouse(),super.dispose()}get orientation(){return this.layout.orientation}set orientation(e){this.layout.orientation=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get renderer(){return this.layout.renderer}get handleMoved(){return this._handleMoved}get handles(){return this.layout.handles}relativeSizes(){return this.layout.relativeSizes()}setRelativeSizes(e,t=!0){this.layout.setRelativeSizes(e,t)}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){e.child.addClass("lm-SplitPanel-child"),this._releaseMouse()}onChildRemoved(e){e.child.removeClass("lm-SplitPanel-child"),this._releaseMouse()}_evtKeyDown(e){this._pressData&&(e.preventDefault(),e.stopPropagation()),27===e.keyCode&&this._releaseMouse()}_evtPointerDown(e){if(0!==e.button)return;let i,s=this.layout,n=t.ArrayExt.findFirstIndex(s.handles,(t=>t.contains(e.target)));if(-1===n)return;e.preventDefault(),e.stopPropagation(),document.addEventListener("pointerup",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);let a=s.handles[n],r=a.getBoundingClientRect();i="horizontal"===s.orientation?e.clientX-r.left:e.clientY-r.top;let h=window.getComputedStyle(a),d=o.Drag.overrideCursor(h.cursor);this._pressData={index:n,delta:i,override:d}}_evtPointerMove(e){let t;e.preventDefault(),e.stopPropagation();let i=this.layout,s=this.node.getBoundingClientRect();t="horizontal"===i.orientation?e.clientX-s.left-this._pressData.delta:e.clientY-s.top-this._pressData.delta,i.moveHandle(this._pressData.index,t)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._handleMoved.emit(),document.removeEventListener("keydown",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("contextmenu",this,!0))}}!function(e){class t{createHandle(){let e=document.createElement("div");return e.className="lm-SplitPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t,e.getStretch=function(e){return B.getStretch(e)},e.setStretch=function(e,t){B.setStretch(e,t)}}(N||(N={})),function(e){e.createLayout=function(e){return e.layout||new B({renderer:e.renderer||N.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing})}}(E||(E={}));class H extends N{constructor(e={}){super({...e,layout:C.createLayout(e)}),this._widgetSizesCache=new WeakMap,this._expansionToggled=new r.Signal(this),this.addClass("lm-AccordionPanel")}get renderer(){return this.layout.renderer}get titleSpace(){return this.layout.titleSpace}set titleSpace(e){this.layout.titleSpace=e}get titles(){return this.layout.titles}get expansionToggled(){return this._expansionToggled}addWidget(e){super.addWidget(e),e.title.changed.connect(this._onTitleChanged,this)}collapse(e){const t=this.layout.widgets[e];t&&!t.isHidden&&this._toggleExpansion(e)}expand(e){const t=this.layout.widgets[e];t&&t.isHidden&&this._toggleExpansion(e)}insertWidget(e,t){super.insertWidget(e,t),t.title.changed.connect(this._onTitleChanged,this)}handleEvent(e){switch(super.handleEvent(e),e.type){case"click":this._evtClick(e);break;case"keydown":this._eventKeyDown(e)}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),super.onBeforeAttach(e)}onAfterDetach(e){super.onAfterDetach(e),this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this)}_onTitleChanged(e){const i=t.ArrayExt.findFirstIndex(this.widgets,(t=>t.contains(e.owner)));i>=0&&(this.layout.updateTitle(i,e.owner),this.update())}_computeWidgetSize(e){const t=this.layout,i=t.widgets[e];if(!i)return;const s=i.isHidden,n=t.absoluteSizes(),a=(s?-1:1)*this.spacing,r=n.reduce(((e,t)=>e+t));let o=[...n];if(s){const t=this._widgetSizesCache.get(i);if(!t)return;o[e]+=t;const s=o.map((e=>e-t>0)).lastIndexOf(!0);-1===s?o.forEach(((i,s)=>{s!==e&&(o[s]-=n[s]/r*(t-a))})):o[s]-=t-a}else{const t=n[e];this._widgetSizesCache.set(i,t),o[e]=0;const s=o.map((e=>e>0)).lastIndexOf(!0);if(-1===s)return;o[s]=n[s]+t+a}return o.map((e=>e/(r+a)))}_evtClick(e){const i=e.target;if(i){const s=t.ArrayExt.findFirstIndex(this.titles,(e=>e.contains(i)));s>=0&&(e.preventDefault(),e.stopPropagation(),this._toggleExpansion(s))}}_eventKeyDown(e){if(e.defaultPrevented)return;const i=e.target;let s=!1;if(i){const n=t.ArrayExt.findFirstIndex(this.titles,(e=>e.contains(i)));if(n>=0){const t=e.keyCode.toString();if(e.key.match(/Space|Enter/)||t.match(/13|32/))i.click(),s=!0;else if("horizontal"===this.orientation?e.key.match(/ArrowLeft|ArrowRight/)||t.match(/37|39/):e.key.match(/ArrowUp|ArrowDown/)||t.match(/38|40/)){const i=e.key.match(/ArrowLeft|ArrowUp/)||t.match(/37|38/)?-1:1,a=this.titles.length,r=(n+a+i)%a;this.titles[r].focus(),s=!0}else"End"===e.key||"35"===t?(this.titles[this.titles.length-1].focus(),s=!0):"Home"!==e.key&&"36"!==t||(this.titles[0].focus(),s=!0)}s&&e.preventDefault()}}_toggleExpansion(e){const t=this.titles[e],i=this.layout.widgets[e],s=this._computeWidgetSize(e);s&&this.setRelativeSizes(s,!1),i.isHidden?(t.classList.add("lm-mod-expanded"),t.setAttribute("aria-expanded","true"),i.show()):(t.classList.remove("lm-mod-expanded"),t.setAttribute("aria-expanded","false"),i.hide()),this._expansionToggled.emit(e)}}!function(e){class t extends N.Renderer{constructor(){super(),this.titleClassName="lm-AccordionPanel-title",this._titleID=0,this._titleKeys=new WeakMap,this._uuid=++t._nInstance}createCollapseIcon(e){return document.createElement("span")}createSectionTitle(e){const t=document.createElement("h3");t.setAttribute("tabindex","0"),t.id=this.createTitleKey(e),t.className=this.titleClassName;for(const i in e.dataset)t.dataset[i]=e.dataset[i];t.appendChild(this.createCollapseIcon(e)).className="lm-AccordionPanel-titleCollapser";const i=t.appendChild(document.createElement("span"));return i.className="lm-AccordionPanel-titleLabel",i.textContent=e.label,i.title=e.caption||e.label,t}createTitleKey(e){let t=this._titleKeys.get(e);return void 0===t&&(t=`title-key-${this._uuid}-${this._titleID++}`,this._titleKeys.set(e,t)),t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t}(H||(H={})),function(e){e.createLayout=function(e){return e.layout||new k({renderer:e.renderer||H.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing,titleSpace:e.titleSpace})}}(C||(C={}));class P extends M{constructor(e={}){super(),this._fixed=0,this._spacing=4,this._dirty=!1,this._sizers=[],this._items=[],this._box=null,this._alignment="start",this._direction="top-to-bottom",void 0!==e.direction&&(this._direction=e.direction),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=D.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,super.dispose()}get direction(){return this._direction}set direction(e){this._direction!==e&&(this._direction=e,this.parent&&(this.parent.dataset.direction=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=D.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}init(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,i){t.ArrayExt.insert(this._items,e,new x(i)),t.ArrayExt.insert(this._sizers,e,new u),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),t.ArrayExt.move(this._sizers,e,i),this.parent.update()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e);t.ArrayExt.removeAt(this._sizers,e),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0;for(let t=0,i=this._items.length;t0)switch(this._alignment){case"start":break;case"center":l=0,c=a/2;break;case"end":l=0,c=a;break;case"justify":l=a/n,c=0;break;default:throw"unreachable"}for(let e=0,t=this._items.length;e0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.sizeBasisProperty=new a.AttachedProperty({name:"sizeBasis",create:()=>0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.isHorizontal=function(e){return"left-to-right"===e||"right-to-left"===e},e.clampSpacing=function(e){return Math.max(0,Math.floor(e))}}(S||(S={}));class W extends R{constructor(e={}){super({layout:I.createLayout(e)}),this.addClass("lm-BoxPanel")}get direction(){return this.layout.direction}set direction(e){this.layout.direction=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}onChildAdded(e){e.child.addClass("lm-BoxPanel-child")}onChildRemoved(e){e.child.removeClass("lm-BoxPanel-child")}}!function(e){e.getStretch=function(e){return P.getStretch(e)},e.setStretch=function(e,t){P.setStretch(e,t)},e.getSizeBasis=function(e){return P.getSizeBasis(e)},e.setSizeBasis=function(e,t){P.setSizeBasis(e,t)}}(W||(W={})),function(e){e.createLayout=function(e){return e.layout||new P(e)}}(I||(I={}));class q extends b{constructor(e){super({node:z.createNode()}),this._activeIndex=-1,this._items=[],this._results=null,this.addClass("lm-CommandPalette"),this.setFlag(b.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||q.defaultRenderer,this.commands.commandChanged.connect(this._onGenericChange,this),this.commands.keyBindingChanged.connect(this._onGenericChange,this)}dispose(){this._items.length=0,this._results=null,super.dispose()}get searchNode(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]}get inputNode(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]}get contentNode(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]}get items(){return this._items}addItem(e){let t=z.createItem(this.commands,e);return this._items.push(t),this.refresh(),t}addItems(e){const t=e.map((e=>z.createItem(this.commands,e)));return t.forEach((e=>this._items.push(e))),this.refresh(),t}removeItem(e){this.removeItemAt(this._items.indexOf(e))}removeItemAt(e){t.ArrayExt.removeAt(this._items,e)&&this.refresh()}clearItems(){0!==this._items.length&&(this._items.length=0,this.refresh())}refresh(){if(this._results=null,""!==this.inputNode.value){this.node.getElementsByClassName("lm-close-icon")[0].style.display="inherit"}else{this.node.getElementsByClassName("lm-close-icon")[0].style.display="none"}this.update()}handleEvent(e){switch(e.type){case"click":this._evtClick(e);break;case"keydown":this._evtKeyDown(e);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused()}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)}onAfterDetach(e){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)}onAfterShow(e){this.update(),super.onAfterShow(e)}onActivateRequest(e){if(this.isAttached){let e=this.inputNode;e.focus(),e.select()}}onUpdateRequest(e){if(this.isHidden)return;let i=this.inputNode.value,n=this.contentNode,a=this._results;if(a||(a=this._results=z.search(this._items,i),this._activeIndex=i?t.ArrayExt.findFirstIndex(a,z.canActivate):-1),!i&&0===a.length)return void d.VirtualDOM.render(null,n);if(i&&0===a.length){let e=this.renderer.renderEmptyMessage({query:i});return void d.VirtualDOM.render(e,n)}let r=this.renderer,o=this._activeIndex,h=new Array(a.length);for(let e=0,t=a.length;e=a.length)n.scrollTop=0;else{let e=n.children[o];s.ElementExt.scrollIntoViewIfNeeded(n,e)}}_evtClick(e){if(0!==e.button)return;if(e.target.classList.contains("lm-close-icon"))return this.inputNode.value="",void this.refresh();let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>t.contains(e.target)));-1!==i&&(e.preventDefault(),e.stopPropagation(),this._execute(i))}_evtKeyDown(e){if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey))switch(e.keyCode){case 13:e.preventDefault(),e.stopPropagation(),this._execute(this._activeIndex);break;case 38:e.preventDefault(),e.stopPropagation(),this._activatePreviousItem();break;case 40:e.preventDefault(),e.stopPropagation(),this._activateNextItem()}}_activateNextItem(){if(!this._results||0===this._results.length)return;let e=this._activeIndex,i=this._results.length,s=ee-t)),l=r.slice(0,d),c=r.slice(d);for(let e=0,t=c.length;et.command===e&&i.JSONExt.deepEqual(t.args,s)))||null}}}(z||(z={}));class F extends b{constructor(e){super({node:L.createNode()}),this._childIndex=-1,this._activeIndex=-1,this._openTimerID=0,this._closeTimerID=0,this._items=[],this._childMenu=null,this._parentMenu=null,this._aboutToClose=new r.Signal(this),this._menuRequested=new r.Signal(this),this.addClass("lm-Menu"),this.setFlag(b.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||F.defaultRenderer}dispose(){this.close(),this._items.length=0,super.dispose()}get aboutToClose(){return this._aboutToClose}get menuRequested(){return this._menuRequested}get parentMenu(){return this._parentMenu}get childMenu(){return this._childMenu}get rootMenu(){let e=this;for(;e._parentMenu;)e=e._parentMenu;return e}get leafMenu(){let e=this;for(;e._childMenu;)e=e._childMenu;return e}get contentNode(){return this.node.getElementsByClassName("lm-Menu-content")[0]}get activeItem(){return this._items[this._activeIndex]||null}set activeItem(e){this.activeIndex=e?this._items.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._items.length)&&(e=-1),-1===e||L.canActivate(this._items[e])||(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())}get items(){return this._items}activateNextItem(){let e=this._items.length,i=this._activeIndex,s=i{this.activeIndex=e}})}d.VirtualDOM.render(a,this.contentNode)}onCloseRequest(e){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;let t=this._childMenu;t&&(this._childIndex=-1,this._childMenu=null,t._parentMenu=null,t.close());let i=this._parentMenu;i&&(this._parentMenu=null,i._childIndex=-1,i._childMenu=null,i.activate()),this.isAttached&&this._aboutToClose.emit(void 0),super.onCloseRequest(e)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation();let t=e.keyCode;if(13===t)return void this.triggerActiveItem();if(27===t)return void this.close();if(37===t)return void(this._parentMenu?this.close():this._menuRequested.emit("previous"));if(38===t)return void this.activatePreviousItem();if(39===t){let e=this.activeItem;return void(e&&"submenu"===e.type?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next"))}if(40===t)return void this.activateNextItem();let i=c.getKeyboardLayout().keyForKeydownEvent(e);if(!i)return;let s=this._activeIndex+1,n=L.findMnemonic(this._items,i,s);-1===n.index||n.multiple?-1!==n.index?this.activeIndex=n.index:-1!==n.auto&&(this.activeIndex=n.auto):(this.activeIndex=n.index,this.triggerActiveItem())}_evtMouseUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this.triggerActiveItem())}_evtMouseMove(e){let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(i===this._activeIndex)return;if(this.activeIndex=i,i=this.activeIndex,i===this._childIndex)return this._cancelOpenTimer(),void this._cancelCloseTimer();-1!==this._childIndex&&this._startCloseTimer(),this._cancelOpenTimer();let n=this.activeItem;n&&"submenu"===n.type&&n.submenu&&this._startOpenTimer()}_evtMouseEnter(e){for(let e=this._parentMenu;e;e=e._parentMenu)e._cancelOpenTimer(),e._cancelCloseTimer(),e.activeIndex=e._childIndex}_evtMouseLeave(e){if(this._cancelOpenTimer(),!this._childMenu)return void(this.activeIndex=-1);let{clientX:t,clientY:i}=e;s.ElementExt.hitTest(this._childMenu.node,t,i)?this._cancelCloseTimer():(this.activeIndex=-1,this._startCloseTimer())}_evtMouseDown(e){this._parentMenu||(L.hitTestMenus(this,e.clientX,e.clientY)?(e.preventDefault(),e.stopPropagation()):this.close())}_openChildMenu(e=!1){let t=this.activeItem;if(!t||"submenu"!==t.type||!t.submenu)return void this._closeChildMenu();let i=t.submenu;if(i===this._childMenu)return;F.saveWindowData(),this._closeChildMenu(),this._childMenu=i,this._childIndex=this._activeIndex,i._parentMenu=this,n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest);let s=this.contentNode.children[this._activeIndex];L.openSubmenu(i,s),e&&(i.activeIndex=-1,i.activateNextItem()),i.activate()}_closeChildMenu(){this._childMenu&&this._childMenu.close()}_startOpenTimer(){0===this._openTimerID&&(this._openTimerID=window.setTimeout((()=>{this._openTimerID=0,this._openChildMenu()}),L.TIMER_DELAY))}_startCloseTimer(){0===this._closeTimerID&&(this._closeTimerID=window.setTimeout((()=>{this._closeTimerID=0,this._closeChildMenu()}),L.TIMER_DELAY))}_cancelOpenTimer(){0!==this._openTimerID&&(clearTimeout(this._openTimerID),this._openTimerID=0)}_cancelCloseTimer(){0!==this._closeTimerID&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)}static saveWindowData(){L.saveWindowData()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),i=this.createItemDataset(e),s=this.createItemARIA(e);return d.h.li({className:t,dataset:i,tabindex:"0",onfocus:e.onfocus,...s},this.renderIcon(e),this.renderLabel(e),this.renderShortcut(e),this.renderSubmenu(e))}renderIcon(e){let t=this.createIconClass(e);return d.h.div({className:t},e.item.icon,e.item.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return d.h.div({className:"lm-Menu-itemLabel"},t)}renderShortcut(e){let t=this.formatShortcut(e);return d.h.div({className:"lm-Menu-itemShortcut"},t)}renderSubmenu(e){return d.h.div({className:"lm-Menu-itemSubmenuIcon"})}createItemClass(e){let t="lm-Menu-item";e.item.isEnabled||(t+=" lm-mod-disabled"),e.item.isToggled&&(t+=" lm-mod-toggled"),e.item.isVisible||(t+=" lm-mod-hidden"),e.active&&(t+=" lm-mod-active"),e.collapsed&&(t+=" lm-mod-collapsed");let i=e.item.className;return i&&(t+=` ${i}`),t}createItemDataset(e){let t,{type:i,command:s,dataset:n}=e.item;return t="command"===i?{...n,type:i,command:s}:{...n,type:i},t}createIconClass(e){let t="lm-Menu-itemIcon",i=e.item.iconClass;return i?`${t} ${i}`:t}createItemARIA(e){let t={};switch(e.item.type){case"separator":t.role="presentation";break;case"submenu":t["aria-haspopup"]="true",e.item.isEnabled||(t["aria-disabled"]="true");break;default:e.item.isEnabled||(t["aria-disabled"]="true"),t.role="menuitem"}return t}formatLabel(e){let{label:t,mnemonic:i}=e.item;if(i<0||i>=t.length)return t;let s=t.slice(0,i),n=t.slice(i+1),a=t[i];return[s,d.h.span({className:"lm-Menu-itemMnemonic"},a),n]}formatShortcut(e){let t=e.item.keyBinding;return t?h.CommandRegistry.formatKeystroke(t.keys):null}}e.Renderer=t,e.defaultRenderer=new t}(F||(F={})),function(e){e.TIMER_DELAY=300,e.SUBMENU_OVERLAP=3;let a=null,r=0;function o(){return r>0?(r--,a):d()}function h(e){return"separator"!==e.type&&e.isEnabled&&e.isVisible}function d(){return{pageXOffset:window.pageXOffset,pageYOffset:window.pageYOffset,clientWidth:document.documentElement.clientWidth,clientHeight:document.documentElement.clientHeight}}e.saveWindowData=function(){a=d(),r++},e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-Menu-content",e.appendChild(t),t.setAttribute("role","menu"),e.tabIndex=0,e},e.canActivate=h,e.createItem=function(e,t){return new l(e.commands,t)},e.hitTestMenus=function(e,t,i){for(let n=e;n;n=n.childMenu)if(s.ElementExt.hitTest(n.node,t,i))return!0;return!1},e.computeCollapsed=function(e){let i=new Array(e.length);t.ArrayExt.fill(i,!1);let s=0,n=e.length;for(;s=0;--a){let t=e[a];if(t.isVisible){if("separator"!==t.type)break;i[a]=!0}}let r=!1;for(;++sl+u&&(t=l+u-f),!a&&i+v>c+m&&(i>c+m?i=c+m-v:i-=v),_.transform=`translate(${Math.max(0,t)}px, ${Math.max(0,i)}px`,_.opacity="1"},e.openSubmenu=function(t,i){const a=o();let r=a.pageXOffset,h=a.pageYOffset,d=a.clientWidth,l=a.clientHeight;n.MessageLoop.sendMessage(t,b.Msg.UpdateRequest);let c=l,u=t.node,m=u.style;m.opacity="0",m.maxHeight=`${c}px`,b.attach(t,document.body);let{width:g,height:p}=u.getBoundingClientRect(),_=s.ElementExt.boxSizing(t.node),f=i.getBoundingClientRect(),v=f.right-e.SUBMENU_OVERLAP;v+g>r+d&&(v=f.left+e.SUBMENU_OVERLAP-g);let x=f.top-_.borderTop-_.paddingTop;x+p>h+l&&(x=f.bottom+_.borderBottom+_.paddingBottom-p),m.transform=`translate(${Math.max(0,v)}px, ${Math.max(0,x)}px`,m.opacity="1"},e.findMnemonic=function(e,t,i){let s=-1,n=-1,a=!1,r=t.toUpperCase();for(let t=0,o=e.length;t=0&&ut.command===e&&i.JSONExt.deepEqual(t.args,s)))||null}return null}}}(L||(L={}));!function(e){function t(e,t){let i=e.rank,s=t.rank;return i!==s?i=this._titles.length)&&(e=-1),this._currentIndex===e)return;let t=this._currentIndex,i=this._titles[t]||null,s=e,n=this._titles[s]||null;this._currentIndex=s,this._previousTitle=i,this.update(),this._currentChanged.emit({previousIndex:t,previousTitle:i,currentIndex:s,currentTitle:n})}get name(){return this._name}set name(e){this._name=e,e?this.contentNode.setAttribute("aria-label",e):this.contentNode.removeAttribute("aria-label")}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._releaseMouse(),this._orientation=e,this.dataset.orientation=e,this.contentNode.setAttribute("aria-orientation",e))}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled!==e&&(this._addButtonEnabled=e,e?this.addButtonNode.classList.remove("lm-mod-hidden"):this.addButtonNode.classList.add("lm-mod-hidden"))}get titles(){return this._titles}get contentNode(){return this.node.getElementsByClassName("lm-TabBar-content")[0]}get addButtonNode(){return this.node.getElementsByClassName("lm-TabBar-addButton")[0]}addTab(e){return this.insertTab(this._titles.length,e)}insertTab(e,i){this._releaseMouse();let s=V.asTitle(i),n=this._titles.indexOf(s),a=Math.max(0,Math.min(e,this._titles.length));return-1===n?(t.ArrayExt.insert(this._titles,a,s),s.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(a,s),s):(a===this._titles.length&&a--,n===a||(t.ArrayExt.move(this._titles,n,a),this.update(),this._adjustCurrentForMove(n,a)),s)}removeTab(e){this.removeTabAt(this._titles.indexOf(e))}removeTabAt(e){this._releaseMouse();let i=t.ArrayExt.removeAt(this._titles,e);i&&(i.changed.disconnect(this._onTitleChanged,this),i===this._previousTitle&&(this._previousTitle=null),this.update(),this._adjustCurrentForRemove(e,i))}clearTabs(){if(0===this._titles.length)return;this._releaseMouse();for(let e of this._titles)e.changed.disconnect(this._onTitleChanged,this);let e=this.currentIndex,t=this.currentTitle;this._currentIndex=-1,this._previousTitle=null,this._titles.length=0,this.update(),-1!==e&&this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}releaseMouse(){this._releaseMouse()}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"dblclick":this._evtDblClick(e);break;case"keydown":e.eventPhase===Event.CAPTURING_PHASE?this._evtKeyDownCapturing(e):this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this),this.node.addEventListener("dblclick",this),this.node.addEventListener("keydown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this.node.removeEventListener("dblclick",this),this.node.removeEventListener("keydown",this),this._releaseMouse()}onUpdateRequest(e){var t;let i=this._titles,s=this.renderer,n=this.currentTitle,a=new Array(i.length);const r=null!==(t=this._getCurrentTabindex())&&void 0!==t?t:this._currentIndex>-1?this._currentIndex:0;for(let e=0,t=i.length;es.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1===n)return;let a=this.titles[n],r=i[n].querySelector(".lm-TabBar-tabLabel");if(r&&r.contains(e.target)){let e=a.label||"",t=r.innerHTML;r.innerHTML="";let i=document.createElement("input");i.classList.add("lm-TabBar-tabInput"),i.value=e,r.appendChild(i);let s=()=>{i.removeEventListener("blur",s),r.innerHTML=t,this.node.addEventListener("keydown",this)};i.addEventListener("dblclick",(e=>e.stopPropagation())),i.addEventListener("blur",s),i.addEventListener("keydown",(e=>{"Enter"===e.key?(""!==i.value&&(a.label=a.caption=i.value),s()):"Escape"===e.key&&s()})),this.node.removeEventListener("keydown",this),i.select(),i.focus(),r.children.length>0&&r.children[0].focus()}}_evtKeyDownCapturing(e){e.eventPhase===Event.CAPTURING_PHASE&&(e.preventDefault(),e.stopPropagation(),"Escape"===e.key&&this._releaseMouse())}_evtKeyDown(e){var i,s,n;if("Tab"!==e.key&&e.eventPhase!==Event.CAPTURING_PHASE)if("Enter"===e.key||"Spacebar"===e.key||" "===e.key){const i=document.activeElement;if(this.addButtonEnabled&&this.addButtonNode.contains(i))e.preventDefault(),e.stopPropagation(),this._addRequested.emit();else{const s=t.ArrayExt.findFirstIndex(this.contentNode.children,(e=>e.contains(i)));s>=0&&(e.preventDefault(),e.stopPropagation(),this.currentIndex=s)}}else if(O.includes(e.key)){const t=[...this.contentNode.children];if(this.addButtonEnabled&&t.push(this.addButtonNode),t.length<=1)return;e.preventDefault(),e.stopPropagation();let a,r=t.indexOf(document.activeElement);-1===r&&(r=this._currentIndex),"ArrowRight"===e.key&&"horizontal"===this._orientation||"ArrowDown"===e.key&&"vertical"===this._orientation?a=null!==(i=t[r+1])&&void 0!==i?i:t[0]:"ArrowLeft"===e.key&&"horizontal"===this._orientation||"ArrowUp"===e.key&&"vertical"===this._orientation?a=null!==(s=t[r-1])&&void 0!==s?s:t[t.length-1]:"Home"===e.key?a=t[0]:"End"===e.key&&(a=t[t.length-1]),a&&(null===(n=t[r])||void 0===n||n.setAttribute("tabindex","-1"),null==a||a.setAttribute("tabindex","0"),a.focus())}}_evtPointerDown(e){if(0!==e.button&&1!==e.button)return;if(this._dragData)return;if(e.target.classList.contains("lm-TabBar-tabInput"))return;let i=this.addButtonEnabled&&this.addButtonNode.contains(e.target),n=this.contentNode.children,a=t.ArrayExt.findFirstIndex(n,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1===a&&!i)return;if(e.preventDefault(),e.stopPropagation(),this._dragData={tab:n[a],index:a,pressX:e.clientX,pressY:e.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},this.document.addEventListener("pointerup",this,!0),1===e.button||i)return;let r=n[a].querySelector(this.renderer.closeIconSelector);r&&r.contains(e.target)||(this.tabsMovable&&(this.document.addEventListener("pointermove",this,!0),this.document.addEventListener("keydown",this,!0),this.document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===a?this.currentIndex=-1:this.currentIndex=a,-1!==this.currentIndex&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}_evtPointerMove(e){let t=this._dragData;if(!t)return;e.preventDefault(),e.stopPropagation();let i=this.contentNode.children;if(t.dragActive||V.dragExceeded(t,e)){if(!t.dragActive){let e=t.tab.getBoundingClientRect();"horizontal"===this._orientation?(t.tabPos=t.tab.offsetLeft,t.tabSize=e.width,t.tabPressPos=t.pressX-e.left):(t.tabPos=t.tab.offsetTop,t.tabSize=e.height,t.tabPressPos=t.pressY-e.top),t.tabPressOffset={x:t.pressX-e.left,y:t.pressY-e.top},t.tabLayout=V.snapTabLayout(i,this._orientation),t.contentRect=this.contentNode.getBoundingClientRect(),t.override=o.Drag.overrideCursor("default"),t.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),t.dragActive=!0}if(!t.detachRequested&&V.detachExceeded(t,e)){t.detachRequested=!0;let s=t.index,n=e.clientX,a=e.clientY,r=i[s],o=this._titles[s];if(this._tabDetachRequested.emit({index:s,title:o,tab:r,clientX:n,clientY:a,offset:t.tabPressOffset}),t.dragAborted)return}V.layoutTabs(i,t,e,this._orientation)}}_evtPointerUp(e){if(0!==e.button&&1!==e.button)return;const i=this._dragData;if(!i)return;if(e.preventDefault(),e.stopPropagation(),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),!i.dragActive){if(this._dragData=null,this.addButtonEnabled&&this.addButtonNode.contains(e.target))return void this._addRequested.emit(void 0);let n=this.contentNode.children,a=t.ArrayExt.findFirstIndex(n,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(a!==i.index)return;let r=this._titles[a];if(!r.closable)return;if(1===e.button)return void this._tabCloseRequested.emit({index:a,title:r});let o=n[a].querySelector(this.renderer.closeIconSelector);return o&&o.contains(e.target)?void this._tabCloseRequested.emit({index:a,title:r}):void 0}if(0!==e.button)return;V.finalizeTabPosition(i,this._orientation),i.tab.classList.remove("lm-mod-dragging");let a=V.parseTransitionDuration(i.tab);setTimeout((()=>{if(i.dragAborted)return;this._dragData=null,V.resetTabPositions(this.contentNode.children,this._orientation),i.override.dispose(),this.removeClass("lm-mod-dragging");let e=i.index,s=i.targetIndex;-1!==s&&e!==s&&(t.ArrayExt.move(this._titles,e,s),this._adjustCurrentForMove(e,s),this._tabMoved.emit({fromIndex:e,toIndex:s,title:this._titles[s]}),n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest))}),a)}_releaseMouse(){let e=this._dragData;e&&(this._dragData=null,this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),e.dragAborted=!0,e.dragActive&&(V.resetTabPositions(this.contentNode.children,this._orientation),e.override.dispose(),e.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging")))}_adjustCurrentForInsert(e,t){let i=this.currentTitle,s=this._currentIndex,n=this.insertBehavior;if("select-tab"===n||"select-tab-if-needed"===n&&-1===s)return this._currentIndex=e,this._previousTitle=i,void this._currentChanged.emit({previousIndex:s,previousTitle:i,currentIndex:e,currentTitle:t});s>=e&&this._currentIndex++}_adjustCurrentForMove(e,t){this._currentIndex===e?this._currentIndex=t:this._currentIndex=t?this._currentIndex++:this._currentIndex>e&&this._currentIndex<=t&&this._currentIndex--}_adjustCurrentForRemove(e,t){let i=this._currentIndex,s=this.removeBehavior;if(i===e){if(0===this._titles.length)return this._currentIndex=-1,void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null});if("select-tab-after"===s)return this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-tab-before"===s)return this._currentIndex=Math.max(0,e-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-previous-tab"===s)return this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});this._currentIndex=-1,this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}else i>e&&this._currentIndex--}_onTitleChanged(e){this.update()}}var V,U,Y,X,K,G,j,J;!function(e){class t{constructor(){this.closeIconSelector=".lm-TabBar-tabCloseIcon",this._tabID=0,this._tabKeys=new WeakMap,this._uuid=++t._nInstance}renderTab(e){let t=e.title.caption,i=this.createTabKey(e),s=i,n=this.createTabStyle(e),a=this.createTabClass(e),r=this.createTabDataset(e),o=this.createTabARIA(e);return e.title.closable?d.h.li({id:s,key:i,className:a,title:t,style:n,dataset:r,...o},this.renderIcon(e),this.renderLabel(e),this.renderCloseIcon(e)):d.h.li({id:s,key:i,className:a,title:t,style:n,dataset:r,...o},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){const{title:t}=e;let i=this.createIconClass(e);return d.h.div({className:i},t.icon,t.iconLabel)}renderLabel(e){return d.h.div({className:"lm-TabBar-tabLabel"},e.title.label)}renderCloseIcon(e){return d.h.div({className:"lm-TabBar-tabCloseIcon"})}createTabKey(e){let t=this._tabKeys.get(e.title);return void 0===t&&(t=`tab-key-${this._uuid}-${this._tabID++}`,this._tabKeys.set(e.title,t)),t}createTabStyle(e){return{zIndex:`${e.zIndex}`}}createTabClass(e){let t="lm-TabBar-tab";return e.title.className&&(t+=` ${e.title.className}`),e.title.closable&&(t+=" lm-mod-closable"),e.current&&(t+=" lm-mod-current"),t}createTabDataset(e){return e.title.dataset}createTabARIA(e){var t;return{role:"tab","aria-selected":e.current.toString(),tabindex:`${null!==(t=e.tabIndex)&&void 0!==t?t:"-1"}`}}createIconClass(e){let t="lm-TabBar-tabIcon",i=e.title.iconClass;return i?`${t} ${i}`:t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t,e.addButtonSelector=".lm-TabBar-addButton"}($||($={})),function(e){e.DRAG_THRESHOLD=5,e.DETACH_THRESHOLD=20,e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");t.setAttribute("role","tablist"),t.className="lm-TabBar-content",e.appendChild(t);let i=document.createElement("div");return i.className="lm-TabBar-addButton lm-mod-hidden",i.setAttribute("tabindex","-1"),i.setAttribute("role","button"),e.appendChild(i),e},e.asTitle=function(e){return e instanceof f?e:new f(e)},e.parseTransitionDuration=function(e){let t=window.getComputedStyle(e);return 1e3*(parseFloat(t.transitionDuration)||0)},e.snapTabLayout=function(e,t){let i=new Array(e.length);for(let s=0,n=e.length;s=e.DRAG_THRESHOLD||n>=e.DRAG_THRESHOLD},e.detachExceeded=function(t,i){let s=t.contentRect;return i.clientX=s.right+e.DETACH_THRESHOLD||i.clientY=s.bottom+e.DETACH_THRESHOLD},e.layoutTabs=function(e,t,i,s){let n,a,r,o;"horizontal"===s?(n=t.pressX,a=i.clientX-t.contentRect.left,r=i.clientX,o=t.contentRect.width):(n=t.pressY,a=i.clientY-t.contentRect.top,r=i.clientY,o=t.contentRect.height);let h=t.index,d=a-t.tabPressPos,l=d+t.tabSize;for(let i=0,a=e.length;i>1);if(it.index&&l>u)a=-t.tabSize-c.margin+"px",h=Math.max(h,i);else if(i===t.index){let e=r-n,i=o-(t.tabPos+t.tabSize);a=`${Math.max(-t.tabPos,Math.min(e,i))}px`}else a="";"horizontal"===s?e[i].style.left=a:e[i].style.top=a}t.targetIndex=h},e.finalizeTabPosition=function(e,t){let i,s;if(i="horizontal"===t?e.contentRect.width:e.contentRect.height,e.targetIndex===e.index)s=0;else if(e.targetIndex>e.index){let t=e.tabLayout[e.targetIndex];s=t.pos+t.size-e.tabSize-e.tabPos}else{s=e.tabLayout[e.targetIndex].pos-e.tabPos}let n=i-(e.tabPos+e.tabSize),a=Math.max(-e.tabPos,Math.min(s,n));"horizontal"===t?e.tab.style.left=`${a}px`:e.tab.style.top=`${a}px`},e.resetTabPositions=function(e,t){for(const i of e)"horizontal"===t?i.style.left="":i.style.top=""}}(V||(V={}));class Q extends v{constructor(e){super(),this._spacing=4,this._dirty=!1,this._root=null,this._box=null,this._items=new Map,this.renderer=e.renderer,void 0!==e.spacing&&(this._spacing=D.clampDimension(e.spacing)),this._document=e.document||document,this._hiddenMode=void 0!==e.hiddenMode?e.hiddenMode:b.HiddenMode.Display}dispose(){let e=this[Symbol.iterator]();this._items.forEach((e=>{e.dispose()})),this._box=null,this._root=null,this._items.clear();for(const t of e)t.dispose();super.dispose()}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){if(this._hiddenMode!==e){this._hiddenMode=e;for(const e of this.tabBars())if(e.titles.length>1)for(const t of e.titles)t.owner.hiddenMode=this._hiddenMode}}get spacing(){return this._spacing}set spacing(e){e=D.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get isEmpty(){return null===this._root}[Symbol.iterator](){return this._root?this._root.iterAllWidgets():t.empty()}widgets(){return this._root?this._root.iterUserWidgets():t.empty()}selectedWidgets(){return this._root?this._root.iterSelectedWidgets():t.empty()}tabBars(){return this._root?this._root.iterTabBars():t.empty()}handles(){return this._root?this._root.iterHandles():t.empty()}moveHandle(t,i,s){let n=t.classList.contains("lm-mod-hidden");if(!this._root||n)return;let a,r=this._root.findSplitNode(t);r&&(a="horizontal"===r.node.orientation?i-t.offsetLeft:s-t.offsetTop,0!==a&&(r.node.holdSizes(),e.BoxEngine.adjust(r.node.sizers,r.index,a),this.parent&&this.parent.update()))}saveLayout(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}}restoreLayout(e){let t,i=new Set;t=e.main?U.normalizeAreaConfig(e.main,i):null;let s=this.widgets(),n=this.tabBars(),a=this.handles();this._root=null;for(const e of s)i.has(e)||(e.parent=null);for(const e of n)e.dispose();for(const e of a)e.parentNode&&e.parentNode.removeChild(e);for(const e of i)e.parent=this.parent;this._root=t?U.realizeAreaConfig(t,{createTabBar:e=>this._createTabBar(),createHandle:()=>this._createHandle()},this._document):null,this.parent&&(i.forEach((e=>{this.attachWidget(e)})),this.parent.fit())}addWidget(e,t={}){let i=t.ref||null,s=t.mode||"tab-after",n=null;if(this._root&&i&&(n=this._root.findTabNode(i)),i&&!n)throw new Error("Reference widget is not in the layout.");switch(e.parent=this.parent,s){case"tab-after":this._insertTab(e,i,n,!0);break;case"tab-before":this._insertTab(e,i,n,!1);break;case"split-top":this._insertSplit(e,i,n,"vertical",!1);break;case"split-left":this._insertSplit(e,i,n,"horizontal",!1);break;case"split-right":this._insertSplit(e,i,n,"horizontal",!0);break;case"split-bottom":this._insertSplit(e,i,n,"vertical",!0);break;case"merge-top":this._insertSplit(e,i,n,"vertical",!1,!0);break;case"merge-left":this._insertSplit(e,i,n,"horizontal",!1,!0);break;case"merge-right":this._insertSplit(e,i,n,"horizontal",!0,!0);break;case"merge-bottom":this._insertSplit(e,i,n,"vertical",!0,!0)}this.parent&&(this.attachWidget(e),this.parent.fit())}removeWidget(e){this._removeWidget(e),this.parent&&(this.detachWidget(e),this.parent.fit())}hitTestTabAreas(e,t){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let i=this.parent.node.getBoundingClientRect(),n=e-i.left-this._box.borderLeft,a=t-i.top-this._box.borderTop,r=this._root.hitTestTabNodes(n,a);if(!r)return null;let{tabBar:o,top:h,left:d,width:l,height:c}=r,u=this._box.borderLeft+this._box.borderRight,m=this._box.borderTop+this._box.borderBottom;return{tabBar:o,x:n,y:a,top:h,left:d,right:i.width-u-(d+l),bottom:i.height-m-(h+c),width:l,height:c}}init(){super.init();for(const e of this)this.attachWidget(e);for(const e of this.handles())this.parent.node.appendChild(e);this.parent.fit()}attachWidget(e){this.parent.node!==e.node.parentNode&&(this._items.set(e,new x(e)),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterAttach))}detachWidget(e){if(this.parent.node!==e.node.parentNode)return;this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterDetach);let t=this._items.get(e);t&&(this._items.delete(e),t.dispose())}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_removeWidget(e){if(!this._root)return;let i=this._root.findTabNode(e);if(!i)return;if(U.removeAria(e),i.tabBar.titles.length>1){if(i.tabBar.removeTab(e.title),this._hiddenMode===b.HiddenMode.Scale&&1==i.tabBar.titles.length){i.tabBar.titles[0].owner.hiddenMode=b.HiddenMode.Display}return}if(i.tabBar.dispose(),this._root===i)return void(this._root=null);this._root.holdAllSizes();let s=i.parent;i.parent=null;let n=t.ArrayExt.removeFirstOf(s.children,i),a=t.ArrayExt.removeAt(s.handles,n);if(t.ArrayExt.removeAt(s.sizers,n),a.parentNode&&a.parentNode.removeChild(a),s.children.length>1)return void s.syncHandles();let r=s.parent;s.parent=null;let o=s.children[0],h=s.handles[0];if(s.children.length=0,s.handles.length=0,s.sizers.length=0,h.parentNode&&h.parentNode.removeChild(h),this._root===s)return o.parent=null,void(this._root=o);let d=r,l=d.children.indexOf(s);if(o instanceof U.TabLayoutNode)return o.parent=d,void(d.children[l]=o);let c=t.ArrayExt.removeAt(d.handles,l);t.ArrayExt.removeAt(d.children,l),t.ArrayExt.removeAt(d.sizers,l),c.parentNode&&c.parentNode.removeChild(c);for(let e=0,i=o.children.length;e=i.length)&&(s=0);return{type:"tab-area",widgets:i,currentIndex:s}}(e,t):function(e,t){let i=e.orientation,n=[],a=[];for(let r=0,o=e.children.length;r{let h=n(r,t,s),d=i(e.sizes[o]),l=t.createHandle();a.children.push(h),a.handles.push(l),a.sizers.push(d),h.parent=a})),a.syncHandles(),a.normalizeSizes(),a}(e,s,o),h}t.GOLDEN_RATIO=.618,t.createSizer=i,t.normalizeAreaConfig=s,t.realizeAreaConfig=n;class a{constructor(e){this.parent=null,this._top=0,this._left=0,this._width=0,this._height=0;let t=new u,i=new u;t.stretch=0,i.stretch=1,this.tabBar=e,this.sizers=[t,i]}get top(){return this._top}get left(){return this._left}get width(){return this._width}get height(){return this._height}*iterAllWidgets(){yield this.tabBar,yield*this.iterUserWidgets()}*iterUserWidgets(){for(const e of this.tabBar.titles)yield e.owner}*iterSelectedWidgets(){let e=this.tabBar.currentTitle;e&&(yield e.owner)}*iterTabBars(){yield this.tabBar}*iterHandles(){}findTabNode(e){return-1!==this.tabBar.titles.indexOf(e.title)?this:null}findSplitNode(e){return null}findFirstTabNode(){return this}hitTestTabNodes(e,t){return e=this._left+this._width||t=this._top+this._height?null:this}createConfig(){return{type:"tab-area",widgets:this.tabBar.titles.map((e=>e.owner)),currentIndex:this.tabBar.currentIndex}}holdAllSizes(){}fit(e,t){let i=0,s=0,n=t.get(this.tabBar),a=this.tabBar.currentTitle,r=a?t.get(a.owner):void 0,[o,h]=this.sizers;return n&&n.fit(),r&&r.fit(),n&&!n.isHidden?(i=Math.max(i,n.minWidth),s+=n.minHeight,o.minSize=n.minHeight,o.maxSize=n.maxHeight):(o.minSize=0,o.maxSize=0),r&&!r.isHidden?(i=Math.max(i,r.minWidth),s+=r.minHeight,h.minSize=r.minHeight,h.maxSize=1/0):(h.minSize=0,h.maxSize=1/0),{minWidth:i,minHeight:s,maxWidth:Infinity,maxHeight:Infinity}}update(t,i,s,n,a,r){this._top=i,this._left=t,this._width=s,this._height=n;let o=r.get(this.tabBar),h=this.tabBar.currentTitle,d=h?r.get(h.owner):void 0;if(e.BoxEngine.calc(this.sizers,n),o&&!o.isHidden){let e=this.sizers[0].size;o.update(t,i,s,e),i+=e}if(d&&!d.isHidden){let e=this.sizers[1].size;d.update(t,i,s,e)}}}t.TabLayoutNode=a;class r{constructor(e){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=e}*iterAllWidgets(){for(const e of this.children)yield*e.iterAllWidgets()}*iterUserWidgets(){for(const e of this.children)yield*e.iterUserWidgets()}*iterSelectedWidgets(){for(const e of this.children)yield*e.iterSelectedWidgets()}*iterTabBars(){for(const e of this.children)yield*e.iterTabBars()}*iterHandles(){yield*this.handles;for(const e of this.children)yield*e.iterHandles()}findTabNode(e){for(let t=0,i=this.children.length;te.createConfig())),sizes:t}}syncHandles(){this.handles.forEach(((e,t)=>{e.setAttribute("data-orientation",this.orientation),t===this.handles.length-1?e.classList.add("lm-mod-hidden"):e.classList.remove("lm-mod-hidden")}))}holdSizes(){for(const e of this.sizers)e.sizeHint=e.size}holdAllSizes(){for(const e of this.children)e.holdAllSizes();this.holdSizes()}normalizeSizes(){let e=this.sizers.length;if(0===e)return;this.holdSizes();let t=this.sizers.reduce(((e,t)=>e+t.sizeHint),0);if(0===t)for(const t of this.sizers)t.size=t.sizeHint=1/e;else for(const e of this.sizers)e.size=e.sizeHint/=t;this.normalized=!0}createNormalizedSizes(){let e=this.sizers.length;if(0===e)return[];let t=this.sizers.map((e=>e.size)),i=t.reduce(((e,t)=>e+t),0);if(0===i)for(let i=t.length-1;i>-1;i--)t[i]=1/e;else for(let e=t.length-1;e>-1;e--)t[e]/=i;return t}fit(e,t){let i="horizontal"===this.orientation,s=Math.max(0,this.children.length-1)*e,n=i?s:0,a=i?0:s;for(let s=0,r=this.children.length;sthis._createTabBar(),createHandle:()=>this._createHandle()};this.layout=new Q({document:this._document,renderer:t,spacing:e.spacing,hiddenMode:e.hiddenMode}),this.overlay=e.overlay||new Z.Overlay,this.node.appendChild(this.overlay.node)}dispose(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),super.dispose()}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(e){this.layout.hiddenMode=e}get layoutModified(){return this._layoutModified}get addRequested(){return this._addRequested}get renderer(){return this.layout.renderer}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get mode(){return this._mode}set mode(e){if(this._mode===e)return;this._mode=e,this.dataset.mode=e;let t=this.layout;switch(e){case"multiple-document":for(const e of t.tabBars())e.show();break;case"single-document":t.restoreLayout(Y.createSingleDocumentConfig(this));break;default:throw"unreachable"}n.MessageLoop.postMessage(this,Y.LayoutModified)}get tabsMovable(){return this._tabsMovable}set tabsMovable(e){this._tabsMovable=e;for(const t of this.tabBars())t.tabsMovable=e}get tabsConstrained(){return this._tabsConstrained}set tabsConstrained(e){this._tabsConstrained=e}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled=e;for(const t of this.tabBars())t.addButtonEnabled=e}get isEmpty(){return this.layout.isEmpty}*widgets(){yield*this.layout.widgets()}*selectedWidgets(){yield*this.layout.selectedWidgets()}*tabBars(){yield*this.layout.tabBars()}*handles(){yield*this.layout.handles()}selectWidget(e){let i=t.find(this.tabBars(),(t=>-1!==t.titles.indexOf(e.title)));if(!i)throw new Error("Widget is not contained in the dock panel.");i.currentTitle=e.title}activateWidget(e){this.selectWidget(e),e.activate()}saveLayout(){return this.layout.saveLayout()}restoreLayout(e){this._mode="multiple-document",this.layout.restoreLayout(e),(s.Platform.IS_EDGE||s.Platform.IS_IE)&&n.MessageLoop.flush(),n.MessageLoop.postMessage(this,Y.LayoutModified)}addWidget(e,t={}){"single-document"===this._mode?this.layout.addWidget(e):this.layout.addWidget(e,t),n.MessageLoop.postMessage(this,Y.LayoutModified)}processMessage(e){"layout-modified"===e.type?this._layoutModified.emit(void 0):super.processMessage(e)}handleEvent(e){switch(e.type){case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e);break;case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){Y.isGeneratedTabBarProperty.get(e.child)||e.child.addClass("lm-DockPanel-widget")}onChildRemoved(e){Y.isGeneratedTabBarProperty.get(e.child)||(e.child.removeClass("lm-DockPanel-widget"),n.MessageLoop.postMessage(this,Y.LayoutModified))}_evtDragEnter(e){e.mimeData.hasData("application/vnd.lumino.widget-factory")&&(e.preventDefault(),e.stopPropagation())}_evtDragLeave(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||(e.stopPropagation(),this.overlay.hide(1))}_evtDragOver(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||"invalid"===this._showOverlay(e.clientX,e.clientY)?e.dropAction="none":(e.stopPropagation(),e.dropAction=e.proposedAction)}_evtDrop(e){if(e.preventDefault(),this.overlay.hide(0),"none"===e.proposedAction)return void(e.dropAction="none");let{clientX:t,clientY:i}=e,{zone:s,target:n}=Y.findDropTarget(this,t,i,this._edges);if(this._tabsConstrained&&e.source!==this||"invalid"===s)return void(e.dropAction="none");let a=e.mimeData.getData("application/vnd.lumino.widget-factory");if("function"!=typeof a)return void(e.dropAction="none");let r=a();if(!(r instanceof b))return void(e.dropAction="none");if(r.contains(this))return void(e.dropAction="none");let o=n?Y.getDropRef(n.tabBar):null;switch(s){case"root-all":this.addWidget(r);break;case"root-top":this.addWidget(r,{mode:"split-top"});break;case"root-left":this.addWidget(r,{mode:"split-left"});break;case"root-right":this.addWidget(r,{mode:"split-right"});break;case"root-bottom":this.addWidget(r,{mode:"split-bottom"});break;case"widget-all":case"widget-tab":this.addWidget(r,{mode:"tab-after",ref:o});break;case"widget-top":this.addWidget(r,{mode:"split-top",ref:o});break;case"widget-left":this.addWidget(r,{mode:"split-left",ref:o});break;case"widget-right":this.addWidget(r,{mode:"split-right",ref:o});break;case"widget-bottom":this.addWidget(r,{mode:"split-bottom",ref:o});break;default:throw"unreachable"}e.dropAction=e.proposedAction,e.stopPropagation(),this.activateWidget(r)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation(),27===e.keyCode&&(this._releaseMouse(),n.MessageLoop.postMessage(this,Y.LayoutModified))}_evtPointerDown(e){if(0!==e.button)return;let i=this.layout,s=e.target,n=t.find(i.handles(),(e=>e.contains(s)));if(!n)return;e.preventDefault(),e.stopPropagation(),this._document.addEventListener("keydown",this,!0),this._document.addEventListener("pointerup",this,!0),this._document.addEventListener("pointermove",this,!0),this._document.addEventListener("contextmenu",this,!0);let a=n.getBoundingClientRect(),r=e.clientX-a.left,h=e.clientY-a.top,d=window.getComputedStyle(n),l=o.Drag.overrideCursor(d.cursor,this._document);this._pressData={handle:n,deltaX:r,deltaY:h,override:l}}_evtPointerMove(e){if(!this._pressData)return;e.preventDefault(),e.stopPropagation();let t=this.node.getBoundingClientRect(),i=e.clientX-t.left-this._pressData.deltaX,s=e.clientY-t.top-this._pressData.deltaY;this.layout.moveHandle(this._pressData.handle,i,s)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse(),n.MessageLoop.postMessage(this,Y.LayoutModified))}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._document.removeEventListener("keydown",this,!0),this._document.removeEventListener("pointerup",this,!0),this._document.removeEventListener("pointermove",this,!0),this._document.removeEventListener("contextmenu",this,!0))}_showOverlay(e,t){let i,n,a,r,{zone:o,target:h}=Y.findDropTarget(this,e,t,this._edges);if("invalid"===o)return this.overlay.hide(100),o;let d=s.ElementExt.boxSizing(this.node),l=this.node.getBoundingClientRect();switch(o){case"root-all":i=d.paddingTop,n=d.paddingLeft,a=d.paddingRight,r=d.paddingBottom;break;case"root-top":i=d.paddingTop,n=d.paddingLeft,a=d.paddingRight,r=l.height*Y.GOLDEN_RATIO;break;case"root-left":i=d.paddingTop,n=d.paddingLeft,a=l.width*Y.GOLDEN_RATIO,r=d.paddingBottom;break;case"root-right":i=d.paddingTop,n=l.width*Y.GOLDEN_RATIO,a=d.paddingRight,r=d.paddingBottom;break;case"root-bottom":i=l.height*Y.GOLDEN_RATIO,n=d.paddingLeft,a=d.paddingRight,r=d.paddingBottom;break;case"widget-all":i=h.top,n=h.left,a=h.right,r=h.bottom;break;case"widget-top":i=h.top,n=h.left,a=h.right,r=h.bottom+h.height/2;break;case"widget-left":i=h.top,n=h.left,a=h.right+h.width/2,r=h.bottom;break;case"widget-right":i=h.top,n=h.left+h.width/2,a=h.right,r=h.bottom;break;case"widget-bottom":i=h.top+h.height/2,n=h.left,a=h.right,r=h.bottom;break;case"widget-tab":{const e=h.tabBar.node.getBoundingClientRect().height;i=h.top,n=h.left,a=h.right,r=h.bottom+h.height-e;break}default:throw"unreachable"}return this.overlay.show({top:i,left:n,right:a,bottom:r}),o}_createTabBar(){let e=this._renderer.createTabBar(this._document);return Y.isGeneratedTabBarProperty.set(e,!0),"single-document"===this._mode&&e.hide(),e.tabsMovable=this._tabsMovable,e.allowDeselect=!1,e.addButtonEnabled=this._addButtonEnabled,e.removeBehavior="select-previous-tab",e.insertBehavior="select-tab-if-needed",e.tabMoved.connect(this._onTabMoved,this),e.currentChanged.connect(this._onCurrentChanged,this),e.tabCloseRequested.connect(this._onTabCloseRequested,this),e.tabDetachRequested.connect(this._onTabDetachRequested,this),e.tabActivateRequested.connect(this._onTabActivateRequested,this),e.addRequested.connect(this._onTabAddRequested,this),e}_createHandle(){return this._renderer.createHandle()}_onTabMoved(){n.MessageLoop.postMessage(this,Y.LayoutModified)}_onCurrentChanged(e,t){let{previousTitle:i,currentTitle:a}=t;i&&i.owner.hide(),a&&a.owner.show(),(s.Platform.IS_EDGE||s.Platform.IS_IE)&&n.MessageLoop.flush(),n.MessageLoop.postMessage(this,Y.LayoutModified)}_onTabAddRequested(e){this._addRequested.emit(e)}_onTabActivateRequested(e,t){t.title.owner.activate()}_onTabCloseRequested(e,t){t.title.owner.close()}_onTabDetachRequested(e,t){if(this._drag)return;e.releaseMouse();let{title:s,tab:n,clientX:a,clientY:r,offset:h}=t,d=new i.MimeData;d.setData("application/vnd.lumino.widget-factory",(()=>s.owner));let l=n.cloneNode(!0);h&&(l.style.top=`-${h.y}px`,l.style.left=`-${h.x}px`),this._drag=new o.Drag({document:this._document,mimeData:d,dragImage:l,proposedAction:"move",supportedActions:"move",source:this}),n.classList.add("lm-mod-hidden");this._drag.start(a,r).then((()=>{this._drag=null,n.classList.remove("lm-mod-hidden")}))}}!function(e){e.Overlay=class{constructor(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.style.position="absolute",this.node.style.contain="strict"}show(e){let t=this.node.style;t.top=`${e.top}px`,t.left=`${e.left}px`,t.right=`${e.right}px`,t.bottom=`${e.bottom}px`,clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"))}hide(e){if(!this._hidden)return e<=0?(clearTimeout(this._timer),this._timer=-1,this._hidden=!0,void this.node.classList.add("lm-mod-hidden")):void(-1===this._timer&&(this._timer=window.setTimeout((()=>{this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden")}),e)))}};class t{createTabBar(e){let t=new $({document:e});return t.addClass("lm-DockPanel-tabBar"),t}createHandle(){let e=document.createElement("div");return e.className="lm-DockPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t}(Z||(Z={})),function(e){e.GOLDEN_RATIO=.618,e.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},e.LayoutModified=new n.ConflatableMessage("layout-modified"),e.isGeneratedTabBarProperty=new a.AttachedProperty({name:"isGeneratedTabBar",create:()=>!1}),e.createSingleDocumentConfig=function(e){if(e.isEmpty)return{main:null};let t=Array.from(e.widgets()),i=e.selectedWidgets().next().value,s=i?t.indexOf(i):-1;return{main:{type:"tab-area",widgets:t,currentIndex:s}}},e.findDropTarget=function(e,t,i,n){if(!s.ElementExt.hitTest(e.node,t,i))return{zone:"invalid",target:null};let a=e.layout;if(a.isEmpty)return{zone:"root-all",target:null};if("multiple-document"===e.mode){let s=e.node.getBoundingClientRect(),a=t-s.left+1,r=i-s.top+1,o=s.right-t,h=s.bottom-i;switch(Math.min(r,o,h,a)){case r:if(ru&&d>u&&h>m&&l>m)return{zone:"widget-all",target:r};switch(o/=u,h/=m,d/=u,l/=m,Math.min(o,h,d,l)){case o:c="widget-left";break;case h:c="widget-top";break;case d:c="widget-right";break;case l:c="widget-bottom";break;default:throw"unreachable"}return{zone:c,target:r}},e.getDropRef=function(e){return 0===e.titles.length?null:e.currentTitle?e.currentTitle.owner:e.titles[e.titles.length-1].owner}}(Y||(Y={}));class ee extends v{constructor(e={}){super(e),this._dirty=!1,this._rowSpacing=4,this._columnSpacing=4,this._items=[],this._rowStarts=[],this._columnStarts=[],this._rowSizers=[new u],this._columnSizers=[new u],this._box=null,void 0!==e.rowCount&&X.reallocSizers(this._rowSizers,e.rowCount),void 0!==e.columnCount&&X.reallocSizers(this._columnSizers,e.columnCount),void 0!==e.rowSpacing&&(this._rowSpacing=X.clampValue(e.rowSpacing)),void 0!==e.columnSpacing&&(this._columnSpacing=X.clampValue(e.columnSpacing))}dispose(){for(const e of this._items){let t=e.widget;e.dispose(),t.dispose()}this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,super.dispose()}get rowCount(){return this._rowSizers.length}set rowCount(e){e!==this.rowCount&&(X.reallocSizers(this._rowSizers,e),this.parent&&this.parent.fit())}get columnCount(){return this._columnSizers.length}set columnCount(e){e!==this.columnCount&&(X.reallocSizers(this._columnSizers,e),this.parent&&this.parent.fit())}get rowSpacing(){return this._rowSpacing}set rowSpacing(e){e=X.clampValue(e),this._rowSpacing!==e&&(this._rowSpacing=e,this.parent&&this.parent.fit())}get columnSpacing(){return this._columnSpacing}set columnSpacing(e){e=X.clampValue(e),this._columnSpacing!==e&&(this._columnSpacing=e,this.parent&&this.parent.fit())}rowStretch(e){let t=this._rowSizers[e];return t?t.stretch:-1}setRowStretch(e,t){let i=this._rowSizers[e];i&&(t=X.clampValue(t),i.stretch!==t&&(i.stretch=t,this.parent&&this.parent.update()))}columnStretch(e){let t=this._columnSizers[e];return t?t.stretch:-1}setColumnStretch(e,t){let i=this._columnSizers[e];i&&(t=X.clampValue(t),i.stretch!==t&&(i.stretch=t,this.parent&&this.parent.update()))}*[Symbol.iterator](){for(const e of this._items)yield e.widget}addWidget(e){-1===t.ArrayExt.findFirstIndex(this._items,(t=>t.widget===e))&&(this._items.push(new x(e)),this.parent&&this.attachWidget(e))}removeWidget(e){let i=t.ArrayExt.findFirstIndex(this._items,(t=>t.widget===e));if(-1===i)return;let s=t.ArrayExt.removeAt(this._items,i);this.parent&&this.detachWidget(e),s.dispose()}init(){super.init();for(const e of this)this.attachWidget(e)}attachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterAttach),this.parent.fit()}detachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterDetach),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){for(let e=0,t=this.rowCount;e!e.isHidden));for(let t=0,i=e.length;t({row:0,column:0,rowSpan:1,columnSpan:1}),changed:function(e){e.parent&&e.parent.layout instanceof ee&&e.parent.fit()}}),e.normalizeConfig=function(e){return{row:Math.max(0,Math.floor(e.row||0)),column:Math.max(0,Math.floor(e.column||0)),rowSpan:Math.max(1,Math.floor(e.rowSpan||0)),columnSpan:Math.max(1,Math.floor(e.columnSpan||0))}},e.clampValue=function(e){return Math.max(0,Math.floor(e))},e.rowSpanCmp=function(t,i){let s=e.cellConfigProperty.get(t.widget),n=e.cellConfigProperty.get(i.widget);return s.rowSpan-n.rowSpan},e.columnSpanCmp=function(t,i){let s=e.cellConfigProperty.get(t.widget),n=e.cellConfigProperty.get(i.widget);return s.columnSpan-n.columnSpan},e.reallocSizers=function(e,t){for(t=Math.max(1,Math.floor(t));e.lengtht&&(e.length=t)},e.distributeMin=function(e,t,i,s){if(i=s)return;let a=(s-n)/(i-t+1);for(let s=t;s<=i;++s)e[s].minSize+=a}}(X||(X={}));class te extends b{constructor(e={}){super({node:K.createNode()}),this._activeIndex=-1,this._tabFocusIndex=0,this._menus=[],this._childMenu=null,this._overflowMenu=null,this._menuItemSizes=[],this._overflowIndex=-1,this.addClass("lm-MenuBar"),this.setFlag(b.Flag.DisallowLayout),this.renderer=e.renderer||te.defaultRenderer,this._forceItemsPosition=e.forceItemsPosition||{forceX:!0,forceY:!0},this._overflowMenuOptions=e.overflowMenuOptions||{isVisible:!0}}dispose(){this._closeChildMenu(),this._menus.length=0,super.dispose()}get childMenu(){return this._childMenu}get overflowIndex(){return this._overflowIndex}get overflowMenu(){return this._overflowMenu}get contentNode(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]}get activeMenu(){return this._menus[this._activeIndex]||null}set activeMenu(e){this.activeIndex=e?this._menus.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._menus.length)&&(e=-1),e>-1&&0===this._menus[e].items.length&&(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this.update())}get menus(){return this._menus}openActiveMenu(){-1!==this._activeIndex&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))}addMenu(e,t=!0){this.insertMenu(this._menus.length,e,t)}insertMenu(e,i,s=!0){this._closeChildMenu();let n=this._menus.indexOf(i),a=Math.max(0,Math.min(e,this._menus.length));if(-1===n)return t.ArrayExt.insert(this._menus,a,i),i.addClass("lm-MenuBar-menu"),i.aboutToClose.connect(this._onMenuAboutToClose,this),i.menuRequested.connect(this._onMenuMenuRequested,this),i.title.changed.connect(this._onTitleChanged,this),void(s&&this.update());a===this._menus.length&&a--,n!==a&&(t.ArrayExt.move(this._menus,n,a),s&&this.update())}removeMenu(e,t=!0){this.removeMenuAt(this._menus.indexOf(e),t)}removeMenuAt(e,i=!0){this._closeChildMenu();let s=t.ArrayExt.removeAt(this._menus,e);s&&(s.aboutToClose.disconnect(this._onMenuAboutToClose,this),s.menuRequested.disconnect(this._onMenuMenuRequested,this),s.title.changed.disconnect(this._onTitleChanged,this),s.removeClass("lm-MenuBar-menu"),i&&this.update())}clearMenus(){if(0!==this._menus.length){this._closeChildMenu();for(let e of this._menus)e.aboutToClose.disconnect(this._onMenuAboutToClose,this),e.menuRequested.disconnect(this._onMenuMenuRequested,this),e.title.changed.disconnect(this._onTitleChanged,this),e.removeClass("lm-MenuBar-menu");this._menus.length=0,this.update()}}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"mousedown":this._evtMouseDown(e);break;case"mousemove":this._evtMouseMove(e);break;case"focusout":this._evtFocusOut(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("keydown",this),this.node.addEventListener("mousedown",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("focusout",this),this.node.addEventListener("contextmenu",this)}onAfterDetach(e){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mousedown",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("focusout",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()}onActivateRequest(e){this.isAttached&&this._focusItemAt(0)}onResize(e){this.update(),super.onResize(e)}onUpdateRequest(e){var t;let i=this._menus,s=this.renderer,n=this._activeIndex,a=this._tabFocusIndex>=0&&this._tabFocusIndex-1?this._overflowIndex:i.length,o=0,l=!1;r=null!==this._overflowMenu?r-1:r;let c=new Array(r);for(let e=0;e{this._tabFocusIndex=e,this.activeIndex=e}}),o+=this._menuItemSizes[e],i[e].title.label===this._overflowMenuOptions.title&&(l=!0,r--);if(this._overflowMenuOptions.isVisible)if(this._overflowIndex>-1&&!l){if(null===this._overflowMenu){const e=null!==(t=this._overflowMenuOptions.title)&&void 0!==t?t:"...";this._overflowMenu=new F({commands:new h.CommandRegistry}),this._overflowMenu.title.label=e,this._overflowMenu.title.mnemonic=0,this.addMenu(this._overflowMenu,!1)}for(let e=i.length-2;e>=r;e--){const t=this.menus[e];t.title.mnemonic=0,this._overflowMenu.insertItem(0,{type:"submenu",submenu:t}),this.removeMenu(t,!1)}c[r]=s.renderItem({title:this._overflowMenu.title,active:r===n&&0!==i[r].items.length,tabbable:r===a,disabled:0===i[r].items.length,onfocus:()=>{this._tabFocusIndex=r,this.activeIndex=r}}),r++}else if(null!==this._overflowMenu){let e=this._overflowMenu.items,t=this.node.offsetWidth,n=this._overflowMenu.items.length;for(let h=0;hthis._menuItemSizes[n]){let t=e[0].submenu;this._overflowMenu.removeItemAt(0),this.insertMenu(r,t,!1),c[r]=s.renderItem({title:t.title,active:!1,tabbable:r===a,disabled:0===i[r].items.length,onfocus:()=>{this._tabFocusIndex=r,this.activeIndex=r}}),r++}}0===this._overflowMenu.items.length&&(this.removeMenu(this._overflowMenu,!1),c.pop(),this._overflowMenu=null,this._overflowIndex=-1)}d.VirtualDOM.render(c,this.contentNode),this._updateOverflowIndex()}_updateOverflowIndex(){if(!this._overflowMenuOptions.isVisible)return;const e=this.contentNode.childNodes;let t=this.node.offsetWidth,i=0,s=-1,n=e.length;if(0==this._menuItemSizes.length)for(let a=0;at&&-1===s&&(s=a)}else for(let e=0;et){s=e;break}this._overflowIndex=s}_evtKeyDown(e){let t=e.keyCode;if(9===t)return void(this.activeIndex=-1);if(e.preventDefault(),e.stopPropagation(),13===t||32===t||38===t||40===t){if(this.activeIndex=this._tabFocusIndex,this.activeIndex!==this._tabFocusIndex)return;return void this.openActiveMenu()}if(27===t)return this._closeChildMenu(),void this._focusItemAt(this.activeIndex);if(37===t||39===t){let e=37===t?-1:1,i=this._tabFocusIndex+e,s=this._menus.length;for(let t=0;ts.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1!==i){if(0===e.button)if(this._childMenu)this._closeChildMenu(),this.activeIndex=i;else{e.preventDefault();const t=this._positionForMenu(i);F.saveWindowData(),this.activeIndex=i,this._openChildMenu(t)}}else this._closeChildMenu()}_evtMouseMove(e){let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(i===this._activeIndex)return;if(-1===i&&this._childMenu)return;const n=i>=0&&this._childMenu?this._positionForMenu(i):null;F.saveWindowData(),this.activeIndex=i,n&&this._openChildMenu(n)}_positionForMenu(e){let t=this.contentNode.children[e],{left:i,bottom:s}=t.getBoundingClientRect();return{top:s,left:i}}_evtFocusOut(e){this._childMenu||this.node.contains(e.relatedTarget)||(this.activeIndex=-1)}_focusItemAt(e){const t=this.contentNode.childNodes[e];t&&t.focus()}_openChildMenu(e={}){let t=this.activeMenu;if(!t)return void this._closeChildMenu();let i=this._childMenu;if(i===t)return;this._childMenu=t,i?i.close():document.addEventListener("mousedown",this,!0),this._tabFocusIndex=this.activeIndex,n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest);let{left:s,top:a}=e;void 0!==s&&void 0!==a||({left:s,top:a}=this._positionForMenu(this._activeIndex)),i||this.addClass("lm-mod-active"),t.items.length>0&&t.open(s,a,this._forceItemsPosition)}_closeChildMenu(){if(!this._childMenu)return;this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0);let e=this._childMenu;this._childMenu=null,e.close(),this.activeIndex=-1}_onMenuAboutToClose(e){e===this._childMenu&&(this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0),this._childMenu=null,this.activeIndex=-1)}_onMenuMenuRequested(e,t){if(e!==this._childMenu)return;let i=this._activeIndex,s=this._menus.length;switch(t){case"next":this.activeIndex=i===s-1?0:i+1;break;case"previous":this.activeIndex=0===i?s-1:i-1}this.openActiveMenu()}_onTitleChanged(){this.update()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),i=this.createItemDataset(e),s=this.createItemARIA(e);return d.h.li({className:t,dataset:i,...e.disabled?{}:{tabindex:e.tabbable?"0":"-1"},onfocus:e.onfocus,...s},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){let t=this.createIconClass(e);return d.h.div({className:t},e.title.icon,e.title.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return d.h.div({className:"lm-MenuBar-itemLabel"},t)}createItemClass(e){let t="lm-MenuBar-item";return e.title.className&&(t+=` ${e.title.className}`),e.active&&!e.disabled&&(t+=" lm-mod-active"),t}createItemDataset(e){return e.title.dataset}createItemARIA(e){return{role:"menuitem","aria-haspopup":"true","aria-disabled":e.disabled?"true":"false"}}createIconClass(e){let t="lm-MenuBar-itemIcon",i=e.title.iconClass;return i?`${t} ${i}`:t}formatLabel(e){let{label:t,mnemonic:i}=e.title;if(i<0||i>=t.length)return t;let s=t.slice(0,i),n=t.slice(i+1),a=t[i];return[s,d.h.span({className:"lm-MenuBar-itemMnemonic"},a),n]}}e.Renderer=t,e.defaultRenderer=new t}(te||(te={})),function(e){e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-MenuBar-content",e.appendChild(t),t.setAttribute("role","menubar"),e},e.findMnemonic=function(e,t,i){let s=-1,n=-1,a=!1,r=t.toUpperCase();for(let t=0,o=e.length;t=0&&l1&&this.widgets.forEach((e=>{e.hiddenMode=this._hiddenMode})))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,super.dispose()}attachWidget(e,i){this._hiddenMode===b.HiddenMode.Scale&&this._items.length>0?(1===this._items.length&&(this.widgets[0].hiddenMode=b.HiddenMode.Scale),i.hiddenMode=b.HiddenMode.Scale):i.hiddenMode=b.HiddenMode.Display,t.ArrayExt.insert(this._items,e,new x(i)),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),this.parent.update()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e);this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.widget.node.style.zIndex="",this._hiddenMode===b.HiddenMode.Scale&&(i.hiddenMode=b.HiddenMode.Display,1===this._items.length&&(this._items[0].widget.hiddenMode=b.HiddenMode.Display)),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0,t=0;for(let i=0,s=this._items.length;i{t.ArrayExt.removeFirstOf(this._items,i)}))}open(e){if(F.saveWindowData(),this.menu.clearItems(),0===this._items.length)return!1;let t=T.matchItems(this._items,e,this._groupByTarget,this._sortBySelector);if(!t||0===t.length)return!1;for(const e of t)this.menu.addItem(e);return this.menu.open(e.clientX,e.clientY),!0}},e.DockLayout=Q,e.DockPanel=Z,e.FocusTracker=class{constructor(){this._counter=0,this._widgets=[],this._activeWidget=null,this._currentWidget=null,this._numbers=new Map,this._nodes=new Map,this._activeChanged=new r.Signal(this),this._currentChanged=new r.Signal(this)}dispose(){if(!(this._counter<0)){this._counter=-1,r.Signal.clearData(this);for(const e of this._widgets)e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0);this._activeWidget=null,this._currentWidget=null,this._nodes.clear(),this._numbers.clear(),this._widgets.length=0}}get currentChanged(){return this._currentChanged}get activeChanged(){return this._activeChanged}get isDisposed(){return this._counter<0}get currentWidget(){return this._currentWidget}get activeWidget(){return this._activeWidget}get widgets(){return this._widgets}focusNumber(e){let t=this._numbers.get(e);return void 0===t?-1:t}has(e){return this._numbers.has(e)}add(e){if(this._numbers.has(e))return;let t=e.node.contains(document.activeElement),i=t?this._counter++:-1;this._widgets.push(e),this._numbers.set(e,i),this._nodes.set(e.node,e),e.node.addEventListener("focus",this,!0),e.node.addEventListener("blur",this,!0),e.disposed.connect(this._onWidgetDisposed,this),t&&this._setWidgets(e,e)}remove(e){if(!this._numbers.has(e))return;if(e.disposed.disconnect(this._onWidgetDisposed,this),e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0),t.ArrayExt.removeFirstOf(this._widgets,e),this._nodes.delete(e.node),this._numbers.delete(e),this._currentWidget!==e)return;let i=this._widgets.filter((e=>-1!==this._numbers.get(e))),s=t.max(i,((e,t)=>this._numbers.get(e)-this._numbers.get(t)))||null;this._setWidgets(s,null)}handleEvent(e){switch(e.type){case"focus":this._evtFocus(e);break;case"blur":this._evtBlur(e)}}_setWidgets(e,t){let i=this._currentWidget;this._currentWidget=e;let s=this._activeWidget;this._activeWidget=t,i!==e&&this._currentChanged.emit({oldValue:i,newValue:e}),s!==t&&this._activeChanged.emit({oldValue:s,newValue:t})}_evtFocus(e){let t=this._nodes.get(e.currentTarget);t!==this._currentWidget&&this._numbers.set(t,this._counter++),this._setWidgets(t,t)}_evtBlur(e){let i=this._nodes.get(e.currentTarget),s=e.relatedTarget;s&&(i.node.contains(s)||t.find(this._widgets,(e=>e.node.contains(s))))||this._setWidgets(this._currentWidget,null)}_onWidgetDisposed(e){this.remove(e)}},e.GridLayout=ee,e.Layout=v,e.LayoutItem=x,e.Menu=F,e.MenuBar=te,e.Panel=R,e.PanelLayout=M,e.ScrollBar=class extends b{constructor(e={}){super({node:G.createNode()}),this._onRepeat=()=>{if(this._repeatTimer=-1,!this._pressData)return;let e=this._pressData.part;if("thumb"===e)return;this._repeatTimer=window.setTimeout(this._onRepeat,20);let t=this._pressData.mouseX,i=this._pressData.mouseY;if("decrement"!==e)if("increment"!==e){if("track"===e){if(!s.ElementExt.hitTest(this.trackNode,t,i))return;let e=this.thumbNode;if(s.ElementExt.hitTest(e,t,i))return;let n,a=e.getBoundingClientRect();return n="horizontal"===this._orientation?t0&&(r+=i.stretch,o++)}if(t===a)return 0;if(t<=s){for(let t=0;t=n){for(let t=0;t0&&s>h;){let t=s,n=r;for(let a=0;a0&&s>h;){let t=s/d;for(let n=0;n0&&s>h;){let t=s,n=r;for(let a=0;a=i.maxSize?(s-=i.maxSize-i.size,r-=i.stretch,i.size=i.maxSize,i.done=!0,d--,o--):(s-=h,i.size+=h)}}for(;d>0&&s>h;){let t=s/d;for(let n=0;n=i.maxSize?(s-=i.maxSize-i.size,i.size=i.maxSize,i.done=!0,d--):(s-=t,i.size+=t))}}}return 0},m.adjust=function(e,t,i){0!==e.length&&0!==i&&(i>0?function(e,t,i){let s=0;for(let i=0;i<=t;++i){let t=e[i];s+=t.maxSize-t.size}let n=0;for(let i=t+1,s=e.length;i=0&&a>0;--i){let t=e[i],s=t.maxSize-t.size;s>=a?(t.sizeHint=t.size+a,a=0):(t.sizeHint=t.size+s,a-=s)}let r=i;for(let i=t+1,s=e.length;i0;++i){let t=e[i],s=t.size-t.minSize;s>=r?(t.sizeHint=t.size-r,r=0):(t.sizeHint=t.size-s,r-=s)}}(e,t,i):function(e,t,i){let s=0;for(let i=t+1,n=e.length;i0;++i){let t=e[i],s=t.maxSize-t.size;s>=a?(t.sizeHint=t.size+a,a=0):(t.sizeHint=t.size+s,a-=s)}let r=i;for(let i=t;i>=0&&r>0;--i){let t=e[i],s=t.size-t.minSize;s>=r?(t.sizeHint=t.size-r,r=0):(t.sizeHint=t.size-s,r-=s)}}(e,t,-i))};class f{constructor(e){this._label="",this._caption="",this._mnemonic=-1,this._icon=void 0,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new r.Signal(this),this._isDisposed=!1,this.owner=e.owner,void 0!==e.label&&(this._label=e.label),void 0!==e.mnemonic&&(this._mnemonic=e.mnemonic),void 0!==e.icon&&(this._icon=e.icon),void 0!==e.iconClass&&(this._iconClass=e.iconClass),void 0!==e.iconLabel&&(this._iconLabel=e.iconLabel),void 0!==e.caption&&(this._caption=e.caption),void 0!==e.className&&(this._className=e.className),void 0!==e.closable&&(this._closable=e.closable),this._dataset=e.dataset||{}}get changed(){return this._changed}get label(){return this._label}set label(e){this._label!==e&&(this._label=e,this._changed.emit(void 0))}get mnemonic(){return this._mnemonic}set mnemonic(e){this._mnemonic!==e&&(this._mnemonic=e,this._changed.emit(void 0))}get icon(){return this._icon}set icon(e){this._icon!==e&&(this._icon=e,this._changed.emit(void 0))}get iconClass(){return this._iconClass}set iconClass(e){this._iconClass!==e&&(this._iconClass=e,this._changed.emit(void 0))}get iconLabel(){return this._iconLabel}set iconLabel(e){this._iconLabel!==e&&(this._iconLabel=e,this._changed.emit(void 0))}get caption(){return this._caption}set caption(e){this._caption!==e&&(this._caption=e,this._changed.emit(void 0))}get className(){return this._className}set className(e){this._className!==e&&(this._className=e,this._changed.emit(void 0))}get closable(){return this._closable}set closable(e){this._closable!==e&&(this._closable=e,this._changed.emit(void 0))}get dataset(){return this._dataset}set dataset(e){this._dataset!==e&&(this._dataset=e,this._changed.emit(void 0))}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,r.Signal.clearData(this))}}class b{constructor(e={}){this._flags=0,this._layout=null,this._parent=null,this._disposed=new r.Signal(this),this._hiddenMode=b.HiddenMode.Display,this.node=g.createNode(e),this.addClass("lm-Widget")}dispose(){this.isDisposed||(this.setFlag(b.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&b.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),this.title.dispose(),r.Signal.clearData(this),n.MessageLoop.clearData(this),a.AttachedProperty.clearData(this))}get disposed(){return this._disposed}get isDisposed(){return this.testFlag(b.Flag.IsDisposed)}get isAttached(){return this.testFlag(b.Flag.IsAttached)}get isHidden(){return this.testFlag(b.Flag.IsHidden)}get isVisible(){return this.testFlag(b.Flag.IsVisible)}get title(){return g.titleProperty.get(this)}get id(){return this.node.id}set id(e){this.node.id=e}get dataset(){return this.node.dataset}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){this._hiddenMode!==e&&(this.isHidden&&this._toggleHidden(!1),e==b.HiddenMode.Scale?this.node.style.willChange="transform":this.node.style.willChange="auto",this._hiddenMode=e,this.isHidden&&this._toggleHidden(!0))}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(e&&this.contains(e))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){let e=new b.ChildMessage("child-removed",this);n.MessageLoop.sendMessage(this._parent,e)}if(this._parent=e,this._parent&&!this._parent.isDisposed){let e=new b.ChildMessage("child-added",this);n.MessageLoop.sendMessage(this._parent,e)}this.isDisposed||n.MessageLoop.sendMessage(this,b.Msg.ParentChanged)}}get layout(){return this._layout}set layout(e){if(this._layout!==e){if(this.testFlag(b.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(e.parent)throw new Error("Cannot change layout parent.");this._layout=e,e.parent=this}}*children(){this._layout&&(yield*this._layout)}contains(e){for(let t=e;t;t=t._parent)if(t===this)return!0;return!1}hasClass(e){return this.node.classList.contains(e)}addClass(e){this.node.classList.add(e)}removeClass(e){this.node.classList.remove(e)}toggleClass(e,t){return!0===t?(this.node.classList.add(e),!0):!1===t?(this.node.classList.remove(e),!1):this.node.classList.toggle(e)}update(){n.MessageLoop.postMessage(this,b.Msg.UpdateRequest)}fit(){n.MessageLoop.postMessage(this,b.Msg.FitRequest)}activate(){n.MessageLoop.postMessage(this,b.Msg.ActivateRequest)}close(){n.MessageLoop.sendMessage(this,b.Msg.CloseRequest)}show(){if(this.testFlag(b.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.BeforeShow),this.clearFlag(b.Flag.IsHidden),this._toggleHidden(!1),!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.AfterShow),this.parent)){let e=new b.ChildMessage("child-shown",this);n.MessageLoop.sendMessage(this.parent,e)}}hide(){if(!this.testFlag(b.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.BeforeHide),this.setFlag(b.Flag.IsHidden),this._toggleHidden(!0),!this.isAttached||this.parent&&!this.parent.isVisible||n.MessageLoop.sendMessage(this,b.Msg.AfterHide),this.parent)){let e=new b.ChildMessage("child-hidden",this);n.MessageLoop.sendMessage(this.parent,e)}}setHidden(e){e?this.hide():this.show()}testFlag(e){return 0!=(this._flags&e)}setFlag(e){this._flags|=e}clearFlag(e){this._flags&=~e}processMessage(e){switch(e.type){case"resize":this.notifyLayout(e),this.onResize(e);break;case"update-request":this.notifyLayout(e),this.onUpdateRequest(e);break;case"fit-request":this.notifyLayout(e),this.onFitRequest(e);break;case"before-show":this.notifyLayout(e),this.onBeforeShow(e);break;case"after-show":this.setFlag(b.Flag.IsVisible),this.notifyLayout(e),this.onAfterShow(e);break;case"before-hide":this.notifyLayout(e),this.onBeforeHide(e);break;case"after-hide":this.clearFlag(b.Flag.IsVisible),this.notifyLayout(e),this.onAfterHide(e);break;case"before-attach":this.notifyLayout(e),this.onBeforeAttach(e);break;case"after-attach":this.isHidden||this.parent&&!this.parent.isVisible||this.setFlag(b.Flag.IsVisible),this.setFlag(b.Flag.IsAttached),this.notifyLayout(e),this.onAfterAttach(e);break;case"before-detach":this.notifyLayout(e),this.onBeforeDetach(e);break;case"after-detach":this.clearFlag(b.Flag.IsVisible),this.clearFlag(b.Flag.IsAttached),this.notifyLayout(e),this.onAfterDetach(e);break;case"activate-request":this.notifyLayout(e),this.onActivateRequest(e);break;case"close-request":this.notifyLayout(e),this.onCloseRequest(e);break;case"child-added":this.notifyLayout(e),this.onChildAdded(e);break;case"child-removed":this.notifyLayout(e),this.onChildRemoved(e);break;default:this.notifyLayout(e)}}notifyLayout(e){this._layout&&this._layout.processParentMessage(e)}onCloseRequest(e){this.parent?this.parent=null:this.isAttached&&b.detach(this)}onResize(e){}onUpdateRequest(e){}onFitRequest(e){}onActivateRequest(e){}onBeforeShow(e){}onAfterShow(e){}onBeforeHide(e){}onAfterHide(e){}onBeforeAttach(e){}onAfterAttach(e){}onBeforeDetach(e){}onAfterDetach(e){}onChildAdded(e){}onChildRemoved(e){}_toggleHidden(e){if(e)switch(this._hiddenMode){case b.HiddenMode.Display:this.addClass("lm-mod-hidden");break;case b.HiddenMode.Scale:this.node.style.transform="scale(0)",this.node.setAttribute("aria-hidden","true");break;case b.HiddenMode.ContentVisibility:this.node.style.contentVisibility="hidden",this.node.style.zIndex="-1"}else switch(this._hiddenMode){case b.HiddenMode.Display:this.removeClass("lm-mod-hidden");break;case b.HiddenMode.Scale:this.node.style.transform="",this.node.removeAttribute("aria-hidden");break;case b.HiddenMode.ContentVisibility:this.node.style.contentVisibility="",this.node.style.zIndex=""}}}!function(e){var t,i,s;(t=e.HiddenMode||(e.HiddenMode={}))[t.Display=0]="Display",t[t.Scale=1]="Scale",t[t.ContentVisibility=2]="ContentVisibility",(i=e.Flag||(e.Flag={}))[i.IsDisposed=1]="IsDisposed",i[i.IsAttached=2]="IsAttached",i[i.IsHidden=4]="IsHidden",i[i.IsVisible=8]="IsVisible",i[i.DisallowLayout=16]="DisallowLayout",(s=e.Msg||(e.Msg={})).BeforeShow=new n.Message("before-show"),s.AfterShow=new n.Message("after-show"),s.BeforeHide=new n.Message("before-hide"),s.AfterHide=new n.Message("after-hide"),s.BeforeAttach=new n.Message("before-attach"),s.AfterAttach=new n.Message("after-attach"),s.BeforeDetach=new n.Message("before-detach"),s.AfterDetach=new n.Message("after-detach"),s.ParentChanged=new n.Message("parent-changed"),s.UpdateRequest=new n.ConflatableMessage("update-request"),s.FitRequest=new n.ConflatableMessage("fit-request"),s.ActivateRequest=new n.ConflatableMessage("activate-request"),s.CloseRequest=new n.ConflatableMessage("close-request");class a extends n.Message{constructor(e,t){super(e),this.child=t}}e.ChildMessage=a;class r extends n.Message{constructor(e,t){super("resize"),this.width=e,this.height=t}}e.ResizeMessage=r,function(e){e.UnknownSize=new e(-1,-1)}(r=e.ResizeMessage||(e.ResizeMessage={})),e.attach=function(t,i,s=null){if(t.parent)throw new Error("Cannot attach a child widget.");if(t.isAttached||t.node.isConnected)throw new Error("Widget is already attached.");if(!i.isConnected)throw new Error("Host is not attached.");n.MessageLoop.sendMessage(t,e.Msg.BeforeAttach),i.insertBefore(t.node,s),n.MessageLoop.sendMessage(t,e.Msg.AfterAttach)},e.detach=function(t){if(t.parent)throw new Error("Cannot detach a child widget.");if(!t.isAttached||!t.node.isConnected)throw new Error("Widget is not attached.");n.MessageLoop.sendMessage(t,e.Msg.BeforeDetach),t.node.parentNode.removeChild(t.node),n.MessageLoop.sendMessage(t,e.Msg.AfterDetach)}}(b||(b={})),function(e){e.titleProperty=new a.AttachedProperty({name:"title",create:e=>new f({owner:e})}),e.createNode=function(e){return e.node||document.createElement(e.tag||"div")}}(g||(g={}));class v{constructor(e={}){this._disposed=!1,this._parent=null,this._fitPolicy=e.fitPolicy||"set-min-size"}dispose(){this._parent=null,this._disposed=!0,r.Signal.clearData(this),a.AttachedProperty.clearData(this)}get isDisposed(){return this._disposed}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(this._parent)throw new Error("Cannot change parent widget.");if(e.layout!==this)throw new Error("Invalid parent widget.");this._parent=e,this.init()}}get fitPolicy(){return this._fitPolicy}set fitPolicy(e){if(this._fitPolicy!==e&&(this._fitPolicy=e,this._parent)){let e=this._parent.node.style;e.minWidth="",e.minHeight="",e.maxWidth="",e.maxHeight="",this._parent.fit()}}processParentMessage(e){switch(e.type){case"resize":this.onResize(e);break;case"update-request":this.onUpdateRequest(e);break;case"fit-request":this.onFitRequest(e);break;case"before-show":this.onBeforeShow(e);break;case"after-show":this.onAfterShow(e);break;case"before-hide":this.onBeforeHide(e);break;case"after-hide":this.onAfterHide(e);break;case"before-attach":this.onBeforeAttach(e);break;case"after-attach":this.onAfterAttach(e);break;case"before-detach":this.onBeforeDetach(e);break;case"after-detach":this.onAfterDetach(e);break;case"child-removed":this.onChildRemoved(e);break;case"child-shown":this.onChildShown(e);break;case"child-hidden":this.onChildHidden(e)}}init(){for(const e of this)e.parent=this.parent}onResize(e){for(const e of this)n.MessageLoop.sendMessage(e,b.ResizeMessage.UnknownSize)}onUpdateRequest(e){for(const e of this)n.MessageLoop.sendMessage(e,b.ResizeMessage.UnknownSize)}onBeforeAttach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onAfterAttach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onBeforeDetach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onAfterDetach(e){for(const t of this)n.MessageLoop.sendMessage(t,e)}onBeforeShow(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onAfterShow(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onBeforeHide(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onAfterHide(e){for(const t of this)t.isHidden||n.MessageLoop.sendMessage(t,e)}onChildRemoved(e){this.removeWidget(e.child)}onFitRequest(e){}onChildShown(e){}onChildHidden(e){}}!function(e){e.getHorizontalAlignment=function(e){return p.horizontalAlignmentProperty.get(e)},e.setHorizontalAlignment=function(e,t){p.horizontalAlignmentProperty.set(e,t)},e.getVerticalAlignment=function(e){return p.verticalAlignmentProperty.get(e)},e.setVerticalAlignment=function(e,t){p.verticalAlignmentProperty.set(e,t)}}(v||(v={}));class x{constructor(e){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=e,this.widget.node.style.position="absolute",this.widget.node.style.contain="strict"}dispose(){if(this._disposed)return;this._disposed=!0;let e=this.widget.node.style;e.position="",e.top="",e.left="",e.width="",e.height="",e.contain=""}get minWidth(){return this._minWidth}get minHeight(){return this._minHeight}get maxWidth(){return this._maxWidth}get maxHeight(){return this._maxHeight}get isDisposed(){return this._disposed}get isHidden(){return this.widget.isHidden}get isVisible(){return this.widget.isVisible}get isAttached(){return this.widget.isAttached}fit(){let e=s.ElementExt.sizeLimits(this.widget.node);this._minWidth=e.minWidth,this._minHeight=e.minHeight,this._maxWidth=e.maxWidth,this._maxHeight=e.maxHeight}update(e,t,i,s){let a=Math.max(this._minWidth,Math.min(i,this._maxWidth)),r=Math.max(this._minHeight,Math.min(s,this._maxHeight));if(a"center",changed:t}),e.verticalAlignmentProperty=new a.AttachedProperty({name:"verticalAlignment",create:()=>"top",changed:t})}(p||(p={}));class M extends v{constructor(){super(...arguments),this._widgets=[]}dispose(){for(;this._widgets.length>0;)this._widgets.pop().dispose();super.dispose()}get widgets(){return this._widgets}*[Symbol.iterator](){yield*this._widgets}addWidget(e){this.insertWidget(this._widgets.length,e)}insertWidget(e,i){i.parent=this.parent;let s=this._widgets.indexOf(i),n=Math.max(0,Math.min(e,this._widgets.length));if(-1===s)return t.ArrayExt.insert(this._widgets,n,i),void(this.parent&&this.attachWidget(n,i));n===this._widgets.length&&n--,s!==n&&(t.ArrayExt.move(this._widgets,s,n),this.parent&&this.moveWidget(s,n,i))}removeWidget(e){this.removeWidgetAt(this._widgets.indexOf(e))}removeWidgetAt(e){let i=t.ArrayExt.removeAt(this._widgets,e);i&&this.parent&&this.detachWidget(e,i)}init(){super.init();let e=0;for(const t of this)this.attachWidget(e++,t)}attachWidget(e,t){let i=this.parent.node.children[e];this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.BeforeAttach),this.parent.node.insertBefore(t.node,i),this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.AfterAttach)}moveWidget(e,t,i){this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach);let s=this.parent.node.children[t];this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.insertBefore(i.node,s),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach)}detachWidget(e,t){this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&n.MessageLoop.sendMessage(t,b.Msg.AfterDetach)}}!function(e){e.clampDimension=function(e){return Math.max(0,Math.floor(e))}}(_||(_={}));var y,w,A,E,C,S,I,z,L,T,D=_;class B extends M{constructor(e){super(),this.widgetOffset=0,this._fixed=0,this._spacing=4,this._dirty=!1,this._hasNormedSizes=!1,this._sizers=[],this._items=[],this._handles=[],this._box=null,this._alignment="start",this._orientation="horizontal",this.renderer=e.renderer,void 0!==e.orientation&&(this._orientation=e.orientation),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=_.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,super.dispose()}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._orientation=e,this.parent&&(this.parent.dataset.orientation=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=_.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get handles(){return this._handles}absoluteSizes(){return this._sizers.map((e=>e.size))}relativeSizes(){return y.normalize(this._sizers.map((e=>e.size)))}setRelativeSizes(e,t=!0){let i=this._sizers.length,s=e.slice(0,i);for(;s.length0&&(e.sizeHint=e.size);e.BoxEngine.adjust(this._sizers,t,s),this.parent&&this.parent.update()}}init(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,i){let s=new x(i),a=y.createHandle(this.renderer),r=y.averageSize(this._sizers),o=y.createSizer(r);t.ArrayExt.insert(this._items,e,s),t.ArrayExt.insert(this._sizers,e,o),t.ArrayExt.insert(this._handles,e,a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.node.appendChild(a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),t.ArrayExt.move(this._sizers,e,i),t.ArrayExt.move(this._handles,e,i),this.parent.fit()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e),a=t.ArrayExt.removeAt(this._handles,e);t.ArrayExt.removeAt(this._sizers,e),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.node.removeChild(a),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}updateItemPosition(e,t,i,s,n,a,r){const o=this._items[e];if(o.isHidden)return;let h=this._handles[e].style;t?(i+=this.widgetOffset,o.update(i,s,r,n),i+=r,h.top=`${s}px`,h.left=`${i}px`,h.width=`${this._spacing}px`,h.height=`${n}px`):(s+=this.widgetOffset,o.update(i,s,a,r),s+=r,h.top=`${s}px`,h.left=`${i}px`,h.width=`${a}px`,h.height=`${this._spacing}px`)}_fit(){let e=0,t=-1;for(let i=0,s=this._items.length;i0&&(s.sizeHint=s.size),t.isHidden?(s.minSize=0,s.maxSize=0):(t.fit(),s.stretch=B.getStretch(t.widget),i?(s.minSize=t.minWidth,s.maxSize=t.maxWidth,a+=t.minWidth,r=Math.max(r,t.minHeight)):(s.minSize=t.minHeight,s.maxSize=t.maxHeight,r+=t.minHeight,a=Math.max(a,t.minWidth)))}let o=this._box=s.ElementExt.boxSizing(this.parent.node);a+=o.horizontalSum,r+=o.verticalSum;let h=this.parent.node.style;h.minWidth=`${a}px`,h.minHeight=`${r}px`,this._dirty=!0,this.parent.parent&&n.MessageLoop.sendMessage(this.parent.parent,b.Msg.FitRequest),this._dirty&&n.MessageLoop.sendMessage(this.parent,b.Msg.UpdateRequest)}_update(t,i){this._dirty=!1;let n=0;for(let e=0,t=this._items.length;e0){let t;if(t=c?Math.max(0,o-this._fixed):Math.max(0,h-this._fixed),this._hasNormedSizes){for(let e of this._sizers)e.sizeHint*=t;this._hasNormedSizes=!1}let i=e.BoxEngine.calc(this._sizers,t);if(i>0)switch(this._alignment){case"start":break;case"center":d=0,l=i/2;break;case"end":d=0,l=i;break;case"justify":d=i/n,l=0;break;default:throw"unreachable"}}for(let e=0,t=this._items.length;e0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:function(e){e.parent&&e.parent.layout instanceof B&&e.parent.fit()}}),e.createSizer=function(e){let t=new u;return t.sizeHint=Math.floor(e),t},e.createHandle=function(e){let t=e.createHandle();return t.style.position="absolute",t.style.contain="style",t},e.averageSize=function(e){return e.reduce(((e,t)=>e+t.size),0)/e.length||0},e.normalize=function(e){let t=e.length;if(0===t)return[];let i=e.reduce(((e,t)=>e+Math.abs(t)),0);return 0===i?e.map((e=>1/t)):e.map((e=>e/i))}}(y||(y={}));class k extends B{constructor(e){super({...e,orientation:e.orientation||"vertical"}),this._titles=[],this.titleSpace=e.titleSpace||22}get titleSpace(){return this.widgetOffset}set titleSpace(e){e=D.clampDimension(e),this.widgetOffset!==e&&(this.widgetOffset=e,this.parent&&this.parent.fit())}get titles(){return this._titles}dispose(){this.isDisposed||(this._titles.length=0,super.dispose())}updateTitle(e,t){const i=this._titles[e],s=i.classList.contains("lm-mod-expanded"),n=w.createTitle(this.renderer,t.title,s);this._titles[e]=n,this.parent.node.replaceChild(n,i)}insertWidget(e,t){t.id||(t.id=`id-${i.UUID.uuid4()}`),super.insertWidget(e,t)}attachWidget(e,i){const s=w.createTitle(this.renderer,i.title);t.ArrayExt.insert(this._titles,e,s),this.parent.node.appendChild(s),i.node.setAttribute("role","region"),i.node.setAttribute("aria-labelledby",s.id),super.attachWidget(e,i)}moveWidget(e,i,s){t.ArrayExt.move(this._titles,e,i),super.moveWidget(e,i,s)}detachWidget(e,i){const s=t.ArrayExt.removeAt(this._titles,e);this.parent.node.removeChild(s),super.detachWidget(e,i)}updateItemPosition(e,t,i,s,n,a,r){const o=this._titles[e].style;o.top=`${s}px`,o.left=`${i}px`,o.height=`${this.widgetOffset}px`,o.width=t?`${n}px`:`${a}px`,super.updateItemPosition(e,t,i,s,n,a,r)}}!function(e){e.createTitle=function(e,t,i=!0){const s=e.createSectionTitle(t);return s.style.position="absolute",s.style.contain="strict",s.setAttribute("aria-label",`${t.label} Section`),s.setAttribute("aria-expanded",i?"true":"false"),s.setAttribute("aria-controls",t.owner.id),i&&s.classList.add("lm-mod-expanded"),s}}(w||(w={}));class R extends b{constructor(e={}){super(),this.addClass("lm-Panel"),this.layout=A.createLayout(e)}get widgets(){return this.layout.widgets}addWidget(e){this.layout.addWidget(e)}insertWidget(e,t){this.layout.insertWidget(e,t)}}!function(e){e.createLayout=function(e){return e.layout||new M}}(A||(A={}));class N extends R{constructor(e={}){super({layout:E.createLayout(e)}),this._handleMoved=new r.Signal(this),this._pressData=null,this.addClass("lm-SplitPanel")}dispose(){this._releaseMouse(),super.dispose()}get orientation(){return this.layout.orientation}set orientation(e){this.layout.orientation=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get renderer(){return this.layout.renderer}get handleMoved(){return this._handleMoved}get handles(){return this.layout.handles}relativeSizes(){return this.layout.relativeSizes()}setRelativeSizes(e,t=!0){this.layout.setRelativeSizes(e,t)}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){e.child.addClass("lm-SplitPanel-child"),this._releaseMouse()}onChildRemoved(e){e.child.removeClass("lm-SplitPanel-child"),this._releaseMouse()}_evtKeyDown(e){this._pressData&&(e.preventDefault(),e.stopPropagation()),27===e.keyCode&&this._releaseMouse()}_evtPointerDown(e){if(0!==e.button)return;let i,s=this.layout,n=t.ArrayExt.findFirstIndex(s.handles,(t=>t.contains(e.target)));if(-1===n)return;e.preventDefault(),e.stopPropagation(),document.addEventListener("pointerup",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);let a=s.handles[n],r=a.getBoundingClientRect();i="horizontal"===s.orientation?e.clientX-r.left:e.clientY-r.top;let h=window.getComputedStyle(a),d=o.Drag.overrideCursor(h.cursor);this._pressData={index:n,delta:i,override:d}}_evtPointerMove(e){let t;e.preventDefault(),e.stopPropagation();let i=this.layout,s=this.node.getBoundingClientRect();t="horizontal"===i.orientation?e.clientX-s.left-this._pressData.delta:e.clientY-s.top-this._pressData.delta,i.moveHandle(this._pressData.index,t)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._handleMoved.emit(),document.removeEventListener("keydown",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("contextmenu",this,!0))}}!function(e){class t{createHandle(){let e=document.createElement("div");return e.className="lm-SplitPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t,e.getStretch=function(e){return B.getStretch(e)},e.setStretch=function(e,t){B.setStretch(e,t)}}(N||(N={})),function(e){e.createLayout=function(e){return e.layout||new B({renderer:e.renderer||N.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing})}}(E||(E={}));class H extends N{constructor(e={}){super({...e,layout:C.createLayout(e)}),this._widgetSizesCache=new WeakMap,this._expansionToggled=new r.Signal(this),this.addClass("lm-AccordionPanel")}get renderer(){return this.layout.renderer}get titleSpace(){return this.layout.titleSpace}set titleSpace(e){this.layout.titleSpace=e}get titles(){return this.layout.titles}get expansionToggled(){return this._expansionToggled}addWidget(e){super.addWidget(e),e.title.changed.connect(this._onTitleChanged,this)}collapse(e){const t=this.layout.widgets[e];t&&!t.isHidden&&this._toggleExpansion(e)}expand(e){const t=this.layout.widgets[e];t&&t.isHidden&&this._toggleExpansion(e)}insertWidget(e,t){super.insertWidget(e,t),t.title.changed.connect(this._onTitleChanged,this)}handleEvent(e){switch(super.handleEvent(e),e.type){case"click":this._evtClick(e);break;case"keydown":this._eventKeyDown(e)}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),super.onBeforeAttach(e)}onAfterDetach(e){super.onAfterDetach(e),this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this)}_onTitleChanged(e){const i=t.ArrayExt.findFirstIndex(this.widgets,(t=>t.contains(e.owner)));i>=0&&(this.layout.updateTitle(i,e.owner),this.update())}_computeWidgetSize(e){const t=this.layout,i=t.widgets[e];if(!i)return;const s=i.isHidden,n=t.absoluteSizes(),a=(s?-1:1)*this.spacing,r=n.reduce(((e,t)=>e+t));let o=[...n];if(s){const t=this._widgetSizesCache.get(i);if(!t)return;o[e]+=t;const s=o.map((e=>e-t>0)).lastIndexOf(!0);-1===s?o.forEach(((i,s)=>{s!==e&&(o[s]-=n[s]/r*(t-a))})):o[s]-=t-a}else{const t=n[e];this._widgetSizesCache.set(i,t),o[e]=0;const s=o.map((e=>e>0)).lastIndexOf(!0);if(-1===s)return;o[s]=n[s]+t+a}return o.map((e=>e/(r+a)))}_evtClick(e){const i=e.target;if(i){const s=t.ArrayExt.findFirstIndex(this.titles,(e=>e.contains(i)));s>=0&&(e.preventDefault(),e.stopPropagation(),this._toggleExpansion(s))}}_eventKeyDown(e){if(e.defaultPrevented)return;const i=e.target;let s=!1;if(i){const n=t.ArrayExt.findFirstIndex(this.titles,(e=>e.contains(i)));if(n>=0){const t=e.keyCode.toString();if(e.key.match(/Space|Enter/)||t.match(/13|32/))i.click(),s=!0;else if("horizontal"===this.orientation?e.key.match(/ArrowLeft|ArrowRight/)||t.match(/37|39/):e.key.match(/ArrowUp|ArrowDown/)||t.match(/38|40/)){const i=e.key.match(/ArrowLeft|ArrowUp/)||t.match(/37|38/)?-1:1,a=this.titles.length,r=(n+a+i)%a;this.titles[r].focus(),s=!0}else"End"===e.key||"35"===t?(this.titles[this.titles.length-1].focus(),s=!0):"Home"!==e.key&&"36"!==t||(this.titles[0].focus(),s=!0)}s&&e.preventDefault()}}_toggleExpansion(e){const t=this.titles[e],i=this.layout.widgets[e],s=this._computeWidgetSize(e);s&&this.setRelativeSizes(s,!1),i.isHidden?(t.classList.add("lm-mod-expanded"),t.setAttribute("aria-expanded","true"),i.show()):(t.classList.remove("lm-mod-expanded"),t.setAttribute("aria-expanded","false"),i.hide()),this._expansionToggled.emit(e)}}!function(e){class t extends N.Renderer{constructor(){super(),this.titleClassName="lm-AccordionPanel-title",this._titleID=0,this._titleKeys=new WeakMap,this._uuid=++t._nInstance}createCollapseIcon(e){return document.createElement("span")}createSectionTitle(e){const t=document.createElement("h3");t.setAttribute("tabindex","0"),t.id=this.createTitleKey(e),t.className=this.titleClassName;for(const i in e.dataset)t.dataset[i]=e.dataset[i];t.appendChild(this.createCollapseIcon(e)).className="lm-AccordionPanel-titleCollapser";const i=t.appendChild(document.createElement("span"));return i.className="lm-AccordionPanel-titleLabel",i.textContent=e.label,i.title=e.caption||e.label,t}createTitleKey(e){let t=this._titleKeys.get(e);return void 0===t&&(t=`title-key-${this._uuid}-${this._titleID++}`,this._titleKeys.set(e,t)),t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t}(H||(H={})),function(e){e.createLayout=function(e){return e.layout||new k({renderer:e.renderer||H.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing,titleSpace:e.titleSpace})}}(C||(C={}));class P extends M{constructor(e={}){super(),this._fixed=0,this._spacing=4,this._dirty=!1,this._sizers=[],this._items=[],this._box=null,this._alignment="start",this._direction="top-to-bottom",void 0!==e.direction&&(this._direction=e.direction),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=D.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,super.dispose()}get direction(){return this._direction}set direction(e){this._direction!==e&&(this._direction=e,this.parent&&(this.parent.dataset.direction=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=D.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}init(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,i){t.ArrayExt.insert(this._items,e,new x(i)),t.ArrayExt.insert(this._sizers,e,new u),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),t.ArrayExt.move(this._sizers,e,i),this.parent.update()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e);t.ArrayExt.removeAt(this._sizers,e),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0;for(let t=0,i=this._items.length;t0)switch(this._alignment){case"start":break;case"center":l=0,c=a/2;break;case"end":l=0,c=a;break;case"justify":l=a/n,c=0;break;default:throw"unreachable"}for(let e=0,t=this._items.length;e0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.sizeBasisProperty=new a.AttachedProperty({name:"sizeBasis",create:()=>0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.isHorizontal=function(e){return"left-to-right"===e||"right-to-left"===e},e.clampSpacing=function(e){return Math.max(0,Math.floor(e))}}(S||(S={}));class W extends R{constructor(e={}){super({layout:I.createLayout(e)}),this.addClass("lm-BoxPanel")}get direction(){return this.layout.direction}set direction(e){this.layout.direction=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}onChildAdded(e){e.child.addClass("lm-BoxPanel-child")}onChildRemoved(e){e.child.removeClass("lm-BoxPanel-child")}}!function(e){e.getStretch=function(e){return P.getStretch(e)},e.setStretch=function(e,t){P.setStretch(e,t)},e.getSizeBasis=function(e){return P.getSizeBasis(e)},e.setSizeBasis=function(e,t){P.setSizeBasis(e,t)}}(W||(W={})),function(e){e.createLayout=function(e){return e.layout||new P(e)}}(I||(I={}));class q extends b{constructor(e){super({node:z.createNode()}),this._activeIndex=-1,this._items=[],this._results=null,this.addClass("lm-CommandPalette"),this.setFlag(b.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||q.defaultRenderer,this.commands.commandChanged.connect(this._onGenericChange,this),this.commands.keyBindingChanged.connect(this._onGenericChange,this)}dispose(){this._items.length=0,this._results=null,super.dispose()}get searchNode(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]}get inputNode(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]}get contentNode(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]}get items(){return this._items}addItem(e){let t=z.createItem(this.commands,e);return this._items.push(t),this.refresh(),t}addItems(e){const t=e.map((e=>z.createItem(this.commands,e)));return t.forEach((e=>this._items.push(e))),this.refresh(),t}removeItem(e){this.removeItemAt(this._items.indexOf(e))}removeItemAt(e){t.ArrayExt.removeAt(this._items,e)&&this.refresh()}clearItems(){0!==this._items.length&&(this._items.length=0,this.refresh())}refresh(){if(this._results=null,""!==this.inputNode.value){this.node.getElementsByClassName("lm-close-icon")[0].style.display="inherit"}else{this.node.getElementsByClassName("lm-close-icon")[0].style.display="none"}this.update()}handleEvent(e){switch(e.type){case"click":this._evtClick(e);break;case"keydown":this._evtKeyDown(e);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused()}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)}onAfterDetach(e){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)}onAfterShow(e){this.update(),super.onAfterShow(e)}onActivateRequest(e){if(this.isAttached){let e=this.inputNode;e.focus(),e.select()}}onUpdateRequest(e){if(this.isHidden)return;let i=this.inputNode.value,n=this.contentNode,a=this._results;if(a||(a=this._results=z.search(this._items,i),this._activeIndex=i?t.ArrayExt.findFirstIndex(a,z.canActivate):-1),!i&&0===a.length)return void d.VirtualDOM.render(null,n);if(i&&0===a.length){let e=this.renderer.renderEmptyMessage({query:i});return void d.VirtualDOM.render(e,n)}let r=this.renderer,o=this._activeIndex,h=new Array(a.length);for(let e=0,t=a.length;e=a.length)n.scrollTop=0;else{let e=n.children[o];s.ElementExt.scrollIntoViewIfNeeded(n,e)}}_evtClick(e){if(0!==e.button)return;if(e.target.classList.contains("lm-close-icon"))return this.inputNode.value="",void this.refresh();let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>t.contains(e.target)));-1!==i&&(e.preventDefault(),e.stopPropagation(),this._execute(i))}_evtKeyDown(e){if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey))switch(e.keyCode){case 13:e.preventDefault(),e.stopPropagation(),this._execute(this._activeIndex);break;case 38:e.preventDefault(),e.stopPropagation(),this._activatePreviousItem();break;case 40:e.preventDefault(),e.stopPropagation(),this._activateNextItem()}}_activateNextItem(){if(!this._results||0===this._results.length)return;let e=this._activeIndex,i=this._results.length,s=ee-t)),l=r.slice(0,d),c=r.slice(d);for(let e=0,t=c.length;et.command===e&&i.JSONExt.deepEqual(t.args,s)))||null}}}(z||(z={}));class F extends b{constructor(e){super({node:L.createNode()}),this._childIndex=-1,this._activeIndex=-1,this._openTimerID=0,this._closeTimerID=0,this._items=[],this._childMenu=null,this._parentMenu=null,this._aboutToClose=new r.Signal(this),this._menuRequested=new r.Signal(this),this.addClass("lm-Menu"),this.setFlag(b.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||F.defaultRenderer}dispose(){this.close(),this._items.length=0,super.dispose()}get aboutToClose(){return this._aboutToClose}get menuRequested(){return this._menuRequested}get parentMenu(){return this._parentMenu}get childMenu(){return this._childMenu}get rootMenu(){let e=this;for(;e._parentMenu;)e=e._parentMenu;return e}get leafMenu(){let e=this;for(;e._childMenu;)e=e._childMenu;return e}get contentNode(){return this.node.getElementsByClassName("lm-Menu-content")[0]}get activeItem(){return this._items[this._activeIndex]||null}set activeItem(e){this.activeIndex=e?this._items.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._items.length)&&(e=-1),-1===e||L.canActivate(this._items[e])||(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())}get items(){return this._items}activateNextItem(){let e=this._items.length,i=this._activeIndex,s=i{this.activeIndex=e}})}d.VirtualDOM.render(a,this.contentNode)}onCloseRequest(e){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;let t=this._childMenu;t&&(this._childIndex=-1,this._childMenu=null,t._parentMenu=null,t.close());let i=this._parentMenu;i&&(this._parentMenu=null,i._childIndex=-1,i._childMenu=null,i.activate()),this.isAttached&&this._aboutToClose.emit(void 0),super.onCloseRequest(e)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation();let t=e.keyCode;if(13===t)return void this.triggerActiveItem();if(27===t)return void this.close();if(37===t)return void(this._parentMenu?this.close():this._menuRequested.emit("previous"));if(38===t)return void this.activatePreviousItem();if(39===t){let e=this.activeItem;return void(e&&"submenu"===e.type?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next"))}if(40===t)return void this.activateNextItem();let i=c.getKeyboardLayout().keyForKeydownEvent(e);if(!i)return;let s=this._activeIndex+1,n=L.findMnemonic(this._items,i,s);-1===n.index||n.multiple?-1!==n.index?this.activeIndex=n.index:-1!==n.auto&&(this.activeIndex=n.auto):(this.activeIndex=n.index,this.triggerActiveItem())}_evtMouseUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this.triggerActiveItem())}_evtMouseMove(e){let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(i===this._activeIndex)return;if(this.activeIndex=i,i=this.activeIndex,i===this._childIndex)return this._cancelOpenTimer(),void this._cancelCloseTimer();-1!==this._childIndex&&this._startCloseTimer(),this._cancelOpenTimer();let n=this.activeItem;n&&"submenu"===n.type&&n.submenu&&this._startOpenTimer()}_evtMouseEnter(e){for(let e=this._parentMenu;e;e=e._parentMenu)e._cancelOpenTimer(),e._cancelCloseTimer(),e.activeIndex=e._childIndex}_evtMouseLeave(e){if(this._cancelOpenTimer(),!this._childMenu)return void(this.activeIndex=-1);let{clientX:t,clientY:i}=e;s.ElementExt.hitTest(this._childMenu.node,t,i)?this._cancelCloseTimer():(this.activeIndex=-1,this._startCloseTimer())}_evtMouseDown(e){this._parentMenu||(L.hitTestMenus(this,e.clientX,e.clientY)?(e.preventDefault(),e.stopPropagation()):this.close())}_openChildMenu(e=!1){let t=this.activeItem;if(!t||"submenu"!==t.type||!t.submenu)return void this._closeChildMenu();let i=t.submenu;if(i===this._childMenu)return;F.saveWindowData(),this._closeChildMenu(),this._childMenu=i,this._childIndex=this._activeIndex,i._parentMenu=this,n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest);let s=this.contentNode.children[this._activeIndex];L.openSubmenu(i,s),e&&(i.activeIndex=-1,i.activateNextItem()),i.activate()}_closeChildMenu(){this._childMenu&&this._childMenu.close()}_startOpenTimer(){0===this._openTimerID&&(this._openTimerID=window.setTimeout((()=>{this._openTimerID=0,this._openChildMenu()}),L.TIMER_DELAY))}_startCloseTimer(){0===this._closeTimerID&&(this._closeTimerID=window.setTimeout((()=>{this._closeTimerID=0,this._closeChildMenu()}),L.TIMER_DELAY))}_cancelOpenTimer(){0!==this._openTimerID&&(clearTimeout(this._openTimerID),this._openTimerID=0)}_cancelCloseTimer(){0!==this._closeTimerID&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)}static saveWindowData(){L.saveWindowData()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),i=this.createItemDataset(e),s=this.createItemARIA(e);return d.h.li({className:t,dataset:i,tabindex:"0",onfocus:e.onfocus,...s},this.renderIcon(e),this.renderLabel(e),this.renderShortcut(e),this.renderSubmenu(e))}renderIcon(e){let t=this.createIconClass(e);return d.h.div({className:t},e.item.icon,e.item.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return d.h.div({className:"lm-Menu-itemLabel"},t)}renderShortcut(e){let t=this.formatShortcut(e);return d.h.div({className:"lm-Menu-itemShortcut"},t)}renderSubmenu(e){return d.h.div({className:"lm-Menu-itemSubmenuIcon"})}createItemClass(e){let t="lm-Menu-item";e.item.isEnabled||(t+=" lm-mod-disabled"),e.item.isToggled&&(t+=" lm-mod-toggled"),e.item.isVisible||(t+=" lm-mod-hidden"),e.active&&(t+=" lm-mod-active"),e.collapsed&&(t+=" lm-mod-collapsed");let i=e.item.className;return i&&(t+=` ${i}`),t}createItemDataset(e){let t,{type:i,command:s,dataset:n}=e.item;return t="command"===i?{...n,type:i,command:s}:{...n,type:i},t}createIconClass(e){let t="lm-Menu-itemIcon",i=e.item.iconClass;return i?`${t} ${i}`:t}createItemARIA(e){let t={};switch(e.item.type){case"separator":t.role="presentation";break;case"submenu":t["aria-haspopup"]="true",e.item.isEnabled||(t["aria-disabled"]="true");break;default:e.item.isEnabled||(t["aria-disabled"]="true"),t.role="menuitem"}return t}formatLabel(e){let{label:t,mnemonic:i}=e.item;if(i<0||i>=t.length)return t;let s=t.slice(0,i),n=t.slice(i+1),a=t[i];return[s,d.h.span({className:"lm-Menu-itemMnemonic"},a),n]}formatShortcut(e){let t=e.item.keyBinding;return t?h.CommandRegistry.formatKeystroke(t.keys):null}}e.Renderer=t,e.defaultRenderer=new t}(F||(F={})),function(e){e.TIMER_DELAY=300,e.SUBMENU_OVERLAP=3;let a=null,r=0;function o(){return r>0?(r--,a):d()}function h(e){return"separator"!==e.type&&e.isEnabled&&e.isVisible}function d(){return{pageXOffset:window.pageXOffset,pageYOffset:window.pageYOffset,clientWidth:document.documentElement.clientWidth,clientHeight:document.documentElement.clientHeight}}e.saveWindowData=function(){a=d(),r++},e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-Menu-content",e.appendChild(t),t.setAttribute("role","menu"),e.tabIndex=0,e},e.canActivate=h,e.createItem=function(e,t){return new l(e.commands,t)},e.hitTestMenus=function(e,t,i){for(let n=e;n;n=n.childMenu)if(s.ElementExt.hitTest(n.node,t,i))return!0;return!1},e.computeCollapsed=function(e){let i=new Array(e.length);t.ArrayExt.fill(i,!1);let s=0,n=e.length;for(;s=0;--a){let t=e[a];if(t.isVisible){if("separator"!==t.type)break;i[a]=!0}}let r=!1;for(;++sl+u&&(t=l+u-f),!a&&i+v>c+m&&(i>c+m?i=c+m-v:i-=v),_.transform=`translate(${Math.max(0,t)}px, ${Math.max(0,i)}px`,_.opacity="1"},e.openSubmenu=function(t,i){const a=o();let r=a.pageXOffset,h=a.pageYOffset,d=a.clientWidth,l=a.clientHeight;n.MessageLoop.sendMessage(t,b.Msg.UpdateRequest);let c=l,u=t.node,m=u.style;m.opacity="0",m.maxHeight=`${c}px`,b.attach(t,i.ownerDocument.body);let{width:g,height:p}=u.getBoundingClientRect(),_=s.ElementExt.boxSizing(t.node),f=i.getBoundingClientRect(),v=f.right-e.SUBMENU_OVERLAP;v+g>r+d&&(v=f.left+e.SUBMENU_OVERLAP-g);let x=f.top-_.borderTop-_.paddingTop;x+p>h+l&&(x=f.bottom+_.borderBottom+_.paddingBottom-p),m.transform=`translate(${Math.max(0,v)}px, ${Math.max(0,x)}px`,m.opacity="1"},e.findMnemonic=function(e,t,i){let s=-1,n=-1,a=!1,r=t.toUpperCase();for(let t=0,o=e.length;t=0&&ut.command===e&&i.JSONExt.deepEqual(t.args,s)))||null}return null}}}(L||(L={}));!function(e){function t(e,t){let i=e.rank,s=t.rank;return i!==s?i=this._titles.length)&&(e=-1),this._currentIndex===e)return;let t=this._currentIndex,i=this._titles[t]||null,s=e,n=this._titles[s]||null;this._currentIndex=s,this._previousTitle=i,this.update(),this._currentChanged.emit({previousIndex:t,previousTitle:i,currentIndex:s,currentTitle:n})}get name(){return this._name}set name(e){this._name=e,e?this.contentNode.setAttribute("aria-label",e):this.contentNode.removeAttribute("aria-label")}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._releaseMouse(),this._orientation=e,this.dataset.orientation=e,this.contentNode.setAttribute("aria-orientation",e))}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled!==e&&(this._addButtonEnabled=e,e?this.addButtonNode.classList.remove("lm-mod-hidden"):this.addButtonNode.classList.add("lm-mod-hidden"))}get titles(){return this._titles}get contentNode(){return this.node.getElementsByClassName("lm-TabBar-content")[0]}get addButtonNode(){return this.node.getElementsByClassName("lm-TabBar-addButton")[0]}addTab(e){return this.insertTab(this._titles.length,e)}insertTab(e,i){this._releaseMouse();let s=V.asTitle(i),n=this._titles.indexOf(s),a=Math.max(0,Math.min(e,this._titles.length));return-1===n?(t.ArrayExt.insert(this._titles,a,s),s.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(a,s),s):(a===this._titles.length&&a--,n===a||(t.ArrayExt.move(this._titles,n,a),this.update(),this._adjustCurrentForMove(n,a)),s)}removeTab(e){this.removeTabAt(this._titles.indexOf(e))}removeTabAt(e){this._releaseMouse();let i=t.ArrayExt.removeAt(this._titles,e);i&&(i.changed.disconnect(this._onTitleChanged,this),i===this._previousTitle&&(this._previousTitle=null),this.update(),this._adjustCurrentForRemove(e,i))}clearTabs(){if(0===this._titles.length)return;this._releaseMouse();for(let e of this._titles)e.changed.disconnect(this._onTitleChanged,this);let e=this.currentIndex,t=this.currentTitle;this._currentIndex=-1,this._previousTitle=null,this._titles.length=0,this.update(),-1!==e&&this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}releaseMouse(){this._releaseMouse()}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"dblclick":this._evtDblClick(e);break;case"keydown":e.eventPhase===Event.CAPTURING_PHASE?this._evtKeyDownCapturing(e):this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this),this.node.addEventListener("dblclick",this),this.node.addEventListener("keydown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this.node.removeEventListener("dblclick",this),this.node.removeEventListener("keydown",this),this._releaseMouse()}onUpdateRequest(e){var t;let i=this._titles,s=this.renderer,n=this.currentTitle,a=new Array(i.length);const r=null!==(t=this._getCurrentTabindex())&&void 0!==t?t:this._currentIndex>-1?this._currentIndex:0;for(let e=0,t=i.length;es.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1===n)return;let a=this.titles[n],r=i[n].querySelector(".lm-TabBar-tabLabel");if(r&&r.contains(e.target)){let e=a.label||"",t=r.innerHTML;r.innerHTML="";let i=document.createElement("input");i.classList.add("lm-TabBar-tabInput"),i.value=e,r.appendChild(i);let s=()=>{i.removeEventListener("blur",s),r.innerHTML=t,this.node.addEventListener("keydown",this)};i.addEventListener("dblclick",(e=>e.stopPropagation())),i.addEventListener("blur",s),i.addEventListener("keydown",(e=>{"Enter"===e.key?(""!==i.value&&(a.label=a.caption=i.value),s()):"Escape"===e.key&&s()})),this.node.removeEventListener("keydown",this),i.select(),i.focus(),r.children.length>0&&r.children[0].focus()}}_evtKeyDownCapturing(e){e.eventPhase===Event.CAPTURING_PHASE&&(e.preventDefault(),e.stopPropagation(),"Escape"===e.key&&this._releaseMouse())}_evtKeyDown(e){var i,s,n;if("Tab"!==e.key&&e.eventPhase!==Event.CAPTURING_PHASE)if("Enter"===e.key||"Spacebar"===e.key||" "===e.key){const i=document.activeElement;if(this.addButtonEnabled&&this.addButtonNode.contains(i))e.preventDefault(),e.stopPropagation(),this._addRequested.emit();else{const s=t.ArrayExt.findFirstIndex(this.contentNode.children,(e=>e.contains(i)));s>=0&&(e.preventDefault(),e.stopPropagation(),this.currentIndex=s)}}else if(O.includes(e.key)){const t=[...this.contentNode.children];if(this.addButtonEnabled&&t.push(this.addButtonNode),t.length<=1)return;e.preventDefault(),e.stopPropagation();let a,r=t.indexOf(document.activeElement);-1===r&&(r=this._currentIndex),"ArrowRight"===e.key&&"horizontal"===this._orientation||"ArrowDown"===e.key&&"vertical"===this._orientation?a=null!==(i=t[r+1])&&void 0!==i?i:t[0]:"ArrowLeft"===e.key&&"horizontal"===this._orientation||"ArrowUp"===e.key&&"vertical"===this._orientation?a=null!==(s=t[r-1])&&void 0!==s?s:t[t.length-1]:"Home"===e.key?a=t[0]:"End"===e.key&&(a=t[t.length-1]),a&&(null===(n=t[r])||void 0===n||n.setAttribute("tabindex","-1"),null==a||a.setAttribute("tabindex","0"),a.focus())}}_evtPointerDown(e){if(0!==e.button&&1!==e.button)return;if(this._dragData)return;if(e.target.classList.contains("lm-TabBar-tabInput"))return;let i=this.addButtonEnabled&&this.addButtonNode.contains(e.target),n=this.contentNode.children,a=t.ArrayExt.findFirstIndex(n,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1===a&&!i)return;if(e.preventDefault(),e.stopPropagation(),this._dragData={tab:n[a],index:a,pressX:e.clientX,pressY:e.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},this.document.addEventListener("pointerup",this,!0),1===e.button||i)return;let r=n[a].querySelector(this.renderer.closeIconSelector);r&&r.contains(e.target)||(this.tabsMovable&&(this.document.addEventListener("pointermove",this,!0),this.document.addEventListener("keydown",this,!0),this.document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===a?this.currentIndex=-1:this.currentIndex=a,-1!==this.currentIndex&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}_evtPointerMove(e){let t=this._dragData;if(!t)return;e.preventDefault(),e.stopPropagation();let i=this.contentNode.children;if(t.dragActive||V.dragExceeded(t,e)){if(!t.dragActive){let e=t.tab.getBoundingClientRect();"horizontal"===this._orientation?(t.tabPos=t.tab.offsetLeft,t.tabSize=e.width,t.tabPressPos=t.pressX-e.left):(t.tabPos=t.tab.offsetTop,t.tabSize=e.height,t.tabPressPos=t.pressY-e.top),t.tabPressOffset={x:t.pressX-e.left,y:t.pressY-e.top},t.tabLayout=V.snapTabLayout(i,this._orientation),t.contentRect=this.contentNode.getBoundingClientRect(),t.override=o.Drag.overrideCursor("default"),t.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),t.dragActive=!0}if(!t.detachRequested&&V.detachExceeded(t,e)){t.detachRequested=!0;let s=t.index,n=e.clientX,a=e.clientY,r=i[s],o=this._titles[s];if(this._tabDetachRequested.emit({index:s,title:o,tab:r,clientX:n,clientY:a,offset:t.tabPressOffset}),t.dragAborted)return}V.layoutTabs(i,t,e,this._orientation)}}_evtPointerUp(e){if(0!==e.button&&1!==e.button)return;const i=this._dragData;if(!i)return;if(e.preventDefault(),e.stopPropagation(),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),!i.dragActive){if(this._dragData=null,this.addButtonEnabled&&this.addButtonNode.contains(e.target))return void this._addRequested.emit(void 0);let n=this.contentNode.children,a=t.ArrayExt.findFirstIndex(n,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(a!==i.index)return;let r=this._titles[a];if(!r.closable)return;if(1===e.button)return void this._tabCloseRequested.emit({index:a,title:r});let o=n[a].querySelector(this.renderer.closeIconSelector);return o&&o.contains(e.target)?void this._tabCloseRequested.emit({index:a,title:r}):void 0}if(0!==e.button)return;V.finalizeTabPosition(i,this._orientation),i.tab.classList.remove("lm-mod-dragging");let a=V.parseTransitionDuration(i.tab);setTimeout((()=>{if(i.dragAborted)return;this._dragData=null,V.resetTabPositions(this.contentNode.children,this._orientation),i.override.dispose(),this.removeClass("lm-mod-dragging");let e=i.index,s=i.targetIndex;-1!==s&&e!==s&&(t.ArrayExt.move(this._titles,e,s),this._adjustCurrentForMove(e,s),this._tabMoved.emit({fromIndex:e,toIndex:s,title:this._titles[s]}),n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest))}),a)}_releaseMouse(){let e=this._dragData;e&&(this._dragData=null,this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),e.dragAborted=!0,e.dragActive&&(V.resetTabPositions(this.contentNode.children,this._orientation),e.override.dispose(),e.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging")))}_adjustCurrentForInsert(e,t){let i=this.currentTitle,s=this._currentIndex,n=this.insertBehavior;if("select-tab"===n||"select-tab-if-needed"===n&&-1===s)return this._currentIndex=e,this._previousTitle=i,void this._currentChanged.emit({previousIndex:s,previousTitle:i,currentIndex:e,currentTitle:t});s>=e&&this._currentIndex++}_adjustCurrentForMove(e,t){this._currentIndex===e?this._currentIndex=t:this._currentIndex=t?this._currentIndex++:this._currentIndex>e&&this._currentIndex<=t&&this._currentIndex--}_adjustCurrentForRemove(e,t){let i=this._currentIndex,s=this.removeBehavior;if(i===e){if(0===this._titles.length)return this._currentIndex=-1,void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null});if("select-tab-after"===s)return this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-tab-before"===s)return this._currentIndex=Math.max(0,e-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-previous-tab"===s)return this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});this._currentIndex=-1,this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}else i>e&&this._currentIndex--}_onTitleChanged(e){this.update()}}var V,U,Y,X,K,G,j,J;!function(e){class t{constructor(){this.closeIconSelector=".lm-TabBar-tabCloseIcon",this._tabID=0,this._tabKeys=new WeakMap,this._uuid=++t._nInstance}renderTab(e){let t=e.title.caption,i=this.createTabKey(e),s=i,n=this.createTabStyle(e),a=this.createTabClass(e),r=this.createTabDataset(e),o=this.createTabARIA(e);return e.title.closable?d.h.li({id:s,key:i,className:a,title:t,style:n,dataset:r,...o},this.renderIcon(e),this.renderLabel(e),this.renderCloseIcon(e)):d.h.li({id:s,key:i,className:a,title:t,style:n,dataset:r,...o},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){const{title:t}=e;let i=this.createIconClass(e);return d.h.div({className:i},t.icon,t.iconLabel)}renderLabel(e){return d.h.div({className:"lm-TabBar-tabLabel"},e.title.label)}renderCloseIcon(e){return d.h.div({className:"lm-TabBar-tabCloseIcon"})}createTabKey(e){let t=this._tabKeys.get(e.title);return void 0===t&&(t=`tab-key-${this._uuid}-${this._tabID++}`,this._tabKeys.set(e.title,t)),t}createTabStyle(e){return{zIndex:`${e.zIndex}`}}createTabClass(e){let t="lm-TabBar-tab";return e.title.className&&(t+=` ${e.title.className}`),e.title.closable&&(t+=" lm-mod-closable"),e.current&&(t+=" lm-mod-current"),t}createTabDataset(e){return e.title.dataset}createTabARIA(e){var t;return{role:"tab","aria-selected":e.current.toString(),tabindex:`${null!==(t=e.tabIndex)&&void 0!==t?t:"-1"}`}}createIconClass(e){let t="lm-TabBar-tabIcon",i=e.title.iconClass;return i?`${t} ${i}`:t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t,e.addButtonSelector=".lm-TabBar-addButton"}($||($={})),function(e){e.DRAG_THRESHOLD=5,e.DETACH_THRESHOLD=20,e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");t.setAttribute("role","tablist"),t.className="lm-TabBar-content",e.appendChild(t);let i=document.createElement("div");return i.className="lm-TabBar-addButton lm-mod-hidden",i.setAttribute("tabindex","-1"),i.setAttribute("role","button"),e.appendChild(i),e},e.asTitle=function(e){return e instanceof f?e:new f(e)},e.parseTransitionDuration=function(e){let t=window.getComputedStyle(e);return 1e3*(parseFloat(t.transitionDuration)||0)},e.snapTabLayout=function(e,t){let i=new Array(e.length);for(let s=0,n=e.length;s=e.DRAG_THRESHOLD||n>=e.DRAG_THRESHOLD},e.detachExceeded=function(t,i){let s=t.contentRect;return i.clientX=s.right+e.DETACH_THRESHOLD||i.clientY=s.bottom+e.DETACH_THRESHOLD},e.layoutTabs=function(e,t,i,s){let n,a,r,o;"horizontal"===s?(n=t.pressX,a=i.clientX-t.contentRect.left,r=i.clientX,o=t.contentRect.width):(n=t.pressY,a=i.clientY-t.contentRect.top,r=i.clientY,o=t.contentRect.height);let h=t.index,d=a-t.tabPressPos,l=d+t.tabSize;for(let i=0,a=e.length;i>1);if(it.index&&l>u)a=-t.tabSize-c.margin+"px",h=Math.max(h,i);else if(i===t.index){let e=r-n,i=o-(t.tabPos+t.tabSize);a=`${Math.max(-t.tabPos,Math.min(e,i))}px`}else a="";"horizontal"===s?e[i].style.left=a:e[i].style.top=a}t.targetIndex=h},e.finalizeTabPosition=function(e,t){let i,s;if(i="horizontal"===t?e.contentRect.width:e.contentRect.height,e.targetIndex===e.index)s=0;else if(e.targetIndex>e.index){let t=e.tabLayout[e.targetIndex];s=t.pos+t.size-e.tabSize-e.tabPos}else{s=e.tabLayout[e.targetIndex].pos-e.tabPos}let n=i-(e.tabPos+e.tabSize),a=Math.max(-e.tabPos,Math.min(s,n));"horizontal"===t?e.tab.style.left=`${a}px`:e.tab.style.top=`${a}px`},e.resetTabPositions=function(e,t){for(const i of e)"horizontal"===t?i.style.left="":i.style.top=""}}(V||(V={}));class Q extends v{constructor(e){super(),this._spacing=4,this._dirty=!1,this._root=null,this._box=null,this._items=new Map,this.renderer=e.renderer,void 0!==e.spacing&&(this._spacing=D.clampDimension(e.spacing)),this._document=e.document||document,this._hiddenMode=void 0!==e.hiddenMode?e.hiddenMode:b.HiddenMode.Display}dispose(){let e=this[Symbol.iterator]();this._items.forEach((e=>{e.dispose()})),this._box=null,this._root=null,this._items.clear();for(const t of e)t.dispose();super.dispose()}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){if(this._hiddenMode!==e){this._hiddenMode=e;for(const e of this.tabBars())if(e.titles.length>1)for(const t of e.titles)t.owner.hiddenMode=this._hiddenMode}}get spacing(){return this._spacing}set spacing(e){e=D.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get isEmpty(){return null===this._root}[Symbol.iterator](){return this._root?this._root.iterAllWidgets():t.empty()}widgets(){return this._root?this._root.iterUserWidgets():t.empty()}selectedWidgets(){return this._root?this._root.iterSelectedWidgets():t.empty()}tabBars(){return this._root?this._root.iterTabBars():t.empty()}handles(){return this._root?this._root.iterHandles():t.empty()}moveHandle(t,i,s){let n=t.classList.contains("lm-mod-hidden");if(!this._root||n)return;let a,r=this._root.findSplitNode(t);r&&(a="horizontal"===r.node.orientation?i-t.offsetLeft:s-t.offsetTop,0!==a&&(r.node.holdSizes(),e.BoxEngine.adjust(r.node.sizers,r.index,a),this.parent&&this.parent.update()))}saveLayout(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}}restoreLayout(e){let t,i=new Set;t=e.main?U.normalizeAreaConfig(e.main,i):null;let s=this.widgets(),n=this.tabBars(),a=this.handles();this._root=null;for(const e of s)i.has(e)||(e.parent=null);for(const e of n)e.dispose();for(const e of a)e.parentNode&&e.parentNode.removeChild(e);for(const e of i)e.parent=this.parent;this._root=t?U.realizeAreaConfig(t,{createTabBar:e=>this._createTabBar(),createHandle:()=>this._createHandle()},this._document):null,this.parent&&(i.forEach((e=>{this.attachWidget(e)})),this.parent.fit())}addWidget(e,t={}){let i=t.ref||null,s=t.mode||"tab-after",n=null;if(this._root&&i&&(n=this._root.findTabNode(i)),i&&!n)throw new Error("Reference widget is not in the layout.");switch(e.parent=this.parent,s){case"tab-after":this._insertTab(e,i,n,!0);break;case"tab-before":this._insertTab(e,i,n,!1);break;case"split-top":this._insertSplit(e,i,n,"vertical",!1);break;case"split-left":this._insertSplit(e,i,n,"horizontal",!1);break;case"split-right":this._insertSplit(e,i,n,"horizontal",!0);break;case"split-bottom":this._insertSplit(e,i,n,"vertical",!0);break;case"merge-top":this._insertSplit(e,i,n,"vertical",!1,!0);break;case"merge-left":this._insertSplit(e,i,n,"horizontal",!1,!0);break;case"merge-right":this._insertSplit(e,i,n,"horizontal",!0,!0);break;case"merge-bottom":this._insertSplit(e,i,n,"vertical",!0,!0)}this.parent&&(this.attachWidget(e),this.parent.fit())}removeWidget(e){this._removeWidget(e),this.parent&&(this.detachWidget(e),this.parent.fit())}hitTestTabAreas(e,t){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=s.ElementExt.boxSizing(this.parent.node));let i=this.parent.node.getBoundingClientRect(),n=e-i.left-this._box.borderLeft,a=t-i.top-this._box.borderTop,r=this._root.hitTestTabNodes(n,a);if(!r)return null;let{tabBar:o,top:h,left:d,width:l,height:c}=r,u=this._box.borderLeft+this._box.borderRight,m=this._box.borderTop+this._box.borderBottom;return{tabBar:o,x:n,y:a,top:h,left:d,right:i.width-u-(d+l),bottom:i.height-m-(h+c),width:l,height:c}}init(){super.init();for(const e of this)this.attachWidget(e);for(const e of this.handles())this.parent.node.appendChild(e);this.parent.fit()}attachWidget(e){this.parent.node!==e.node.parentNode&&(this._items.set(e,new x(e)),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterAttach))}detachWidget(e){if(this.parent.node!==e.node.parentNode)return;this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterDetach);let t=this._items.get(e);t&&(this._items.delete(e),t.dispose())}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_removeWidget(e){if(!this._root)return;let i=this._root.findTabNode(e);if(!i)return;if(U.removeAria(e),i.tabBar.titles.length>1){if(i.tabBar.removeTab(e.title),this._hiddenMode===b.HiddenMode.Scale&&1==i.tabBar.titles.length){i.tabBar.titles[0].owner.hiddenMode=b.HiddenMode.Display}return}if(i.tabBar.dispose(),this._root===i)return void(this._root=null);this._root.holdAllSizes();let s=i.parent;i.parent=null;let n=t.ArrayExt.removeFirstOf(s.children,i),a=t.ArrayExt.removeAt(s.handles,n);if(t.ArrayExt.removeAt(s.sizers,n),a.parentNode&&a.parentNode.removeChild(a),s.children.length>1)return void s.syncHandles();let r=s.parent;s.parent=null;let o=s.children[0],h=s.handles[0];if(s.children.length=0,s.handles.length=0,s.sizers.length=0,h.parentNode&&h.parentNode.removeChild(h),this._root===s)return o.parent=null,void(this._root=o);let d=r,l=d.children.indexOf(s);if(o instanceof U.TabLayoutNode)return o.parent=d,void(d.children[l]=o);let c=t.ArrayExt.removeAt(d.handles,l);t.ArrayExt.removeAt(d.children,l),t.ArrayExt.removeAt(d.sizers,l),c.parentNode&&c.parentNode.removeChild(c);for(let e=0,i=o.children.length;e=i.length)&&(s=0);return{type:"tab-area",widgets:i,currentIndex:s}}(e,t):function(e,t){let i=e.orientation,n=[],a=[];for(let r=0,o=e.children.length;r{let h=n(r,t,s),d=i(e.sizes[o]),l=t.createHandle();a.children.push(h),a.handles.push(l),a.sizers.push(d),h.parent=a})),a.syncHandles(),a.normalizeSizes(),a}(e,s,o),h}t.GOLDEN_RATIO=.618,t.createSizer=i,t.normalizeAreaConfig=s,t.realizeAreaConfig=n;class a{constructor(e){this.parent=null,this._top=0,this._left=0,this._width=0,this._height=0;let t=new u,i=new u;t.stretch=0,i.stretch=1,this.tabBar=e,this.sizers=[t,i]}get top(){return this._top}get left(){return this._left}get width(){return this._width}get height(){return this._height}*iterAllWidgets(){yield this.tabBar,yield*this.iterUserWidgets()}*iterUserWidgets(){for(const e of this.tabBar.titles)yield e.owner}*iterSelectedWidgets(){let e=this.tabBar.currentTitle;e&&(yield e.owner)}*iterTabBars(){yield this.tabBar}*iterHandles(){}findTabNode(e){return-1!==this.tabBar.titles.indexOf(e.title)?this:null}findSplitNode(e){return null}findFirstTabNode(){return this}hitTestTabNodes(e,t){return e=this._left+this._width||t=this._top+this._height?null:this}createConfig(){return{type:"tab-area",widgets:this.tabBar.titles.map((e=>e.owner)),currentIndex:this.tabBar.currentIndex}}holdAllSizes(){}fit(e,t){let i=0,s=0,n=t.get(this.tabBar),a=this.tabBar.currentTitle,r=a?t.get(a.owner):void 0,[o,h]=this.sizers;return n&&n.fit(),r&&r.fit(),n&&!n.isHidden?(i=Math.max(i,n.minWidth),s+=n.minHeight,o.minSize=n.minHeight,o.maxSize=n.maxHeight):(o.minSize=0,o.maxSize=0),r&&!r.isHidden?(i=Math.max(i,r.minWidth),s+=r.minHeight,h.minSize=r.minHeight,h.maxSize=1/0):(h.minSize=0,h.maxSize=1/0),{minWidth:i,minHeight:s,maxWidth:Infinity,maxHeight:Infinity}}update(t,i,s,n,a,r){this._top=i,this._left=t,this._width=s,this._height=n;let o=r.get(this.tabBar),h=this.tabBar.currentTitle,d=h?r.get(h.owner):void 0;if(e.BoxEngine.calc(this.sizers,n),o&&!o.isHidden){let e=this.sizers[0].size;o.update(t,i,s,e),i+=e}if(d&&!d.isHidden){let e=this.sizers[1].size;d.update(t,i,s,e)}}}t.TabLayoutNode=a;class r{constructor(e){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=e}*iterAllWidgets(){for(const e of this.children)yield*e.iterAllWidgets()}*iterUserWidgets(){for(const e of this.children)yield*e.iterUserWidgets()}*iterSelectedWidgets(){for(const e of this.children)yield*e.iterSelectedWidgets()}*iterTabBars(){for(const e of this.children)yield*e.iterTabBars()}*iterHandles(){yield*this.handles;for(const e of this.children)yield*e.iterHandles()}findTabNode(e){for(let t=0,i=this.children.length;te.createConfig())),sizes:t}}syncHandles(){this.handles.forEach(((e,t)=>{e.setAttribute("data-orientation",this.orientation),t===this.handles.length-1?e.classList.add("lm-mod-hidden"):e.classList.remove("lm-mod-hidden")}))}holdSizes(){for(const e of this.sizers)e.sizeHint=e.size}holdAllSizes(){for(const e of this.children)e.holdAllSizes();this.holdSizes()}normalizeSizes(){let e=this.sizers.length;if(0===e)return;this.holdSizes();let t=this.sizers.reduce(((e,t)=>e+t.sizeHint),0);if(0===t)for(const t of this.sizers)t.size=t.sizeHint=1/e;else for(const e of this.sizers)e.size=e.sizeHint/=t;this.normalized=!0}createNormalizedSizes(){let e=this.sizers.length;if(0===e)return[];let t=this.sizers.map((e=>e.size)),i=t.reduce(((e,t)=>e+t),0);if(0===i)for(let i=t.length-1;i>-1;i--)t[i]=1/e;else for(let e=t.length-1;e>-1;e--)t[e]/=i;return t}fit(e,t){let i="horizontal"===this.orientation,s=Math.max(0,this.children.length-1)*e,n=i?s:0,a=i?0:s;for(let s=0,r=this.children.length;sthis._createTabBar(),createHandle:()=>this._createHandle()};this.layout=new Q({document:this._document,renderer:t,spacing:e.spacing,hiddenMode:e.hiddenMode}),this.overlay=e.overlay||new Z.Overlay,this.node.appendChild(this.overlay.node)}dispose(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),super.dispose()}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(e){this.layout.hiddenMode=e}get layoutModified(){return this._layoutModified}get addRequested(){return this._addRequested}get renderer(){return this.layout.renderer}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get mode(){return this._mode}set mode(e){if(this._mode===e)return;this._mode=e,this.dataset.mode=e;let t=this.layout;switch(e){case"multiple-document":for(const e of t.tabBars())e.show();break;case"single-document":t.restoreLayout(Y.createSingleDocumentConfig(this));break;default:throw"unreachable"}n.MessageLoop.postMessage(this,Y.LayoutModified)}get tabsMovable(){return this._tabsMovable}set tabsMovable(e){this._tabsMovable=e;for(const t of this.tabBars())t.tabsMovable=e}get tabsConstrained(){return this._tabsConstrained}set tabsConstrained(e){this._tabsConstrained=e}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled=e;for(const t of this.tabBars())t.addButtonEnabled=e}get isEmpty(){return this.layout.isEmpty}*widgets(){yield*this.layout.widgets()}*selectedWidgets(){yield*this.layout.selectedWidgets()}*tabBars(){yield*this.layout.tabBars()}*handles(){yield*this.layout.handles()}selectWidget(e){let i=t.find(this.tabBars(),(t=>-1!==t.titles.indexOf(e.title)));if(!i)throw new Error("Widget is not contained in the dock panel.");i.currentTitle=e.title}activateWidget(e){this.selectWidget(e),e.activate()}saveLayout(){return this.layout.saveLayout()}restoreLayout(e){this._mode="multiple-document",this.layout.restoreLayout(e),(s.Platform.IS_EDGE||s.Platform.IS_IE)&&n.MessageLoop.flush(),n.MessageLoop.postMessage(this,Y.LayoutModified)}addWidget(e,t={}){"single-document"===this._mode?this.layout.addWidget(e):this.layout.addWidget(e,t),n.MessageLoop.postMessage(this,Y.LayoutModified)}processMessage(e){"layout-modified"===e.type?this._layoutModified.emit(void 0):super.processMessage(e)}handleEvent(e){switch(e.type){case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e);break;case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){Y.isGeneratedTabBarProperty.get(e.child)||e.child.addClass("lm-DockPanel-widget")}onChildRemoved(e){Y.isGeneratedTabBarProperty.get(e.child)||(e.child.removeClass("lm-DockPanel-widget"),n.MessageLoop.postMessage(this,Y.LayoutModified))}_evtDragEnter(e){e.mimeData.hasData("application/vnd.lumino.widget-factory")&&(e.preventDefault(),e.stopPropagation())}_evtDragLeave(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||(e.stopPropagation(),this.overlay.hide(1))}_evtDragOver(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||"invalid"===this._showOverlay(e.clientX,e.clientY)?e.dropAction="none":(e.stopPropagation(),e.dropAction=e.proposedAction)}_evtDrop(e){if(e.preventDefault(),this.overlay.hide(0),"none"===e.proposedAction)return void(e.dropAction="none");let{clientX:t,clientY:i}=e,{zone:s,target:n}=Y.findDropTarget(this,t,i,this._edges);if(this._tabsConstrained&&e.source!==this||"invalid"===s)return void(e.dropAction="none");let a=e.mimeData.getData("application/vnd.lumino.widget-factory");if("function"!=typeof a)return void(e.dropAction="none");let r=a();if(!(r instanceof b))return void(e.dropAction="none");if(r.contains(this))return void(e.dropAction="none");let o=n?Y.getDropRef(n.tabBar):null;switch(s){case"root-all":this.addWidget(r);break;case"root-top":this.addWidget(r,{mode:"split-top"});break;case"root-left":this.addWidget(r,{mode:"split-left"});break;case"root-right":this.addWidget(r,{mode:"split-right"});break;case"root-bottom":this.addWidget(r,{mode:"split-bottom"});break;case"widget-all":case"widget-tab":this.addWidget(r,{mode:"tab-after",ref:o});break;case"widget-top":this.addWidget(r,{mode:"split-top",ref:o});break;case"widget-left":this.addWidget(r,{mode:"split-left",ref:o});break;case"widget-right":this.addWidget(r,{mode:"split-right",ref:o});break;case"widget-bottom":this.addWidget(r,{mode:"split-bottom",ref:o});break;default:throw"unreachable"}e.dropAction=e.proposedAction,e.stopPropagation(),this.activateWidget(r)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation(),27===e.keyCode&&(this._releaseMouse(),n.MessageLoop.postMessage(this,Y.LayoutModified))}_evtPointerDown(e){if(0!==e.button)return;let i=this.layout,s=e.target,n=t.find(i.handles(),(e=>e.contains(s)));if(!n)return;e.preventDefault(),e.stopPropagation(),this._document.addEventListener("keydown",this,!0),this._document.addEventListener("pointerup",this,!0),this._document.addEventListener("pointermove",this,!0),this._document.addEventListener("contextmenu",this,!0);let a=n.getBoundingClientRect(),r=e.clientX-a.left,h=e.clientY-a.top,d=window.getComputedStyle(n),l=o.Drag.overrideCursor(d.cursor,this._document);this._pressData={handle:n,deltaX:r,deltaY:h,override:l}}_evtPointerMove(e){if(!this._pressData)return;e.preventDefault(),e.stopPropagation();let t=this.node.getBoundingClientRect(),i=e.clientX-t.left-this._pressData.deltaX,s=e.clientY-t.top-this._pressData.deltaY;this.layout.moveHandle(this._pressData.handle,i,s)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse(),n.MessageLoop.postMessage(this,Y.LayoutModified))}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._document.removeEventListener("keydown",this,!0),this._document.removeEventListener("pointerup",this,!0),this._document.removeEventListener("pointermove",this,!0),this._document.removeEventListener("contextmenu",this,!0))}_showOverlay(e,t){let i,n,a,r,{zone:o,target:h}=Y.findDropTarget(this,e,t,this._edges);if("invalid"===o)return this.overlay.hide(100),o;let d=s.ElementExt.boxSizing(this.node),l=this.node.getBoundingClientRect();switch(o){case"root-all":i=d.paddingTop,n=d.paddingLeft,a=d.paddingRight,r=d.paddingBottom;break;case"root-top":i=d.paddingTop,n=d.paddingLeft,a=d.paddingRight,r=l.height*Y.GOLDEN_RATIO;break;case"root-left":i=d.paddingTop,n=d.paddingLeft,a=l.width*Y.GOLDEN_RATIO,r=d.paddingBottom;break;case"root-right":i=d.paddingTop,n=l.width*Y.GOLDEN_RATIO,a=d.paddingRight,r=d.paddingBottom;break;case"root-bottom":i=l.height*Y.GOLDEN_RATIO,n=d.paddingLeft,a=d.paddingRight,r=d.paddingBottom;break;case"widget-all":i=h.top,n=h.left,a=h.right,r=h.bottom;break;case"widget-top":i=h.top,n=h.left,a=h.right,r=h.bottom+h.height/2;break;case"widget-left":i=h.top,n=h.left,a=h.right+h.width/2,r=h.bottom;break;case"widget-right":i=h.top,n=h.left+h.width/2,a=h.right,r=h.bottom;break;case"widget-bottom":i=h.top+h.height/2,n=h.left,a=h.right,r=h.bottom;break;case"widget-tab":{const e=h.tabBar.node.getBoundingClientRect().height;i=h.top,n=h.left,a=h.right,r=h.bottom+h.height-e;break}default:throw"unreachable"}return this.overlay.show({top:i,left:n,right:a,bottom:r}),o}_createTabBar(){let e=this._renderer.createTabBar(this._document);return Y.isGeneratedTabBarProperty.set(e,!0),"single-document"===this._mode&&e.hide(),e.tabsMovable=this._tabsMovable,e.allowDeselect=!1,e.addButtonEnabled=this._addButtonEnabled,e.removeBehavior="select-previous-tab",e.insertBehavior="select-tab-if-needed",e.tabMoved.connect(this._onTabMoved,this),e.currentChanged.connect(this._onCurrentChanged,this),e.tabCloseRequested.connect(this._onTabCloseRequested,this),e.tabDetachRequested.connect(this._onTabDetachRequested,this),e.tabActivateRequested.connect(this._onTabActivateRequested,this),e.addRequested.connect(this._onTabAddRequested,this),e}_createHandle(){return this._renderer.createHandle()}_onTabMoved(){n.MessageLoop.postMessage(this,Y.LayoutModified)}_onCurrentChanged(e,t){let{previousTitle:i,currentTitle:a}=t;i&&i.owner.hide(),a&&a.owner.show(),(s.Platform.IS_EDGE||s.Platform.IS_IE)&&n.MessageLoop.flush(),n.MessageLoop.postMessage(this,Y.LayoutModified)}_onTabAddRequested(e){this._addRequested.emit(e)}_onTabActivateRequested(e,t){t.title.owner.activate()}_onTabCloseRequested(e,t){t.title.owner.close()}_onTabDetachRequested(e,t){if(this._drag)return;e.releaseMouse();let{title:s,tab:n,clientX:a,clientY:r,offset:h}=t,d=new i.MimeData;d.setData("application/vnd.lumino.widget-factory",(()=>s.owner));let l=n.cloneNode(!0);h&&(l.style.top=`-${h.y}px`,l.style.left=`-${h.x}px`),this._drag=new o.Drag({document:this._document,mimeData:d,dragImage:l,proposedAction:"move",supportedActions:"move",source:this}),n.classList.add("lm-mod-hidden");this._drag.start(a,r).then((()=>{this._drag=null,n.classList.remove("lm-mod-hidden")}))}}!function(e){e.Overlay=class{constructor(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.style.position="absolute",this.node.style.contain="strict"}show(e){let t=this.node.style;t.top=`${e.top}px`,t.left=`${e.left}px`,t.right=`${e.right}px`,t.bottom=`${e.bottom}px`,clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"))}hide(e){if(!this._hidden)return e<=0?(clearTimeout(this._timer),this._timer=-1,this._hidden=!0,void this.node.classList.add("lm-mod-hidden")):void(-1===this._timer&&(this._timer=window.setTimeout((()=>{this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden")}),e)))}};class t{createTabBar(e){let t=new $({document:e});return t.addClass("lm-DockPanel-tabBar"),t}createHandle(){let e=document.createElement("div");return e.className="lm-DockPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t}(Z||(Z={})),function(e){e.GOLDEN_RATIO=.618,e.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},e.LayoutModified=new n.ConflatableMessage("layout-modified"),e.isGeneratedTabBarProperty=new a.AttachedProperty({name:"isGeneratedTabBar",create:()=>!1}),e.createSingleDocumentConfig=function(e){if(e.isEmpty)return{main:null};let t=Array.from(e.widgets()),i=e.selectedWidgets().next().value,s=i?t.indexOf(i):-1;return{main:{type:"tab-area",widgets:t,currentIndex:s}}},e.findDropTarget=function(e,t,i,n){if(!s.ElementExt.hitTest(e.node,t,i))return{zone:"invalid",target:null};let a=e.layout;if(a.isEmpty)return{zone:"root-all",target:null};if("multiple-document"===e.mode){let s=e.node.getBoundingClientRect(),a=t-s.left+1,r=i-s.top+1,o=s.right-t,h=s.bottom-i;switch(Math.min(r,o,h,a)){case r:if(ru&&d>u&&h>m&&l>m)return{zone:"widget-all",target:r};switch(o/=u,h/=m,d/=u,l/=m,Math.min(o,h,d,l)){case o:c="widget-left";break;case h:c="widget-top";break;case d:c="widget-right";break;case l:c="widget-bottom";break;default:throw"unreachable"}return{zone:c,target:r}},e.getDropRef=function(e){return 0===e.titles.length?null:e.currentTitle?e.currentTitle.owner:e.titles[e.titles.length-1].owner}}(Y||(Y={}));class ee extends v{constructor(e={}){super(e),this._dirty=!1,this._rowSpacing=4,this._columnSpacing=4,this._items=[],this._rowStarts=[],this._columnStarts=[],this._rowSizers=[new u],this._columnSizers=[new u],this._box=null,void 0!==e.rowCount&&X.reallocSizers(this._rowSizers,e.rowCount),void 0!==e.columnCount&&X.reallocSizers(this._columnSizers,e.columnCount),void 0!==e.rowSpacing&&(this._rowSpacing=X.clampValue(e.rowSpacing)),void 0!==e.columnSpacing&&(this._columnSpacing=X.clampValue(e.columnSpacing))}dispose(){for(const e of this._items){let t=e.widget;e.dispose(),t.dispose()}this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,super.dispose()}get rowCount(){return this._rowSizers.length}set rowCount(e){e!==this.rowCount&&(X.reallocSizers(this._rowSizers,e),this.parent&&this.parent.fit())}get columnCount(){return this._columnSizers.length}set columnCount(e){e!==this.columnCount&&(X.reallocSizers(this._columnSizers,e),this.parent&&this.parent.fit())}get rowSpacing(){return this._rowSpacing}set rowSpacing(e){e=X.clampValue(e),this._rowSpacing!==e&&(this._rowSpacing=e,this.parent&&this.parent.fit())}get columnSpacing(){return this._columnSpacing}set columnSpacing(e){e=X.clampValue(e),this._columnSpacing!==e&&(this._columnSpacing=e,this.parent&&this.parent.fit())}rowStretch(e){let t=this._rowSizers[e];return t?t.stretch:-1}setRowStretch(e,t){let i=this._rowSizers[e];i&&(t=X.clampValue(t),i.stretch!==t&&(i.stretch=t,this.parent&&this.parent.update()))}columnStretch(e){let t=this._columnSizers[e];return t?t.stretch:-1}setColumnStretch(e,t){let i=this._columnSizers[e];i&&(t=X.clampValue(t),i.stretch!==t&&(i.stretch=t,this.parent&&this.parent.update()))}*[Symbol.iterator](){for(const e of this._items)yield e.widget}addWidget(e){-1===t.ArrayExt.findFirstIndex(this._items,(t=>t.widget===e))&&(this._items.push(new x(e)),this.parent&&this.attachWidget(e))}removeWidget(e){let i=t.ArrayExt.findFirstIndex(this._items,(t=>t.widget===e));if(-1===i)return;let s=t.ArrayExt.removeAt(this._items,i);this.parent&&this.detachWidget(e),s.dispose()}init(){super.init();for(const e of this)this.attachWidget(e)}attachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterAttach),this.parent.fit()}detachWidget(e){this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&n.MessageLoop.sendMessage(e,b.Msg.AfterDetach),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){for(let e=0,t=this.rowCount;e!e.isHidden));for(let t=0,i=e.length;t({row:0,column:0,rowSpan:1,columnSpan:1}),changed:function(e){e.parent&&e.parent.layout instanceof ee&&e.parent.fit()}}),e.normalizeConfig=function(e){return{row:Math.max(0,Math.floor(e.row||0)),column:Math.max(0,Math.floor(e.column||0)),rowSpan:Math.max(1,Math.floor(e.rowSpan||0)),columnSpan:Math.max(1,Math.floor(e.columnSpan||0))}},e.clampValue=function(e){return Math.max(0,Math.floor(e))},e.rowSpanCmp=function(t,i){let s=e.cellConfigProperty.get(t.widget),n=e.cellConfigProperty.get(i.widget);return s.rowSpan-n.rowSpan},e.columnSpanCmp=function(t,i){let s=e.cellConfigProperty.get(t.widget),n=e.cellConfigProperty.get(i.widget);return s.columnSpan-n.columnSpan},e.reallocSizers=function(e,t){for(t=Math.max(1,Math.floor(t));e.lengtht&&(e.length=t)},e.distributeMin=function(e,t,i,s){if(i=s)return;let a=(s-n)/(i-t+1);for(let s=t;s<=i;++s)e[s].minSize+=a}}(X||(X={}));class te extends b{constructor(e={}){super({node:K.createNode()}),this._activeIndex=-1,this._tabFocusIndex=0,this._menus=[],this._childMenu=null,this._overflowMenu=null,this._menuItemSizes=[],this._overflowIndex=-1,this.addClass("lm-MenuBar"),this.setFlag(b.Flag.DisallowLayout),this.renderer=e.renderer||te.defaultRenderer,this._forceItemsPosition=e.forceItemsPosition||{forceX:!0,forceY:!0},this._overflowMenuOptions=e.overflowMenuOptions||{isVisible:!0}}dispose(){this._closeChildMenu(),this._menus.length=0,super.dispose()}get childMenu(){return this._childMenu}get overflowIndex(){return this._overflowIndex}get overflowMenu(){return this._overflowMenu}get contentNode(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]}get activeMenu(){return this._menus[this._activeIndex]||null}set activeMenu(e){this.activeIndex=e?this._menus.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._menus.length)&&(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this.update())}get menus(){return this._menus}openActiveMenu(){-1!==this._activeIndex&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))}addMenu(e,t=!0){this.insertMenu(this._menus.length,e,t)}insertMenu(e,i,s=!0){this._closeChildMenu();let n=this._menus.indexOf(i),a=Math.max(0,Math.min(e,this._menus.length));if(-1===n)return t.ArrayExt.insert(this._menus,a,i),i.addClass("lm-MenuBar-menu"),i.aboutToClose.connect(this._onMenuAboutToClose,this),i.menuRequested.connect(this._onMenuMenuRequested,this),i.title.changed.connect(this._onTitleChanged,this),void(s&&this.update());a===this._menus.length&&a--,n!==a&&(t.ArrayExt.move(this._menus,n,a),s&&this.update())}removeMenu(e,t=!0){this.removeMenuAt(this._menus.indexOf(e),t)}removeMenuAt(e,i=!0){this._closeChildMenu();let s=t.ArrayExt.removeAt(this._menus,e);s&&(s.aboutToClose.disconnect(this._onMenuAboutToClose,this),s.menuRequested.disconnect(this._onMenuMenuRequested,this),s.title.changed.disconnect(this._onTitleChanged,this),s.removeClass("lm-MenuBar-menu"),i&&this.update())}clearMenus(){if(0!==this._menus.length){this._closeChildMenu();for(let e of this._menus)e.aboutToClose.disconnect(this._onMenuAboutToClose,this),e.menuRequested.disconnect(this._onMenuMenuRequested,this),e.title.changed.disconnect(this._onTitleChanged,this),e.removeClass("lm-MenuBar-menu");this._menus.length=0,this.update()}}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"mousedown":this._evtMouseDown(e);break;case"mousemove":this._evtMouseMove(e);break;case"focusout":this._evtFocusOut(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("keydown",this),this.node.addEventListener("mousedown",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("focusout",this),this.node.addEventListener("contextmenu",this)}onAfterDetach(e){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mousedown",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("focusout",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()}onActivateRequest(e){this.isAttached&&this._focusItemAt(0)}onResize(e){this.update(),super.onResize(e)}onUpdateRequest(e){var t;let i=this._menus,s=this.renderer,n=this._activeIndex,a=this._tabFocusIndex>=0&&this._tabFocusIndex-1?this._overflowIndex:i.length,o=0,l=!1;r=null!==this._overflowMenu?r-1:r;let c=new Array(r);for(let e=0;e{this._tabFocusIndex=e,this.activeIndex=e}}),o+=this._menuItemSizes[e],i[e].title.label===this._overflowMenuOptions.title&&(l=!0,r--);if(this._overflowMenuOptions.isVisible)if(this._overflowIndex>-1&&!l){if(null===this._overflowMenu){const e=null!==(t=this._overflowMenuOptions.title)&&void 0!==t?t:"...";this._overflowMenu=new F({commands:new h.CommandRegistry}),this._overflowMenu.title.label=e,this._overflowMenu.title.mnemonic=0,this.addMenu(this._overflowMenu,!1)}for(let e=i.length-2;e>=r;e--){const t=this.menus[e];t.title.mnemonic=0,this._overflowMenu.insertItem(0,{type:"submenu",submenu:t}),this.removeMenu(t,!1)}c[r]=s.renderItem({title:this._overflowMenu.title,active:r===n&&0!==i[r].items.length,tabbable:r===a,disabled:0===i[r].items.length,onfocus:()=>{this._tabFocusIndex=r,this.activeIndex=r}}),r++}else if(null!==this._overflowMenu){let e=this._overflowMenu.items,t=this.node.offsetWidth,n=this._overflowMenu.items.length;for(let h=0;hthis._menuItemSizes[n]){let t=e[0].submenu;this._overflowMenu.removeItemAt(0),this.insertMenu(r,t,!1),c[r]=s.renderItem({title:t.title,active:!1,tabbable:r===a,disabled:0===i[r].items.length,onfocus:()=>{this._tabFocusIndex=r,this.activeIndex=r}}),r++}}0===this._overflowMenu.items.length&&(this.removeMenu(this._overflowMenu,!1),c.pop(),this._overflowMenu=null,this._overflowIndex=-1)}d.VirtualDOM.render(c,this.contentNode),this._updateOverflowIndex()}_updateOverflowIndex(){if(!this._overflowMenuOptions.isVisible)return;const e=this.contentNode.childNodes;let t=this.node.offsetWidth,i=0,s=-1,n=e.length;if(0==this._menuItemSizes.length)for(let a=0;at&&-1===s&&(s=a)}else for(let e=0;et){s=e;break}this._overflowIndex=s}_evtKeyDown(e){let t=e.keyCode;if(9===t)return void(this.activeIndex=-1);if(e.preventDefault(),e.stopPropagation(),13===t||32===t||38===t||40===t){if(this.activeIndex=this._tabFocusIndex,this.activeIndex!==this._tabFocusIndex)return;return void this.openActiveMenu()}if(27===t)return this._closeChildMenu(),void this._focusItemAt(this.activeIndex);if(37===t||39===t){let e=37===t?-1:1,i=this._tabFocusIndex+e,s=this._menus.length;for(let t=0;ts.ElementExt.hitTest(t,e.clientX,e.clientY)));if(-1!==i){if(0===e.button)if(this._childMenu)this._closeChildMenu(),this.activeIndex=i;else{e.preventDefault();const t=this._positionForMenu(i);F.saveWindowData(),this.activeIndex=i,this._openChildMenu(t)}}else this._closeChildMenu()}_evtMouseMove(e){let i=t.ArrayExt.findFirstIndex(this.contentNode.children,(t=>s.ElementExt.hitTest(t,e.clientX,e.clientY)));if(i===this._activeIndex)return;if(-1===i&&this._childMenu)return;const n=i>=0&&this._childMenu?this._positionForMenu(i):null;F.saveWindowData(),this.activeIndex=i,n&&this._openChildMenu(n)}_positionForMenu(e){let t=this.contentNode.children[e],{left:i,bottom:s}=t.getBoundingClientRect();return{top:s,left:i}}_evtFocusOut(e){this._childMenu||this.node.contains(e.relatedTarget)||(this.activeIndex=-1)}_focusItemAt(e){const t=this.contentNode.childNodes[e];t&&t.focus()}_openChildMenu(e={}){let t=this.activeMenu;if(!t)return void this._closeChildMenu();let i=this._childMenu;if(i===t)return;this._childMenu=t,i?i.close():document.addEventListener("mousedown",this,!0),this._tabFocusIndex=this.activeIndex,n.MessageLoop.sendMessage(this,b.Msg.UpdateRequest);let{left:s,top:a}=e;void 0!==s&&void 0!==a||({left:s,top:a}=this._positionForMenu(this._activeIndex)),i||this.addClass("lm-mod-active"),t.items.length>0&&t.open(s,a,this._forceItemsPosition)}_closeChildMenu(){if(!this._childMenu)return;this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0);let e=this._childMenu;this._childMenu=null,e.close(),this.activeIndex=-1}_onMenuAboutToClose(e){e===this._childMenu&&(this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0),this._childMenu=null,this.activeIndex=-1)}_onMenuMenuRequested(e,t){if(e!==this._childMenu)return;let i=this._activeIndex,s=this._menus.length;switch(t){case"next":this.activeIndex=i===s-1?0:i+1;break;case"previous":this.activeIndex=0===i?s-1:i-1}this.openActiveMenu()}_onTitleChanged(){this.update()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),i=this.createItemDataset(e),s=this.createItemARIA(e);return d.h.li({className:t,dataset:i,...e.disabled?{}:{tabindex:e.tabbable?"0":"-1"},onfocus:e.onfocus,...s},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){let t=this.createIconClass(e);return d.h.div({className:t},e.title.icon,e.title.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return d.h.div({className:"lm-MenuBar-itemLabel"},t)}createItemClass(e){let t="lm-MenuBar-item";return e.title.className&&(t+=` ${e.title.className}`),e.active&&!e.disabled&&(t+=" lm-mod-active"),t}createItemDataset(e){return e.title.dataset}createItemARIA(e){return{role:"menuitem","aria-haspopup":"true","aria-disabled":e.disabled?"true":"false"}}createIconClass(e){let t="lm-MenuBar-itemIcon",i=e.title.iconClass;return i?`${t} ${i}`:t}formatLabel(e){let{label:t,mnemonic:i}=e.title;if(i<0||i>=t.length)return t;let s=t.slice(0,i),n=t.slice(i+1),a=t[i];return[s,d.h.span({className:"lm-MenuBar-itemMnemonic"},a),n]}}e.Renderer=t,e.defaultRenderer=new t}(te||(te={})),function(e){e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-MenuBar-content",e.appendChild(t),t.setAttribute("role","menubar"),e},e.findMnemonic=function(e,t,i){let s=-1,n=-1,a=!1,r=t.toUpperCase();for(let t=0,o=e.length;t=0&&l1&&this.widgets.forEach((e=>{e.hiddenMode=this._hiddenMode})))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,super.dispose()}attachWidget(e,i){this._hiddenMode===b.HiddenMode.Scale&&this._items.length>0?(1===this._items.length&&(this.widgets[0].hiddenMode=b.HiddenMode.Scale),i.hiddenMode=b.HiddenMode.Scale):i.hiddenMode=b.HiddenMode.Display,t.ArrayExt.insert(this._items,e,new x(i)),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterAttach),this.parent.fit()}moveWidget(e,i,s){t.ArrayExt.move(this._items,e,i),this.parent.update()}detachWidget(e,i){let s=t.ArrayExt.removeAt(this._items,e);this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&n.MessageLoop.sendMessage(i,b.Msg.AfterDetach),s.widget.node.style.zIndex="",this._hiddenMode===b.HiddenMode.Scale&&(i.hiddenMode=b.HiddenMode.Display,1===this._items.length&&(this._items[0].widget.hiddenMode=b.HiddenMode.Display)),s.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0,t=0;for(let i=0,s=this._items.length;i{t.ArrayExt.removeFirstOf(this._items,i)}))}open(e){if(F.saveWindowData(),this.menu.clearItems(),0===this._items.length)return!1;let t=T.matchItems(this._items,e,this._groupByTarget,this._sortBySelector);if(!t||0===t.length)return!1;for(const e of t)this.menu.addItem(e);return this.menu.open(e.clientX,e.clientY),!0}},e.DockLayout=Q,e.DockPanel=Z,e.FocusTracker=class{constructor(){this._counter=0,this._widgets=[],this._activeWidget=null,this._currentWidget=null,this._numbers=new Map,this._nodes=new Map,this._activeChanged=new r.Signal(this),this._currentChanged=new r.Signal(this)}dispose(){if(!(this._counter<0)){this._counter=-1,r.Signal.clearData(this);for(const e of this._widgets)e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0);this._activeWidget=null,this._currentWidget=null,this._nodes.clear(),this._numbers.clear(),this._widgets.length=0}}get currentChanged(){return this._currentChanged}get activeChanged(){return this._activeChanged}get isDisposed(){return this._counter<0}get currentWidget(){return this._currentWidget}get activeWidget(){return this._activeWidget}get widgets(){return this._widgets}focusNumber(e){let t=this._numbers.get(e);return void 0===t?-1:t}has(e){return this._numbers.has(e)}add(e){if(this._numbers.has(e))return;let t=e.node.contains(document.activeElement),i=t?this._counter++:-1;this._widgets.push(e),this._numbers.set(e,i),this._nodes.set(e.node,e),e.node.addEventListener("focus",this,!0),e.node.addEventListener("blur",this,!0),e.disposed.connect(this._onWidgetDisposed,this),t&&this._setWidgets(e,e)}remove(e){if(!this._numbers.has(e))return;if(e.disposed.disconnect(this._onWidgetDisposed,this),e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0),t.ArrayExt.removeFirstOf(this._widgets,e),this._nodes.delete(e.node),this._numbers.delete(e),this._currentWidget!==e)return;let i=this._widgets.filter((e=>-1!==this._numbers.get(e))),s=t.max(i,((e,t)=>this._numbers.get(e)-this._numbers.get(t)))||null;this._setWidgets(s,null)}handleEvent(e){switch(e.type){case"focus":this._evtFocus(e);break;case"blur":this._evtBlur(e)}}_setWidgets(e,t){let i=this._currentWidget;this._currentWidget=e;let s=this._activeWidget;this._activeWidget=t,i!==e&&this._currentChanged.emit({oldValue:i,newValue:e}),s!==t&&this._activeChanged.emit({oldValue:s,newValue:t})}_evtFocus(e){let t=this._nodes.get(e.currentTarget);t!==this._currentWidget&&this._numbers.set(t,this._counter++),this._setWidgets(t,t)}_evtBlur(e){let i=this._nodes.get(e.currentTarget),s=e.relatedTarget;s&&(i.node.contains(s)||t.find(this._widgets,(e=>e.node.contains(s))))||this._setWidgets(this._currentWidget,null)}_onWidgetDisposed(e){this.remove(e)}},e.GridLayout=ee,e.Layout=v,e.LayoutItem=x,e.Menu=F,e.MenuBar=te,e.Panel=R,e.PanelLayout=M,e.ScrollBar=class extends b{constructor(e={}){super({node:G.createNode()}),this._onRepeat=()=>{if(this._repeatTimer=-1,!this._pressData)return;let e=this._pressData.part;if("thumb"===e)return;this._repeatTimer=window.setTimeout(this._onRepeat,20);let t=this._pressData.mouseX,i=this._pressData.mouseY;if("decrement"!==e)if("increment"!==e){if("track"===e){if(!s.ElementExt.hitTest(this.trackNode,t,i))return;let e=this.thumbNode;if(s.ElementExt.hitTest(e,t,i))return;let n,a=e.getBoundingClientRect();return n="horizontal"===this._orientation?t=` to {@link minSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `Infinity`.\n */\n maxSize = Infinity;\n\n /**\n * The stretch factor for the sizer.\n *\n * #### Notes\n * This controls how much the sizer stretches relative to its sibling\n * sizers when layout space is distributed. A stretch factor of zero\n * is special and will cause the sizer to only be resized after all\n * other sizers with a stretch factor greater than zero have been\n * resized to their limits.\n *\n * It is assumed that this value is an integer that lies in the range\n * `[0, Infinity)`. Failure to adhere to this constraint will yield\n * undefined results.\n *\n * The default value is `1`.\n */\n stretch = 1;\n\n /**\n * The computed size of the sizer.\n *\n * #### Notes\n * This value is the output of a call to {@link BoxEngine.calc}. It represents\n * the computed size for the object along the layout orientation,\n * and will always lie in the range `[minSize, maxSize]`.\n *\n * This value is output only.\n *\n * Changing this value will have no effect.\n */\n size = 0;\n\n /**\n * An internal storage property for the layout algorithm.\n *\n * #### Notes\n * This value is used as temporary storage by the layout algorithm.\n *\n * Changing this value will have no effect.\n */\n done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n /**\n * Calculate the optimal layout sizes for a sequence of box sizers.\n *\n * This distributes the available layout space among the box sizers\n * according to the following algorithm:\n *\n * 1. Initialize the sizers's size to its size hint and compute the\n * sums for each of size hint, min size, and max size.\n *\n * 2. If the total size hint equals the available space, return.\n *\n * 3. If the available space is less than the total min size, set all\n * sizers to their min size and return.\n *\n * 4. If the available space is greater than the total max size, set\n * all sizers to their max size and return.\n *\n * 5. If the layout space is less than the total size hint, distribute\n * the negative delta as follows:\n *\n * a. Shrink each sizer with a stretch factor greater than zero by\n * an amount proportional to the negative space and the sum of\n * stretch factors. If the sizer reaches its min size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains negative\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its min size,\n * remove it from the computation.\n *\n * 6. If the layout space is greater than the total size hint,\n * distribute the positive delta as follows:\n *\n * a. Expand each sizer with a stretch factor greater than zero by\n * an amount proportional to the postive space and the sum of\n * stretch factors. If the sizer reaches its max size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains positive\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its max size,\n * remove it from the computation.\n *\n * 7. return\n *\n * @param sizers - The sizers for a particular layout line.\n *\n * @param space - The available layout space for the sizers.\n *\n * @returns The delta between the provided available space and the\n * actual consumed space. This value will be zero if the sizers\n * can be adjusted to fit, negative if the available space is too\n * small, and positive if the available space is too large.\n *\n * #### Notes\n * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n *\n * This function can be called at any time to recompute the layout for\n * an existing sequence of sizers. The previously computed results will\n * have no effect on the new output. It is therefore not necessary to\n * create new sizer objects on each resize event.\n */\n export function calc(sizers: ArrayLike, space: number): number {\n // Bail early if there is nothing to do.\n let count = sizers.length;\n if (count === 0) {\n return space;\n }\n\n // Setup the size and stretch counters.\n let totalMin = 0;\n let totalMax = 0;\n let totalSize = 0;\n let totalStretch = 0;\n let stretchCount = 0;\n\n // Setup the sizers and compute the totals.\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n let min = sizer.minSize;\n let max = sizer.maxSize;\n let hint = sizer.sizeHint;\n sizer.done = false;\n sizer.size = Math.max(min, Math.min(hint, max));\n totalSize += sizer.size;\n totalMin += min;\n totalMax += max;\n if (sizer.stretch > 0) {\n totalStretch += sizer.stretch;\n stretchCount++;\n }\n }\n\n // If the space is equal to the total size, return early.\n if (space === totalSize) {\n return 0;\n }\n\n // If the space is less than the total min, minimize each sizer.\n if (space <= totalMin) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.minSize;\n }\n return space - totalMin;\n }\n\n // If the space is greater than the total max, maximize each sizer.\n if (space >= totalMax) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.maxSize;\n }\n return space - totalMax;\n }\n\n // The loops below perform sub-pixel precision sizing. A near zero\n // value is used for compares instead of zero to ensure that the\n // loop terminates when the subdivided space is reasonably small.\n let nearZero = 0.01;\n\n // A counter which is decremented each time a sizer is resized to\n // its limit. This ensures the loops terminate even if there is\n // space remaining to distribute.\n let notDoneCount = count;\n\n // Distribute negative delta space.\n if (space < totalSize) {\n // Shrink each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its min size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = totalSize - space;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n }\n // Distribute positive delta space.\n else {\n // Expand each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its max size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = space - totalSize;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n }\n\n // Indicate that the consumed space equals the available space.\n return 0;\n }\n\n /**\n * Adjust a sizer by a delta and update its neighbors accordingly.\n *\n * @param sizers - The sizers which should be adjusted.\n *\n * @param index - The index of the sizer to grow.\n *\n * @param delta - The amount to adjust the sizer, positive or negative.\n *\n * #### Notes\n * This will adjust the indicated sizer by the specified amount, along\n * with the sizes of the appropriate neighbors, subject to the limits\n * specified by each of the sizers.\n *\n * This is useful when implementing box layouts where the boundaries\n * between the sizers are interactively adjustable by the user.\n */\n export function adjust(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Bail early when there is nothing to do.\n if (sizers.length === 0 || delta === 0) {\n return;\n }\n\n // Dispatch to the proper implementation.\n if (delta > 0) {\n growSizer(sizers, index, delta);\n } else {\n shrinkSizer(sizers, index, -delta);\n }\n }\n\n /**\n * Grow a sizer by a positive delta and adjust neighbors.\n */\n function growSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the left can expand.\n let growLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the right can shrink.\n let shrinkLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the left by the delta.\n let grow = delta;\n for (let i = index; i >= 0 && grow > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the right by the delta.\n let shrink = delta;\n for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n\n /**\n * Shrink a sizer by a positive delta and adjust neighbors.\n */\n function shrinkSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the right can expand.\n let growLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the left can shrink.\n let shrinkLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the right by the delta.\n let grow = delta;\n for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the left by the delta.\n let shrink = delta;\n for (let i = index; i >= 0 && shrink > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n ConflatableMessage,\n IMessageHandler,\n Message,\n MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n /**\n * Construct a new widget.\n *\n * @param options - The options for initializing the widget.\n */\n constructor(options: Widget.IOptions = {}) {\n this.node = Private.createNode(options);\n this.addClass('lm-Widget');\n }\n\n /**\n * Dispose of the widget and its descendant widgets.\n *\n * #### Notes\n * It is unsafe to use the widget after it has been disposed.\n *\n * All calls made to this method after the first are a no-op.\n */\n dispose(): void {\n // Do nothing if the widget is already disposed.\n if (this.isDisposed) {\n return;\n }\n\n // Set the disposed flag and emit the disposed signal.\n this.setFlag(Widget.Flag.IsDisposed);\n this._disposed.emit(undefined);\n\n // Remove or detach the widget if necessary.\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n\n // Dispose of the widget layout.\n if (this._layout) {\n this._layout.dispose();\n this._layout = null;\n }\n\n // Dispose the title\n this.title.dispose();\n\n // Clear the extra data associated with the widget.\n Signal.clearData(this);\n MessageLoop.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * A signal emitted when the widget is disposed.\n */\n get disposed(): ISignal {\n return this._disposed;\n }\n\n /**\n * Get the DOM node owned by the widget.\n */\n readonly node: HTMLElement;\n\n /**\n * Test whether the widget has been disposed.\n */\n get isDisposed(): boolean {\n return this.testFlag(Widget.Flag.IsDisposed);\n }\n\n /**\n * Test whether the widget's node is attached to the DOM.\n */\n get isAttached(): boolean {\n return this.testFlag(Widget.Flag.IsAttached);\n }\n\n /**\n * Test whether the widget is explicitly hidden.\n */\n get isHidden(): boolean {\n return this.testFlag(Widget.Flag.IsHidden);\n }\n\n /**\n * Test whether the widget is visible.\n *\n * #### Notes\n * A widget is visible when it is attached to the DOM, is not\n * explicitly hidden, and has no explicitly hidden ancestors.\n */\n get isVisible(): boolean {\n return this.testFlag(Widget.Flag.IsVisible);\n }\n\n /**\n * The title object for the widget.\n *\n * #### Notes\n * The title object is used by some container widgets when displaying\n * the widget alongside some title, such as a tab panel or side bar.\n *\n * Since not all widgets will use the title, it is created on demand.\n *\n * The `owner` property of the title is set to this widget.\n */\n get title(): Title {\n return Private.titleProperty.get(this);\n }\n\n /**\n * Get the id of the widget's DOM node.\n */\n get id(): string {\n return this.node.id;\n }\n\n /**\n * Set the id of the widget's DOM node.\n */\n set id(value: string) {\n this.node.id = value;\n }\n\n /**\n * The dataset for the widget's DOM node.\n */\n get dataset(): DOMStringMap {\n return this.node.dataset;\n }\n\n /**\n * Get the method for hiding the widget.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding the widget.\n */\n set hiddenMode(value: Widget.HiddenMode) {\n if (this._hiddenMode === value) {\n return;\n }\n\n if (this.isHidden) {\n // Reset styles set by previous mode.\n this._toggleHidden(false);\n }\n\n if (value == Widget.HiddenMode.Scale) {\n this.node.style.willChange = 'transform';\n } else {\n this.node.style.willChange = 'auto';\n }\n\n this._hiddenMode = value;\n\n if (this.isHidden) {\n // Set styles for new mode.\n this._toggleHidden(true);\n }\n }\n\n /**\n * Get the parent of the widget.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent of the widget.\n *\n * #### Notes\n * Children are typically added to a widget by using a layout, which\n * means user code will not normally set the parent widget directly.\n *\n * The widget will be automatically removed from its old parent.\n *\n * This is a no-op if there is no effective parent change.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (value && this.contains(value)) {\n throw new Error('Invalid parent widget.');\n }\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-removed', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n this._parent = value;\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-added', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n if (!this.isDisposed) {\n MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n }\n }\n\n /**\n * Get the layout for the widget.\n */\n get layout(): Layout | null {\n return this._layout;\n }\n\n /**\n * Set the layout for the widget.\n *\n * #### Notes\n * The layout is single-use only. It cannot be changed after the\n * first assignment.\n *\n * The layout is disposed automatically when the widget is disposed.\n */\n set layout(value: Layout | null) {\n if (this._layout === value) {\n return;\n }\n if (this.testFlag(Widget.Flag.DisallowLayout)) {\n throw new Error('Cannot set widget layout.');\n }\n if (this._layout) {\n throw new Error('Cannot change widget layout.');\n }\n if (value!.parent) {\n throw new Error('Cannot change layout parent.');\n }\n this._layout = value;\n value!.parent = this;\n }\n\n /**\n * Create an iterator over the widget's children.\n *\n * @returns A new iterator over the children of the widget.\n *\n * #### Notes\n * The widget must have a populated layout in order to have children.\n *\n * If a layout is not installed, the returned iterator will be empty.\n */\n *children(): IterableIterator {\n if (this._layout) {\n yield* this._layout;\n }\n }\n\n /**\n * Test whether a widget is a descendant of this widget.\n *\n * @param widget - The descendant widget of interest.\n *\n * @returns `true` if the widget is a descendant, `false` otherwise.\n */\n contains(widget: Widget): boolean {\n for (let value: Widget | null = widget; value; value = value._parent) {\n if (value === this) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Test whether the widget's DOM node has the given class name.\n *\n * @param name - The class name of interest.\n *\n * @returns `true` if the node has the class, `false` otherwise.\n */\n hasClass(name: string): boolean {\n return this.node.classList.contains(name);\n }\n\n /**\n * Add a class name to the widget's DOM node.\n *\n * @param name - The class name to add to the node.\n *\n * #### Notes\n * If the class name is already added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n addClass(name: string): void {\n this.node.classList.add(name);\n }\n\n /**\n * Remove a class name from the widget's DOM node.\n *\n * @param name - The class name to remove from the node.\n *\n * #### Notes\n * If the class name is not yet added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n removeClass(name: string): void {\n this.node.classList.remove(name);\n }\n\n /**\n * Toggle a class name on the widget's DOM node.\n *\n * @param name - The class name to toggle on the node.\n *\n * @param force - Whether to force add the class (`true`) or force\n * remove the class (`false`). If not provided, the presence of\n * the class will be toggled from its current state.\n *\n * @returns `true` if the class is now present, `false` otherwise.\n *\n * #### Notes\n * The class name must not contain whitespace.\n */\n toggleClass(name: string, force?: boolean): boolean {\n if (force === true) {\n this.node.classList.add(name);\n return true;\n }\n if (force === false) {\n this.node.classList.remove(name);\n return false;\n }\n return this.node.classList.toggle(name);\n }\n\n /**\n * Post an `'update-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n update(): void {\n MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n }\n\n /**\n * Post a `'fit-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n fit(): void {\n MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n }\n\n /**\n * Post an `'activate-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n activate(): void {\n MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n }\n\n /**\n * Send a `'close-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for sending the message.\n */\n close(): void {\n MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n }\n\n /**\n * Show the widget and make it visible to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `false`.\n *\n * If the widget is not explicitly hidden, this is a no-op.\n */\n show(): void {\n if (!this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n }\n this.clearFlag(Widget.Flag.IsHidden);\n this._toggleHidden(false);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-shown', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Hide the widget and make it hidden to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `true`.\n *\n * If the widget is explicitly hidden, this is a no-op.\n */\n hide(): void {\n if (this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n }\n this.setFlag(Widget.Flag.IsHidden);\n this._toggleHidden(true);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-hidden', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Show or hide the widget according to a boolean value.\n *\n * @param hidden - `true` to hide the widget, or `false` to show it.\n *\n * #### Notes\n * This is a convenience method for `hide()` and `show()`.\n */\n setHidden(hidden: boolean): void {\n if (hidden) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Test whether the given widget flag is set.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n testFlag(flag: Widget.Flag): boolean {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * Set the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n setFlag(flag: Widget.Flag): void {\n this._flags |= flag;\n }\n\n /**\n * Clear the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n clearFlag(flag: Widget.Flag): void {\n this._flags &= ~flag;\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n *\n * #### Notes\n * Subclasses may reimplement this method as needed.\n */\n processMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.notifyLayout(msg);\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.notifyLayout(msg);\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.notifyLayout(msg);\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.notifyLayout(msg);\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.setFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.notifyLayout(msg);\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.clearFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.notifyLayout(msg);\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n this.setFlag(Widget.Flag.IsVisible);\n }\n this.setFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.notifyLayout(msg);\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.clearFlag(Widget.Flag.IsVisible);\n this.clearFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterDetach(msg);\n break;\n case 'activate-request':\n this.notifyLayout(msg);\n this.onActivateRequest(msg);\n break;\n case 'close-request':\n this.notifyLayout(msg);\n this.onCloseRequest(msg);\n break;\n case 'child-added':\n this.notifyLayout(msg);\n this.onChildAdded(msg as Widget.ChildMessage);\n break;\n case 'child-removed':\n this.notifyLayout(msg);\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n default:\n this.notifyLayout(msg);\n break;\n }\n }\n\n /**\n * Invoke the message processing routine of the widget's layout.\n *\n * @param msg - The message to dispatch to the layout.\n *\n * #### Notes\n * This is a no-op if the widget does not have a layout.\n *\n * This will not typically be called directly by user code.\n */\n protected notifyLayout(msg: Message): void {\n if (this._layout) {\n this._layout.processParentMessage(msg);\n }\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n *\n * #### Notes\n * The default implementation unparents or detaches the widget.\n */\n protected onCloseRequest(msg: Message): void {\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onResize(msg: Widget.ResizeMessage): void {}\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onUpdateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onActivateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeShow(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterShow(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeHide(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterHide(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-added'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n private _toggleHidden(hidden: boolean) {\n if (hidden) {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.addClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = 'scale(0)';\n this.node.setAttribute('aria-hidden', 'true');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = 'hidden';\n this.node.style.zIndex = '-1';\n break;\n }\n } else {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.removeClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = '';\n this.node.removeAttribute('aria-hidden');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = '';\n this.node.style.zIndex = '';\n break;\n }\n }\n }\n\n private _flags = 0;\n private _layout: Layout | null = null;\n private _parent: Widget | null = null;\n private _disposed = new Signal(this);\n private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n /**\n * An options object for initializing a widget.\n */\n export interface IOptions {\n /**\n * The optional node to use for the widget.\n *\n * If a node is provided, the widget will assume full ownership\n * and control of the node, as if it had created the node itself.\n *\n * The default is a new `
`.\n */\n node?: HTMLElement;\n\n /**\n * The optional element tag, used for constructing the widget's node.\n *\n * If a pre-constructed node is provided via the `node` arg, this\n * value is ignored.\n */\n tag?: keyof HTMLElementTagNameMap;\n }\n\n /**\n * The method for hiding the widget.\n *\n * The default is Display.\n *\n * Using `Scale` will often increase performance as most browsers will not\n * trigger style computation for the `transform` action. This should be used\n * sparingly and tested, since increasing the number of composition layers\n * may slow things down.\n *\n * To ensure the transformation does not trigger style recomputation, you\n * may need to set the widget CSS style `will-change: transform`. This\n * should be used only when needed as it may overwhelm the browser with a\n * high number of layers. See\n * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n */\n export enum HiddenMode {\n /**\n * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n * CSS from the standard Lumino CSS.\n */\n Display = 0,\n\n /**\n * Hide the widget by setting the `transform` to `'scale(0)'`.\n */\n Scale,\n\n /**\n *Hide the widget by setting the `content-visibility` to `'hidden'`.\n */\n ContentVisibility\n }\n\n /**\n * An enum of widget bit flags.\n */\n export enum Flag {\n /**\n * The widget has been disposed.\n */\n IsDisposed = 0x1,\n\n /**\n * The widget is attached to the DOM.\n */\n IsAttached = 0x2,\n\n /**\n * The widget is hidden.\n */\n IsHidden = 0x4,\n\n /**\n * The widget is visible.\n */\n IsVisible = 0x8,\n\n /**\n * A layout cannot be set on the widget.\n */\n DisallowLayout = 0x10\n }\n\n /**\n * A collection of stateless messages related to widgets.\n */\n export namespace Msg {\n /**\n * A singleton `'before-show'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const BeforeShow = new Message('before-show');\n\n /**\n * A singleton `'after-show'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const AfterShow = new Message('after-show');\n\n /**\n * A singleton `'before-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const BeforeHide = new Message('before-hide');\n\n /**\n * A singleton `'after-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const AfterHide = new Message('after-hide');\n\n /**\n * A singleton `'before-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is attached.\n */\n export const BeforeAttach = new Message('before-attach');\n\n /**\n * A singleton `'after-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is attached.\n */\n export const AfterAttach = new Message('after-attach');\n\n /**\n * A singleton `'before-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is detached.\n */\n export const BeforeDetach = new Message('before-detach');\n\n /**\n * A singleton `'after-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is detached.\n */\n export const AfterDetach = new Message('after-detach');\n\n /**\n * A singleton `'parent-changed'` message.\n *\n * #### Notes\n * This message is sent to a widget when its parent has changed.\n */\n export const ParentChanged = new Message('parent-changed');\n\n /**\n * A singleton conflatable `'update-request'` message.\n *\n * #### Notes\n * This message can be dispatched to supporting widgets in order to\n * update their content based on the current widget state. Not all\n * widgets will respond to messages of this type.\n *\n * For widgets with a layout, this message will inform the layout to\n * update the position and size of its child widgets.\n */\n export const UpdateRequest = new ConflatableMessage('update-request');\n\n /**\n * A singleton conflatable `'fit-request'` message.\n *\n * #### Notes\n * For widgets with a layout, this message will inform the layout to\n * recalculate its size constraints to fit the space requirements of\n * its child widgets, and to update their position and size. Not all\n * layouts will respond to messages of this type.\n */\n export const FitRequest = new ConflatableMessage('fit-request');\n\n /**\n * A singleton conflatable `'activate-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should\n * perform the actions necessary to activate the widget, which\n * may include focusing its node or descendant node.\n */\n export const ActivateRequest = new ConflatableMessage('activate-request');\n\n /**\n * A singleton conflatable `'close-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should close\n * and remove itself from the widget hierarchy.\n */\n export const CloseRequest = new ConflatableMessage('close-request');\n }\n\n /**\n * A message class for child related messages.\n */\n export class ChildMessage extends Message {\n /**\n * Construct a new child message.\n *\n * @param type - The message type.\n *\n * @param child - The child widget for the message.\n */\n constructor(type: string, child: Widget) {\n super(type);\n this.child = child;\n }\n\n /**\n * The child widget for the message.\n */\n readonly child: Widget;\n }\n\n /**\n * A message class for `'resize'` messages.\n */\n export class ResizeMessage extends Message {\n /**\n * Construct a new resize message.\n *\n * @param width - The **offset width** of the widget, or `-1` if\n * the width is not known.\n *\n * @param height - The **offset height** of the widget, or `-1` if\n * the height is not known.\n */\n constructor(width: number, height: number) {\n super('resize');\n this.width = width;\n this.height = height;\n }\n\n /**\n * The offset width of the widget.\n *\n * #### Notes\n * This will be `-1` if the width is unknown.\n */\n readonly width: number;\n\n /**\n * The offset height of the widget.\n *\n * #### Notes\n * This will be `-1` if the height is unknown.\n */\n readonly height: number;\n }\n\n /**\n * The namespace for the `ResizeMessage` class statics.\n */\n export namespace ResizeMessage {\n /**\n * A singleton `'resize'` message with an unknown size.\n */\n export const UnknownSize = new ResizeMessage(-1, -1);\n }\n\n /**\n * Attach a widget to a host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * @param host - The DOM node to use as the widget's host.\n *\n * @param ref - The child of `host` to use as the reference element.\n * If this is provided, the widget will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * widget to be added as the last child of the host.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget, if\n * the widget is already attached, or if the host is not attached\n * to the DOM.\n */\n export function attach(\n widget: Widget,\n host: HTMLElement,\n ref: HTMLElement | null = null\n ): void {\n if (widget.parent) {\n throw new Error('Cannot attach a child widget.');\n }\n if (widget.isAttached || widget.node.isConnected) {\n throw new Error('Widget is already attached.');\n }\n if (!host.isConnected) {\n throw new Error('Host is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n host.insertBefore(widget.node, ref);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n /**\n * Detach the widget from its host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget,\n * or if the widget is not attached to the DOM.\n */\n export function detach(widget: Widget): void {\n if (widget.parent) {\n throw new Error('Cannot detach a child widget.');\n }\n if (!widget.isAttached || !widget.node.isConnected) {\n throw new Error('Widget is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n widget.node.parentNode!.removeChild(widget.node);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An attached property for the widget title object.\n */\n export const titleProperty = new AttachedProperty>({\n name: 'title',\n create: owner => new Title({ owner })\n });\n\n /**\n * Create a DOM node for the given widget options.\n */\n export function createNode(options: Widget.IOptions): HTMLElement {\n return options.node || document.createElement(options.tag || 'div');\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable, IDisposable {\n /**\n * Construct a new layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: Layout.IOptions = {}) {\n this._fitPolicy = options.fitPolicy || 'set-min-size';\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This should be reimplemented to clear and dispose of the widgets.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n this._parent = null;\n this._disposed = true;\n Signal.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * Test whether the layout is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Get the parent widget of the layout.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent widget of the layout.\n *\n * #### Notes\n * This is set automatically when installing the layout on the parent\n * widget. The parent widget should not be set directly by user code.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (this._parent) {\n throw new Error('Cannot change parent widget.');\n }\n if (value!.layout !== this) {\n throw new Error('Invalid parent widget.');\n }\n this._parent = value;\n this.init();\n }\n\n /**\n * Get the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n get fitPolicy(): Layout.FitPolicy {\n return this._fitPolicy;\n }\n\n /**\n * Set the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n *\n * Changing the fit policy will clear the current size constraint\n * for the parent widget and then re-fit the parent.\n */\n set fitPolicy(value: Layout.FitPolicy) {\n // Bail if the policy does not change\n if (this._fitPolicy === value) {\n return;\n }\n\n // Update the internal policy.\n this._fitPolicy = value;\n\n // Clear the size constraints and schedule a fit of the parent.\n if (this._parent) {\n let style = this._parent.node.style;\n style.minWidth = '';\n style.minHeight = '';\n style.maxWidth = '';\n style.maxHeight = '';\n this._parent.fit();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This abstract method must be implemented by a subclass.\n */\n abstract [Symbol.iterator](): IterableIterator;\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method should *not* modify the widget's `parent`.\n */\n abstract removeWidget(widget: Widget): void;\n\n /**\n * Process a message sent to the parent widget.\n *\n * @param msg - The message sent to the parent widget.\n *\n * #### Notes\n * This method is called by the parent widget to process a message.\n *\n * Subclasses may reimplement this method as needed.\n */\n processParentMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.onAfterDetach(msg);\n break;\n case 'child-removed':\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n case 'child-shown':\n this.onChildShown(msg as Widget.ChildMessage);\n break;\n case 'child-hidden':\n this.onChildHidden(msg as Widget.ChildMessage);\n break;\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n *\n * #### Notes\n * This method is invoked immediately after the layout is installed\n * on the parent widget.\n *\n * The default implementation reparents all of the widgets to the\n * layout parent widget.\n *\n * Subclasses should reimplement this method and attach the child\n * widget nodes to the parent widget's node.\n */\n protected init(): void {\n for (const widget of this) {\n widget.parent = this.parent;\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the specified layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the available layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onUpdateRequest(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * This will remove the child widget from the layout.\n *\n * Subclasses should **not** typically reimplement this method.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n this.removeWidget(msg.child);\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n private _disposed = false;\n private _fitPolicy: Layout.FitPolicy;\n private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n /**\n * A type alias for the layout fit policy.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n export type FitPolicy =\n | /**\n * No size constraint will be applied to the parent widget.\n */\n 'set-no-constraint'\n\n /**\n * The computed min size will be applied to the parent widget.\n */\n | 'set-min-size';\n\n /**\n * An options object for initializing a layout.\n */\n export interface IOptions {\n /**\n * The fit policy for the layout.\n *\n * The default is `'set-min-size'`.\n */\n fitPolicy?: FitPolicy;\n }\n\n /**\n * A type alias for the horizontal alignment of a widget.\n */\n export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n /**\n * A type alias for the vertical alignment of a widget.\n */\n export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n /**\n * Get the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The horizontal alignment for the widget.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n */\n export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n return Private.horizontalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the horizontal alignment.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setHorizontalAlignment(\n widget: Widget,\n value: HorizontalAlignment\n ): void {\n Private.horizontalAlignmentProperty.set(widget, value);\n }\n\n /**\n * Get the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The vertical alignment for the widget.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n */\n export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n return Private.verticalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the vertical alignment.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setVerticalAlignment(\n widget: Widget,\n value: VerticalAlignment\n ): void {\n Private.verticalAlignmentProperty.set(widget, value);\n }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n /**\n * Construct a new layout item.\n *\n * @param widget - The widget to be managed by the item.\n *\n * #### Notes\n * The widget will be set to absolute positioning.\n * The widget will use strict CSS containment.\n */\n constructor(widget: Widget) {\n this.widget = widget;\n this.widget.node.style.position = 'absolute';\n this.widget.node.style.contain = 'strict';\n }\n\n /**\n * Dispose of the the layout item.\n *\n * #### Notes\n * This will reset the positioning of the widget.\n */\n dispose(): void {\n // Do nothing if the item is already disposed.\n if (this._disposed) {\n return;\n }\n\n // Mark the item as disposed.\n this._disposed = true;\n\n // Reset the widget style.\n let style = this.widget.node.style;\n style.position = '';\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n style.contain = '';\n }\n\n /**\n * The widget managed by the layout item.\n */\n readonly widget: Widget;\n\n /**\n * The computed minimum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minWidth(): number {\n return this._minWidth;\n }\n\n /**\n * The computed minimum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minHeight(): number {\n return this._minHeight;\n }\n\n /**\n * The computed maximum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxWidth(): number {\n return this._maxWidth;\n }\n\n /**\n * The computed maximum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxHeight(): number {\n return this._maxHeight;\n }\n\n /**\n * Whether the layout item is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Whether the managed widget is hidden.\n */\n get isHidden(): boolean {\n return this.widget.isHidden;\n }\n\n /**\n * Whether the managed widget is visible.\n */\n get isVisible(): boolean {\n return this.widget.isVisible;\n }\n\n /**\n * Whether the managed widget is attached.\n */\n get isAttached(): boolean {\n return this.widget.isAttached;\n }\n\n /**\n * Update the computed size limits of the managed widget.\n */\n fit(): void {\n let limits = ElementExt.sizeLimits(this.widget.node);\n this._minWidth = limits.minWidth;\n this._minHeight = limits.minHeight;\n this._maxWidth = limits.maxWidth;\n this._maxHeight = limits.maxHeight;\n }\n\n /**\n * Update the position and size of the managed widget.\n *\n * @param left - The left edge position of the layout box.\n *\n * @param top - The top edge position of the layout box.\n *\n * @param width - The width of the layout box.\n *\n * @param height - The height of the layout box.\n */\n update(left: number, top: number, width: number, height: number): void {\n // Clamp the size to the computed size limits.\n let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n // Adjust the left edge for the horizontal alignment, if needed.\n if (clampW < width) {\n switch (Layout.getHorizontalAlignment(this.widget)) {\n case 'left':\n break;\n case 'center':\n left += (width - clampW) / 2;\n break;\n case 'right':\n left += width - clampW;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Adjust the top edge for the vertical alignment, if needed.\n if (clampH < height) {\n switch (Layout.getVerticalAlignment(this.widget)) {\n case 'top':\n break;\n case 'center':\n top += (height - clampH) / 2;\n break;\n case 'bottom':\n top += height - clampH;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Set up the resize variables.\n let resized = false;\n let style = this.widget.node.style;\n\n // Update the top edge of the widget if needed.\n if (this._top !== top) {\n this._top = top;\n style.top = `${top}px`;\n }\n\n // Update the left edge of the widget if needed.\n if (this._left !== left) {\n this._left = left;\n style.left = `${left}px`;\n }\n\n // Update the width of the widget if needed.\n if (this._width !== clampW) {\n resized = true;\n this._width = clampW;\n style.width = `${clampW}px`;\n }\n\n // Update the height of the widget if needed.\n if (this._height !== clampH) {\n resized = true;\n this._height = clampH;\n style.height = `${clampH}px`;\n }\n\n // Send a resize message to the widget if needed.\n if (resized) {\n let msg = new Widget.ResizeMessage(clampW, clampH);\n MessageLoop.sendMessage(this.widget, msg);\n }\n }\n\n private _top = NaN;\n private _left = NaN;\n private _width = NaN;\n private _height = NaN;\n private _minWidth = 0;\n private _minHeight = 0;\n private _maxWidth = Infinity;\n private _maxHeight = Infinity;\n private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The attached property for a widget horizontal alignment.\n */\n export const horizontalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.HorizontalAlignment\n >({\n name: 'horizontalAlignment',\n create: () => 'center',\n changed: onAlignmentChanged\n });\n\n /**\n * The attached property for a widget vertical alignment.\n */\n export const verticalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.VerticalAlignment\n >({\n name: 'verticalAlignment',\n create: () => 'top',\n changed: onAlignmentChanged\n });\n\n /**\n * The change handler for the attached alignment properties.\n */\n function onAlignmentChanged(child: Widget): void {\n if (child.parent && child.parent.layout) {\n child.parent.update();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n /**\n * Clamp a dimension value to an integer >= 0.\n */\n export function clampDimension(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title implements IDisposable {\n /**\n * Construct a new title.\n *\n * @param options - The options for initializing the title.\n */\n constructor(options: Title.IOptions) {\n this.owner = options.owner;\n if (options.label !== undefined) {\n this._label = options.label;\n }\n if (options.mnemonic !== undefined) {\n this._mnemonic = options.mnemonic;\n }\n if (options.icon !== undefined) {\n this._icon = options.icon;\n }\n\n if (options.iconClass !== undefined) {\n this._iconClass = options.iconClass;\n }\n if (options.iconLabel !== undefined) {\n this._iconLabel = options.iconLabel;\n }\n if (options.caption !== undefined) {\n this._caption = options.caption;\n }\n if (options.className !== undefined) {\n this._className = options.className;\n }\n if (options.closable !== undefined) {\n this._closable = options.closable;\n }\n this._dataset = options.dataset || {};\n }\n\n /**\n * A signal emitted when the state of the title changes.\n */\n get changed(): ISignal {\n return this._changed;\n }\n\n /**\n * The object which owns the title.\n */\n readonly owner: T;\n\n /**\n * Get the label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get label(): string {\n return this._label;\n }\n\n /**\n * Set the label for the title.\n */\n set label(value: string) {\n if (this._label === value) {\n return;\n }\n this._label = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the mnemonic index for the title.\n *\n * #### Notes\n * The default value is `-1`.\n */\n get mnemonic(): number {\n return this._mnemonic;\n }\n\n /**\n * Set the mnemonic index for the title.\n */\n set mnemonic(value: number) {\n if (this._mnemonic === value) {\n return;\n }\n this._mnemonic = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon renderer for the title.\n *\n * #### Notes\n * The default value is undefined.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._icon;\n }\n\n /**\n * Set the icon renderer for the title.\n *\n * #### Notes\n * A renderer is an object that supplies a render and unrender function.\n */\n set icon(value: VirtualElement.IRenderer | undefined) {\n if (this._icon === value) {\n return;\n }\n this._icon = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconClass(): string {\n return this._iconClass;\n }\n\n /**\n * Set the icon class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconClass(value: string) {\n if (this._iconClass === value) {\n return;\n }\n this._iconClass = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconLabel(): string {\n return this._iconLabel;\n }\n\n /**\n * Set the icon label for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconLabel(value: string) {\n if (this._iconLabel === value) {\n return;\n }\n this._iconLabel = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the caption for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get caption(): string {\n return this._caption;\n }\n\n /**\n * Set the caption for the title.\n */\n set caption(value: string) {\n if (this._caption === value) {\n return;\n }\n this._caption = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the extra class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get className(): string {\n return this._className;\n }\n\n /**\n * Set the extra class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set className(value: string) {\n if (this._className === value) {\n return;\n }\n this._className = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the closable state for the title.\n *\n * #### Notes\n * The default value is `false`.\n */\n get closable(): boolean {\n return this._closable;\n }\n\n /**\n * Set the closable state for the title.\n *\n * #### Notes\n * This controls the presence of a close icon when applicable.\n */\n set closable(value: boolean) {\n if (this._closable === value) {\n return;\n }\n this._closable = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the dataset for the title.\n *\n * #### Notes\n * The default value is an empty dataset.\n */\n get dataset(): Title.Dataset {\n return this._dataset;\n }\n\n /**\n * Set the dataset for the title.\n *\n * #### Notes\n * This controls the data attributes when applicable.\n */\n set dataset(value: Title.Dataset) {\n if (this._dataset === value) {\n return;\n }\n this._dataset = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Test whether the title has been disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the title.\n *\n * #### Notes\n * It is the responsibility of the owner to call the title disposal.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n\n Signal.clearData(this);\n }\n\n private _label = '';\n private _caption = '';\n private _mnemonic = -1;\n private _icon: VirtualElement.IRenderer | undefined = undefined;\n private _iconClass = '';\n private _iconLabel = '';\n private _className = '';\n private _closable = false;\n private _dataset: Title.Dataset;\n private _changed = new Signal(this);\n private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n /**\n * A type alias for a simple immutable string dataset.\n */\n export type Dataset = { readonly [key: string]: string };\n\n /**\n * An options object for initializing a title.\n */\n export interface IOptions {\n /**\n * The object which owns the title.\n */\n owner: T;\n\n /**\n * The label for the title.\n */\n label?: string;\n\n /**\n * The mnemonic index for the title.\n */\n mnemonic?: number;\n\n /**\n * The icon renderer for the title.\n */\n icon?: VirtualElement.IRenderer;\n\n /**\n * The icon class name for the title.\n */\n iconClass?: string;\n\n /**\n * The icon label for the title.\n */\n iconLabel?: string;\n\n /**\n * The caption for the title.\n */\n caption?: string;\n\n /**\n * The extra class name for the title.\n */\n className?: string;\n\n /**\n * The closable state for the title.\n */\n closable?: boolean;\n\n /**\n * The dataset for the title.\n */\n dataset?: Dataset;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n while (this._widgets.length > 0) {\n this._widgets.pop()!.dispose();\n }\n super.dispose();\n }\n\n /**\n * A read-only array of the widgets in the layout.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n yield* this._widgets;\n }\n\n /**\n * Add a widget to the end of the layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, it will be moved.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this._widgets.length, widget);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n widget.parent = this.parent;\n\n // Look up the current index of the widget.\n let i = this._widgets.indexOf(widget);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._widgets.length));\n\n // If the widget is not in the array, insert it.\n if (i === -1) {\n // Insert the widget into the array.\n ArrayExt.insert(this._widgets, j, widget);\n\n // If the layout is parented, attach the widget to the DOM.\n if (this.parent) {\n this.attachWidget(j, widget);\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the widget exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._widgets.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the widget to the new location.\n ArrayExt.move(this._widgets, i, j);\n\n // If the layout is parented, move the widget in the DOM.\n if (this.parent) {\n this.moveWidget(i, j, widget);\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n this.removeWidgetAt(this._widgets.indexOf(widget));\n }\n\n /**\n * Remove the widget at a given index from the layout.\n *\n * @param index - The index of the widget to remove.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n removeWidgetAt(index: number): void {\n // Remove the widget from the array.\n let widget = ArrayExt.removeAt(this._widgets, index);\n\n // If the layout is parented, detach the widget from the DOM.\n if (widget && this.parent) {\n this.detachWidget(index, widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n let index = 0;\n for (const widget of this) {\n this.attachWidget(index++, widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[index];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation moves the widget's node to the proper\n * location in the parent's node and sends the appropriate attach and\n * detach messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is moved in the parent's node.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` and message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[toIndex];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widgets: Widget[] = [];\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n /**\n * Construct a new split layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: SplitLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.orientation !== undefined) {\n this._orientation = options.orientation;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n this._handles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the split layout.\n */\n readonly renderer: SplitLayout.IRenderer;\n\n /**\n * Get the layout orientation for the split layout.\n */\n get orientation(): SplitLayout.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the layout orientation for the split layout.\n */\n set orientation(value: SplitLayout.Orientation) {\n if (this._orientation === value) {\n return;\n }\n this._orientation = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['orientation'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n get alignment(): SplitLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n set alignment(value: SplitLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the split layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the split layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the split handles in the layout.\n */\n get handles(): ReadonlyArray {\n return this._handles;\n }\n\n /**\n * Get the absolute sizes of the widgets in the layout.\n *\n * @returns A new array of the absolute sizes of the widgets.\n *\n * This method **does not** measure the DOM nodes.\n */\n absoluteSizes(): number[] {\n return this._sizers.map(sizer => sizer.size);\n }\n\n /**\n * Get the relative sizes of the widgets in the layout.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return Private.normalize(this._sizers.map(sizer => sizer.size));\n }\n\n /**\n * Set the relative sizes for the widgets in the layout.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n // Copy the sizes and pad with zeros as needed.\n let n = this._sizers.length;\n let temp = sizes.slice(0, n);\n while (temp.length < n) {\n temp.push(0);\n }\n\n // Normalize the padded sizes.\n let normed = Private.normalize(temp);\n\n // Apply the normalized sizes to the sizers.\n for (let i = 0; i < n; ++i) {\n let sizer = this._sizers[i];\n sizer.sizeHint = normed[i];\n sizer.size = normed[i];\n }\n\n // Set the flag indicating the sizes are normalized.\n this._hasNormedSizes = true;\n\n // Trigger an update of the parent widget.\n if (update && this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Move the offset position of a split handle.\n *\n * @param index - The index of the handle of the interest.\n *\n * @param position - The desired offset position of the handle.\n *\n * #### Notes\n * The position is relative to the offset parent.\n *\n * This will move the handle as close as possible to the desired\n * position. The sibling widgets will be adjusted as necessary.\n */\n moveHandle(index: number, position: number): void {\n // Bail if the index is invalid or the handle is hidden.\n let handle = this._handles[index];\n if (!handle || handle.classList.contains('lm-mod-hidden')) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (this._orientation === 'horizontal') {\n delta = position - handle.offsetLeft;\n } else {\n delta = position - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent widget resizing unless needed.\n for (let sizer of this._sizers) {\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(this._sizers, index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['orientation'] = this.orientation;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create the item, handle, and sizer for the new widget.\n let item = new LayoutItem(widget);\n let handle = Private.createHandle(this.renderer);\n let average = Private.averageSize(this._sizers);\n let sizer = Private.createSizer(average);\n\n // Insert the item, handle, and sizer into the internal arrays.\n ArrayExt.insert(this._items, index, item);\n ArrayExt.insert(this._sizers, index, sizer);\n ArrayExt.insert(this._handles, index, handle);\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget and handle nodes to the parent.\n this.parent!.node.appendChild(widget.node);\n this.parent!.node.appendChild(handle);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the item, sizer, and handle for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n ArrayExt.move(this._handles, fromIndex, toIndex);\n\n // Post a fit request to the parent to show/hide last handle.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the item, handle, and sizer for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n let handle = ArrayExt.removeAt(this._handles, index);\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget and handle nodes from the parent.\n this.parent!.node.removeChild(widget.node);\n this.parent!.node.removeChild(handle!);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const item = this._items[i];\n if (item.isHidden) {\n return;\n }\n\n // Fetch the style for the handle.\n let handleStyle = this._handles[i].style;\n\n // Update the widget and handle, and advance the relevant edge.\n if (isHorizontal) {\n left += this.widgetOffset;\n item.update(left, top, size, height);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${this._spacing}px`;\n handleStyle.height = `${height}px`;\n } else {\n top += this.widgetOffset;\n item.update(left, top, width, size);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${this._spacing}px`;\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Update the handles and track the visible widget count.\n let nVisible = 0;\n let lastHandleIndex = -1;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n if (this._items[i].isHidden) {\n this._handles[i].classList.add('lm-mod-hidden');\n } else {\n this._handles[i].classList.remove('lm-mod-hidden');\n lastHandleIndex = i;\n nVisible++;\n }\n }\n\n // Hide the handle for the last visible widget.\n if (lastHandleIndex !== -1) {\n this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n }\n\n // Update the fixed space for the visible items.\n this._fixed =\n this._spacing * Math.max(0, nVisible - 1) +\n this.widgetOffset * this._items.length;\n\n // Setup the computed minimum size.\n let horz = this._orientation === 'horizontal';\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed size limits.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // Prevent resizing unless necessary.\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the stretch factor.\n sizer.stretch = SplitLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0 && this.widgetOffset === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Set up the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n let horz = this._orientation === 'horizontal';\n\n if (nVisible > 0) {\n // Compute the adjusted layout space.\n let space: number;\n if (horz) {\n // left += this.widgetOffset;\n space = Math.max(0, width - this._fixed);\n } else {\n // top += this.widgetOffset;\n space = Math.max(0, height - this._fixed);\n }\n\n // Scale the size hints if they are normalized.\n if (this._hasNormedSizes) {\n for (let sizer of this._sizers) {\n sizer.sizeHint *= space;\n }\n this._hasNormedSizes = false;\n }\n\n // Distribute the layout space to the box sizers.\n let delta = BoxEngine.calc(this._sizers, space);\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n const item = this._items[i];\n\n // Fetch the computed size for the widget.\n const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n this.updateItemPosition(\n i,\n horz,\n horz ? left + offset : left,\n horz ? top : top + offset,\n height,\n width,\n size\n );\n\n const fullOffset =\n this.widgetOffset +\n (this._handles[i].classList.contains('lm-mod-hidden')\n ? 0\n : this._spacing);\n\n if (horz) {\n left += size + fullOffset;\n } else {\n top += size + fullOffset;\n }\n }\n }\n\n protected widgetOffset = 0;\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _hasNormedSizes = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _handles: HTMLDivElement[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: SplitLayout.Alignment = 'start';\n private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n /**\n * A type alias for a split layout orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a split layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a split layout.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split layout.\n */\n renderer: IRenderer;\n\n /**\n * The orientation of the layout.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a split layout.\n */\n export interface IRenderer {\n /**\n * Create a new handle for use with a split layout.\n *\n * @returns A new handle element.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * Get the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Create a new box sizer with the given size hint.\n */\n export function createSizer(size: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = Math.floor(size);\n return sizer;\n }\n\n /**\n * Create a new split handle node using the given renderer.\n */\n export function createHandle(\n renderer: SplitLayout.IRenderer\n ): HTMLDivElement {\n let handle = renderer.createHandle();\n handle.style.position = 'absolute';\n // Do not use size containment to allow the handle to fill the available space\n handle.style.contain = 'style';\n return handle;\n }\n\n /**\n * Compute the average size of an array of box sizers.\n */\n export function averageSize(sizers: BoxSizer[]): number {\n return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n }\n\n /**\n * Normalize an array of values.\n */\n export function normalize(values: number[]): number[] {\n let n = values.length;\n if (n === 0) {\n return [];\n }\n let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof SplitLayout) {\n child.parent.fit();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n /**\n * Construct a new accordion layout.\n *\n * @param options - The options for initializing the layout.\n *\n * #### Notes\n * The default orientation will be vertical.\n *\n * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n */\n constructor(options: AccordionLayout.IOptions) {\n super({ ...options, orientation: options.orientation || 'vertical' });\n this.titleSpace = options.titleSpace || 22;\n }\n\n /**\n * The section title height or width depending on the orientation.\n */\n get titleSpace(): number {\n return this.widgetOffset;\n }\n set titleSpace(value: number) {\n value = Utils.clampDimension(value);\n if (this.widgetOffset === value) {\n return;\n }\n this.widgetOffset = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return this._titles;\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n\n // Clear the layout state.\n this._titles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the accordion layout.\n */\n readonly renderer: AccordionLayout.IRenderer;\n\n public updateTitle(index: number, widget: Widget): void {\n const oldTitle = this._titles[index];\n const expanded = oldTitle.classList.contains('lm-mod-expanded');\n const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n this._titles[index] = newTitle;\n\n // Add the title node to the parent before the widget.\n this.parent!.node.replaceChild(newTitle, oldTitle);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n if (!widget.id) {\n widget.id = `id-${UUID.uuid4()}`;\n }\n super.insertWidget(index, widget);\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(index: number, widget: Widget): void {\n const title = Private.createTitle(this.renderer, widget.title);\n\n ArrayExt.insert(this._titles, index, title);\n\n // Add the title node to the parent before the widget.\n this.parent!.node.appendChild(title);\n\n widget.node.setAttribute('role', 'region');\n widget.node.setAttribute('aria-labelledby', title.id);\n\n super.attachWidget(index, widget);\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n ArrayExt.move(this._titles, fromIndex, toIndex);\n super.moveWidget(fromIndex, toIndex, widget);\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n const title = ArrayExt.removeAt(this._titles, index);\n\n this.parent!.node.removeChild(title!);\n\n super.detachWidget(index, widget);\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const titleStyle = this._titles[i].style;\n\n // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n titleStyle.top = `${top}px`;\n titleStyle.left = `${left}px`;\n titleStyle.height = `${this.widgetOffset}px`;\n if (isHorizontal) {\n titleStyle.width = `${height}px`;\n } else {\n titleStyle.width = `${width}px`;\n }\n\n super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n }\n\n private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n /**\n * A type alias for a accordion layout orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion layout alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * An options object for initializing a accordion layout.\n */\n export interface IOptions extends SplitLayout.IOptions {\n /**\n * The renderer to use for the accordion layout.\n */\n renderer: IRenderer;\n\n /**\n * The section title height or width depending on the orientation.\n *\n * The default is `22`.\n */\n titleSpace?: number;\n }\n\n /**\n * A renderer for use with an accordion layout.\n */\n export interface IRenderer extends SplitLayout.IRenderer {\n /**\n * Common class name for all accordion titles.\n */\n readonly titleClassName: string;\n\n /**\n * Render the element for a section title.\n *\n * @param title - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(title: Title): HTMLElement;\n }\n}\n\nnamespace Private {\n /**\n * Create the title HTML element.\n *\n * @param renderer Accordion renderer\n * @param data Widget title\n * @returns Title HTML element\n */\n export function createTitle(\n renderer: AccordionLayout.IRenderer,\n data: Title,\n expanded: boolean = true\n ): HTMLElement {\n const title = renderer.createSectionTitle(data);\n title.style.position = 'absolute';\n title.style.contain = 'strict';\n title.setAttribute('aria-label', `${data.label} Section`);\n title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n title.setAttribute('aria-controls', data.owner.id);\n if (expanded) {\n title.classList.add('lm-mod-expanded');\n }\n return title;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n /**\n * Construct a new panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: Panel.IOptions = {}) {\n super();\n this.addClass('lm-Panel');\n this.layout = Private.createLayout(options);\n }\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return (this.layout as PanelLayout).widgets;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n (this.layout as PanelLayout).addWidget(widget);\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n (this.layout as PanelLayout).insertWidget(index, widget);\n }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n /**\n * An options object for creating a panel.\n */\n export interface IOptions {\n /**\n * The panel layout to use for the panel.\n *\n * The default is a new `PanelLayout`.\n */\n layout?: PanelLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a panel layout for the given panel options.\n */\n export function createLayout(options: Panel.IOptions): PanelLayout {\n return options.layout || new PanelLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n /**\n * Construct a new split panel.\n *\n * @param options - The options for initializing the split panel.\n */\n constructor(options: SplitPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-SplitPanel');\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n this._releaseMouse();\n super.dispose();\n }\n\n /**\n * Get the layout orientation for the split panel.\n */\n get orientation(): SplitPanel.Orientation {\n return (this.layout as SplitLayout).orientation;\n }\n\n /**\n * Set the layout orientation for the split panel.\n */\n set orientation(value: SplitPanel.Orientation) {\n (this.layout as SplitLayout).orientation = value;\n }\n\n /**\n * Get the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n get alignment(): SplitPanel.Alignment {\n return (this.layout as SplitLayout).alignment;\n }\n\n /**\n * Set the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n set alignment(value: SplitPanel.Alignment) {\n (this.layout as SplitLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the split panel.\n */\n get spacing(): number {\n return (this.layout as SplitLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the split panel.\n */\n set spacing(value: number) {\n (this.layout as SplitLayout).spacing = value;\n }\n\n /**\n * The renderer used by the split panel.\n */\n get renderer(): SplitPanel.IRenderer {\n return (this.layout as SplitLayout).renderer;\n }\n\n /**\n * A signal emitted when a split handle has moved.\n */\n get handleMoved(): ISignal {\n return this._handleMoved;\n }\n\n /**\n * A read-only array of the split handles in the panel.\n */\n get handles(): ReadonlyArray {\n return (this.layout as SplitLayout).handles;\n }\n\n /**\n * Get the relative sizes of the widgets in the panel.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return (this.layout as SplitLayout).relativeSizes();\n }\n\n /**\n * Set the relative sizes for the widgets in the panel.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n }\n\n /**\n * Handle the DOM events for the split panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * Handle the `'keydown'` event for the split panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n if (this._pressData) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the split panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the primary button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the target, if any.\n let layout = this.layout as SplitLayout;\n let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n return handle.contains(event.target as HTMLElement);\n });\n\n // Bail early if the mouse press was not on a handle.\n if (index === -1) {\n return;\n }\n\n // Stop the event when a split handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n document.addEventListener('pointerup', this, true);\n document.addEventListener('pointermove', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Compute the offset delta for the handle press.\n let delta: number;\n let handle = layout.handles[index];\n let rect = handle.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n delta = event.clientX - rect.left;\n } else {\n delta = event.clientY - rect.top;\n }\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!);\n this._pressData = { index, delta, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the split panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Stop the event when dragging a split handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let pos: number;\n let layout = this.layout as SplitLayout;\n let rect = this.node.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n pos = event.clientX - rect.left - this._pressData!.delta;\n } else {\n pos = event.clientY - rect.top - this._pressData!.delta;\n }\n\n // Move the handle as close to the desired position as possible.\n layout.moveHandle(this._pressData!.index, pos);\n }\n\n /**\n * Handle the `'pointerup'` event for the split panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the primary button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse grab for the split panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Emit the handle moved signal.\n this._handleMoved.emit();\n\n // Remove the extra document listeners.\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('pointerup', this, true);\n document.removeEventListener('pointermove', this, true);\n document.removeEventListener('contextmenu', this, true);\n }\n\n private _handleMoved = new Signal(this);\n private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n /**\n * A type alias for a split panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a split panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a split panel renderer.\n */\n export type IRenderer = SplitLayout.IRenderer;\n\n /**\n * An options object for initializing a split panel.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The layout orientation of the panel.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The split layout to use for the split panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `SplitLayout`.\n */\n layout?: SplitLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new handle for use with a split panel.\n *\n * @returns A new handle element for a split panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-SplitPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * Get the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return SplitLayout.getStretch(widget);\n }\n\n /**\n * Set the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n SplitLayout.setStretch(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The index of the pressed handle.\n */\n index: number;\n\n /**\n * The offset of the press in handle coordinates.\n */\n delta: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * Create a split layout for the given panel options.\n */\n export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n return (\n options.layout ||\n new SplitLayout({\n renderer: options.renderer || SplitPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n */\nexport class AccordionPanel extends SplitPanel {\n /**\n * Construct a new accordion panel.\n *\n * @param options - The options for initializing the accordion panel.\n */\n constructor(options: AccordionPanel.IOptions = {}) {\n super({ ...options, layout: Private.createLayout(options) });\n this.addClass('lm-AccordionPanel');\n }\n\n /**\n * The renderer used by the accordion panel.\n */\n get renderer(): AccordionPanel.IRenderer {\n return (this.layout as AccordionLayout).renderer;\n }\n\n /**\n * The section title space.\n *\n * This is the height if the panel is vertical and the width if it is\n * horizontal.\n */\n get titleSpace(): number {\n return (this.layout as AccordionLayout).titleSpace;\n }\n set titleSpace(value: number) {\n (this.layout as AccordionLayout).titleSpace = value;\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return (this.layout as AccordionLayout).titles;\n }\n\n /**\n * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n */\n get expansionToggled(): ISignal {\n return this._expansionToggled;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n super.addWidget(widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Collapse the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n collapse(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && !widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Expand the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n expand(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n super.insertWidget(index, widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Handle the DOM events for the accordion panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n super.handleEvent(event);\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._eventKeyDown(event as KeyboardEvent);\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n super.onBeforeAttach(msg);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n super.onAfterDetach(msg);\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n return widget.contains(sender.owner);\n });\n\n if (index >= 0) {\n (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n this.update();\n }\n }\n\n /**\n * Compute the size of widgets in this panel on the title click event.\n * On closing, the size of the widget is cached and we will try to expand\n * the last opened widget.\n * On opening, we will use the cached size if it is available to restore the\n * widget.\n * In both cases, if we can not compute the size of widgets, we will let\n * `SplitLayout` decide.\n *\n * @param index - The index of widget to be opened of closed\n *\n * @returns Relative size of widgets in this panel, if this size can\n * not be computed, return `undefined`\n */\n private _computeWidgetSize(index: number): number[] | undefined {\n const layout = this.layout as AccordionLayout;\n\n const widget = layout.widgets[index];\n if (!widget) {\n return undefined;\n }\n const isHidden = widget.isHidden;\n const widgetSizes = layout.absoluteSizes();\n const delta = (isHidden ? -1 : 1) * this.spacing;\n const totalSize = widgetSizes.reduce(\n (prev: number, curr: number) => prev + curr\n );\n\n let newSize = [...widgetSizes];\n\n if (!isHidden) {\n // Hide the widget\n const currentSize = widgetSizes[index];\n\n this._widgetSizesCache.set(widget, currentSize);\n newSize[index] = 0;\n\n const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // All widget are closed, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n\n newSize[widgetToCollapse] =\n widgetSizes[widgetToCollapse] + currentSize + delta;\n } else {\n // Show the widget\n const previousSize = this._widgetSizesCache.get(widget);\n if (!previousSize) {\n // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n newSize[index] += previousSize;\n\n const widgetToCollapse = newSize\n .map(sz => sz - previousSize > 0)\n .lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // Can not reduce the size of one widget, reduce all opened widgets\n // proportionally with its size.\n newSize.forEach((_, idx) => {\n if (idx !== index) {\n newSize[idx] -=\n (widgetSizes[idx] / totalSize) * (previousSize - delta);\n }\n });\n } else {\n newSize[widgetToCollapse] -= previousSize - delta;\n }\n }\n return newSize.map(sz => sz / (totalSize + delta));\n }\n /**\n * Handle the `'click'` event for the accordion panel\n */\n private _evtClick(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this._toggleExpansion(index);\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the accordion panel.\n */\n private _eventKeyDown(event: KeyboardEvent): void {\n if (event.defaultPrevented) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n let handled = false;\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n const keyCode = event.keyCode.toString();\n\n // If Space or Enter is pressed on title, emulate click event\n if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n target.click();\n handled = true;\n } else if (\n this.orientation === 'horizontal'\n ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n ) {\n // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n const direction =\n event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n ? -1\n : 1;\n const length = this.titles.length;\n const newIndex = (index + length + direction) % length;\n\n this.titles[newIndex].focus();\n handled = true;\n } else if (event.key === 'End' || keyCode === '35') {\n // If End is pressed on title, focus on the last title\n this.titles[this.titles.length - 1].focus();\n handled = true;\n } else if (event.key === 'Home' || keyCode === '36') {\n // If Home is pressed on title, focus on the first title\n this.titles[0].focus();\n handled = true;\n }\n }\n\n if (handled) {\n event.preventDefault();\n }\n }\n }\n\n private _toggleExpansion(index: number) {\n const title = this.titles[index];\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n const newSize = this._computeWidgetSize(index);\n if (newSize) {\n this.setRelativeSizes(newSize, false);\n }\n\n if (widget.isHidden) {\n title.classList.add('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'true');\n widget.show();\n } else {\n title.classList.remove('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'false');\n widget.hide();\n }\n\n // Emit the expansion state signal.\n this._expansionToggled.emit(index);\n }\n\n private _widgetSizesCache: WeakMap = new WeakMap();\n private _expansionToggled = new Signal(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n /**\n * A type alias for a accordion panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a accordion panel renderer.\n */\n export type IRenderer = AccordionLayout.IRenderer;\n\n /**\n * An options object for initializing a accordion panel.\n */\n export interface IOptions extends Partial {\n /**\n * The accordion layout to use for the accordion panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `AccordionLayout`.\n */\n layout?: AccordionLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer extends SplitPanel.Renderer implements IRenderer {\n constructor() {\n super();\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches any title node in the accordion.\n */\n readonly titleClassName = 'lm-AccordionPanel-title';\n\n /**\n * Render the collapse indicator for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the collapse indicator.\n */\n createCollapseIcon(data: Title): HTMLElement {\n return document.createElement('span');\n }\n\n /**\n * Render the element for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(data: Title): HTMLElement {\n const handle = document.createElement('h3');\n handle.setAttribute('tabindex', '0');\n handle.id = this.createTitleKey(data);\n handle.className = this.titleClassName;\n for (const aData in data.dataset) {\n handle.dataset[aData] = data.dataset[aData];\n }\n\n const collapser = handle.appendChild(this.createCollapseIcon(data));\n collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n const label = handle.appendChild(document.createElement('span'));\n label.className = 'lm-AccordionPanel-titleLabel';\n label.textContent = data.label;\n label.title = data.caption || data.label;\n\n return handle;\n }\n\n /**\n * Create a unique render key for the title.\n *\n * @param data - The data to use for the title.\n *\n * @returns The unique render key for the title.\n *\n * #### Notes\n * This method caches the key against the section title the first time\n * the key is generated.\n */\n createTitleKey(data: Title): string {\n let key = this._titleKeys.get(data);\n if (key === undefined) {\n key = `title-key-${this._uuid}-${this._titleID++}`;\n this._titleKeys.set(data, key);\n }\n return key;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _titleID = 0;\n private _titleKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n /**\n * Create an accordion layout for the given panel options.\n *\n * @param options Panel options\n * @returns Panel layout\n */\n export function createLayout(\n options: AccordionPanel.IOptions\n ): AccordionLayout {\n return (\n options.layout ||\n new AccordionLayout({\n renderer: options.renderer || AccordionPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing,\n titleSpace: options.titleSpace\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n /**\n * Construct a new box layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: BoxLayout.IOptions = {}) {\n super();\n if (options.direction !== undefined) {\n this._direction = options.direction;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the layout direction for the box layout.\n */\n get direction(): BoxLayout.Direction {\n return this._direction;\n }\n\n /**\n * Set the layout direction for the box layout.\n */\n set direction(value: BoxLayout.Direction) {\n if (this._direction === value) {\n return;\n }\n this._direction = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['direction'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the box layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the box layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['direction'] = this.direction;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Create and add a new sizer for the widget.\n ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Move the sizer for the widget.\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Remove the sizer for the widget.\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Update the fixed space for the visible items.\n this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n // Setup the computed minimum size.\n let horz = Private.isHorizontal(this._direction);\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the size basis and stretch factor.\n sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n sizer.stretch = BoxLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Distribute the layout space and adjust the start position.\n let delta: number;\n switch (this._direction) {\n case 'left-to-right':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n break;\n case 'top-to-bottom':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n break;\n case 'right-to-left':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n left += width;\n break;\n case 'bottom-to-top':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n top += height;\n break;\n default:\n throw 'unreachable';\n }\n\n // Setup the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the computed size for the widget.\n let size = this._sizers[i].size;\n\n // Update the widget geometry and advance the relevant edge.\n switch (this._direction) {\n case 'left-to-right':\n item.update(left + offset, top, size + extra, height);\n left += size + extra + this._spacing;\n break;\n case 'top-to-bottom':\n item.update(left, top + offset, width, size + extra);\n top += size + extra + this._spacing;\n break;\n case 'right-to-left':\n item.update(left - offset - size - extra, top, size + extra, height);\n left -= size + extra + this._spacing;\n break;\n case 'bottom-to-top':\n item.update(left, top - offset - size - extra, width, size + extra);\n top -= size + extra + this._spacing;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: BoxLayout.Alignment = 'start';\n private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n /**\n * A type alias for a box layout direction.\n */\n export type Direction =\n | 'left-to-right'\n | 'right-to-left'\n | 'top-to-bottom'\n | 'bottom-to-top';\n\n /**\n * A type alias for a box layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a box layout.\n */\n export interface IOptions {\n /**\n * The direction of the layout.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * Get the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n\n /**\n * Get the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return Private.sizeBasisProperty.get(widget);\n }\n\n /**\n * Set the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n Private.sizeBasisProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * The property descriptor for a widget size basis.\n */\n export const sizeBasisProperty = new AttachedProperty({\n name: 'sizeBasis',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Test whether a direction has horizontal orientation.\n */\n export function isHorizontal(dir: BoxLayout.Direction): boolean {\n return dir === 'left-to-right' || dir === 'right-to-left';\n }\n\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n export function clampSpacing(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof BoxLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n /**\n * Construct a new box panel.\n *\n * @param options - The options for initializing the box panel.\n */\n constructor(options: BoxPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-BoxPanel');\n }\n\n /**\n * Get the layout direction for the box panel.\n */\n get direction(): BoxPanel.Direction {\n return (this.layout as BoxLayout).direction;\n }\n\n /**\n * Set the layout direction for the box panel.\n */\n set direction(value: BoxPanel.Direction) {\n (this.layout as BoxLayout).direction = value;\n }\n\n /**\n * Get the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxPanel.Alignment {\n return (this.layout as BoxLayout).alignment;\n }\n\n /**\n * Set the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxPanel.Alignment) {\n (this.layout as BoxLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the box panel.\n */\n get spacing(): number {\n return (this.layout as BoxLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the box panel.\n */\n set spacing(value: number) {\n (this.layout as BoxLayout).spacing = value;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-BoxPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-BoxPanel-child');\n }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n /**\n * A type alias for a box panel direction.\n */\n export type Direction = BoxLayout.Direction;\n\n /**\n * A type alias for a box panel alignment.\n */\n export type Alignment = BoxLayout.Alignment;\n\n /**\n * An options object for initializing a box panel.\n */\n export interface IOptions {\n /**\n * The layout direction of the panel.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The box layout to use for the box panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `BoxLayout`.\n */\n layout?: BoxLayout;\n }\n\n /**\n * Get the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return BoxLayout.getStretch(widget);\n }\n\n /**\n * Set the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n BoxLayout.setStretch(widget, value);\n }\n\n /**\n * Get the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return BoxLayout.getSizeBasis(widget);\n }\n\n /**\n * Set the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n BoxLayout.setSizeBasis(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a box layout for the given panel options.\n */\n export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n return options.layout || new BoxLayout(options);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n /**\n * Construct a new command palette.\n *\n * @param options - The options for initializing the palette.\n */\n constructor(options: CommandPalette.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-CommandPalette');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || CommandPalette.defaultRenderer;\n this.commands.commandChanged.connect(this._onGenericChange, this);\n this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._items.length = 0;\n this._results = null;\n super.dispose();\n }\n\n /**\n * The command registry used by the command palette.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the command palette.\n */\n readonly renderer: CommandPalette.IRenderer;\n\n /**\n * The command palette search node.\n *\n * #### Notes\n * This is the node which contains the search-related elements.\n */\n get searchNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-search'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The command palette input node.\n *\n * #### Notes\n * This is the actual input node for the search area.\n */\n get inputNode(): HTMLInputElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-input'\n )[0] as HTMLInputElement;\n }\n\n /**\n * The command palette content node.\n *\n * #### Notes\n * This is the node which holds the command item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * A read-only array of the command items in the palette.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Add a command item to the command palette.\n *\n * @param options - The options for creating the command item.\n *\n * @returns The command item added to the palette.\n */\n addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n // Create a new command item for the options.\n let item = Private.createItem(this.commands, options);\n\n // Add the item to the array.\n this._items.push(item);\n\n // Refresh the search results.\n this.refresh();\n\n // Return the item added to the palette.\n return item;\n }\n\n /**\n * Adds command items to the command palette.\n *\n * @param items - An array of options for creating each command item.\n *\n * @returns The command items added to the palette.\n */\n addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n const newItems = items.map(item => Private.createItem(this.commands, item));\n newItems.forEach(item => this._items.push(item));\n this.refresh();\n return newItems;\n }\n\n /**\n * Remove an item from the command palette.\n *\n * @param item - The item to remove from the palette.\n *\n * #### Notes\n * This is a no-op if the item is not in the palette.\n */\n removeItem(item: CommandPalette.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the command palette.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Remove all items from the command palette.\n */\n clearItems(): void {\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the array of items.\n this._items.length = 0;\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Clear the search results and schedule an update.\n *\n * #### Notes\n * This should be called whenever the search results of the palette\n * should be updated.\n *\n * This is typically called automatically by the palette as needed,\n * but can be called manually if the input text is programatically\n * changed.\n *\n * The rendered results are updated asynchronously.\n */\n refresh(): void {\n this._results = null;\n if (this.inputNode.value !== '') {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'inherit';\n } else {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'none';\n }\n this.update();\n }\n\n /**\n * Handle the DOM events for the command palette.\n *\n * @param event - The DOM event sent to the command palette.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the command palette's DOM node.\n * It should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'input':\n this.refresh();\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('input', this);\n this.node.addEventListener('focus', this, true);\n this.node.addEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('input', this);\n this.node.removeEventListener('focus', this, true);\n this.node.removeEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n */\n protected onAfterShow(msg: Message): void {\n this.update();\n super.onAfterShow(msg);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n let input = this.inputNode;\n input.focus();\n input.select();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.isHidden) {\n return;\n }\n\n // Fetch the current query text and content node.\n let query = this.inputNode.value;\n let contentNode = this.contentNode;\n\n // Ensure the search results are generated.\n let results = this._results;\n if (!results) {\n // Generate and store the new search results.\n results = this._results = Private.search(this._items, query);\n\n // Reset the active index.\n this._activeIndex = query\n ? ArrayExt.findFirstIndex(results, Private.canActivate)\n : -1;\n }\n\n // If there is no query and no results, clear the content.\n if (!query && results.length === 0) {\n VirtualDOM.render(null, contentNode);\n return;\n }\n\n // If the is a query but no results, render the empty message.\n if (query && results.length === 0) {\n let content = this.renderer.renderEmptyMessage({ query });\n VirtualDOM.render(content, contentNode);\n return;\n }\n\n // Create the render content for the search results.\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let content = new Array(results.length);\n for (let i = 0, n = results.length; i < n; ++i) {\n let result = results[i];\n if (result.type === 'header') {\n let indices = result.indices;\n let category = result.category;\n content[i] = renderer.renderHeader({ category, indices });\n } else {\n let item = result.item;\n let indices = result.indices;\n let active = i === activeIndex;\n content[i] = renderer.renderItem({ item, indices, active });\n }\n }\n\n // Render the search result content.\n VirtualDOM.render(content, contentNode);\n\n // Adjust the scroll position as needed.\n if (activeIndex < 0 || activeIndex >= results.length) {\n contentNode.scrollTop = 0;\n } else {\n let element = contentNode.children[activeIndex];\n ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n }\n }\n\n /**\n * Handle the `'click'` event for the command palette.\n */\n private _evtClick(event: MouseEvent): void {\n // Bail if the click is not the left button.\n if (event.button !== 0) {\n return;\n }\n\n // Clear input if the target is clear button\n if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n this.inputNode.value = '';\n this.refresh();\n return;\n }\n\n // Find the index of the item which was clicked.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return node.contains(event.target as HTMLElement);\n });\n\n // Bail if the click was not on an item.\n if (index === -1) {\n return;\n }\n\n // Kill the event when a content item is clicked.\n event.preventDefault();\n event.stopPropagation();\n\n // Execute the item if possible.\n this._execute(index);\n }\n\n /**\n * Handle the `'keydown'` event for the command palette.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n return;\n }\n switch (event.keyCode) {\n case 13: // Enter\n event.preventDefault();\n event.stopPropagation();\n this._execute(this._activeIndex);\n break;\n case 38: // Up Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activatePreviousItem();\n break;\n case 40: // Down Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activateNextItem();\n break;\n }\n }\n\n /**\n * Activate the next enabled command item.\n */\n private _activateNextItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the next enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this._activeIndex = ArrayExt.findFirstIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Activate the previous enabled command item.\n */\n private _activatePreviousItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the previous enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this._activeIndex = ArrayExt.findLastIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Execute the command item at the given index, if possible.\n */\n private _execute(index: number): void {\n // Bail if there are no search results.\n if (!this._results) {\n return;\n }\n\n // Bail if the index is out of range.\n let part = this._results[index];\n if (!part) {\n return;\n }\n\n // Update the search text if the item is a header.\n if (part.type === 'header') {\n let input = this.inputNode;\n input.value = `${part.category.toLowerCase()} `;\n input.focus();\n this.refresh();\n return;\n }\n\n // Bail if item is not enabled.\n if (!part.item.isEnabled) {\n return;\n }\n\n // Execute the item.\n this.commands.execute(part.item.command, part.item.args);\n\n // Clear the query text.\n this.inputNode.value = '';\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Toggle the focused modifier based on the input node focus state.\n */\n private _toggleFocused(): void {\n let focused = document.activeElement === this.inputNode;\n this.toggleClass('lm-mod-focused', focused);\n }\n\n /**\n * A signal handler for generic command changes.\n */\n private _onGenericChange(): void {\n this.refresh();\n }\n\n private _activeIndex = -1;\n private _items: CommandPalette.IItem[] = [];\n private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n /**\n * An options object for creating a command palette.\n */\n export interface IOptions {\n /**\n * The command registry for use with the command palette.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the command palette.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for creating a command item.\n */\n export interface IItemOptions {\n /**\n * The category for the item.\n */\n category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n command: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n *\n * The rank is used as a tie-breaker when ordering command items\n * for display. Items are sorted in the following order:\n * 1. Text match (lower is better)\n * 2. Category (locale order)\n * 3. Rank (lower is better)\n * 4. Label (locale order)\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n\n /**\n * An object which represents an item in a command palette.\n *\n * #### Notes\n * Item objects are created automatically by a command palette.\n */\n export interface IItem {\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n readonly label: string;\n\n /**\n * The display caption for the command item.\n */\n readonly caption: string;\n\n /**\n * The icon renderer for the command item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the command item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the command item.\n */\n readonly iconLabel: string;\n\n /**\n * The extra class name for the command item.\n */\n readonly className: string;\n\n /**\n * The dataset for the command item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the command item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the command item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the command item is toggleable.\n */\n readonly isToggleable: boolean;\n\n /**\n * Whether the command item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the command item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * The render data for a command palette header.\n */\n export interface IHeaderRenderData {\n /**\n * The category of the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched characters in the category.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * The render data for a command palette item.\n */\n export interface IItemRenderData {\n /**\n * The command palette item to render.\n */\n readonly item: IItem;\n\n /**\n * The indices of the matched characters in the label.\n */\n readonly indices: ReadonlyArray | null;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n }\n\n /**\n * The render data for a command palette empty message.\n */\n export interface IEmptyMessageRenderData {\n /**\n * The query which failed to match any commands.\n */\n query: string;\n }\n\n /**\n * A renderer for use with a command palette.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement;\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n *\n * #### Notes\n * The command palette will not render invisible items.\n */\n renderItem(data: IItemRenderData): VirtualElement;\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement {\n let content = this.formatHeader(data);\n return h.li({ className: 'lm-CommandPalette-header' }, content);\n }\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IItemRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n if (data.item.isToggleable) {\n return h.li(\n {\n className,\n dataset,\n role: 'menuitemcheckbox',\n 'aria-checked': `${data.item.isToggled}`\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n return h.li(\n {\n className,\n dataset,\n role: 'menuitem'\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n let content = this.formatEmptyMessage(data);\n return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n }\n\n /**\n * Render the icon for a command palette item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the icon.\n */\n renderItemIcon(data: IItemRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the content for a command palette item.\n *\n * @param data - The data to use for rendering the content.\n *\n * @returns A virtual element representing the content.\n */\n renderItemContent(data: IItemRenderData): VirtualElement {\n return h.div(\n { className: 'lm-CommandPalette-itemContent' },\n this.renderItemLabel(data),\n this.renderItemCaption(data)\n );\n }\n\n /**\n * Render the label for a command palette item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the label.\n */\n renderItemLabel(data: IItemRenderData): VirtualElement {\n let content = this.formatItemLabel(data);\n return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n }\n\n /**\n * Render the caption for a command palette item.\n *\n * @param data - The data to use for rendering the caption.\n *\n * @returns A virtual element representing the caption.\n */\n renderItemCaption(data: IItemRenderData): VirtualElement {\n let content = this.formatItemCaption(data);\n return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n }\n\n /**\n * Render the shortcut for a command palette item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the shortcut.\n */\n renderItemShortcut(data: IItemRenderData): VirtualElement {\n let content = this.formatItemShortcut(data);\n return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n }\n\n /**\n * Create the class name for the command palette item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the command palette item.\n */\n createItemClass(data: IItemRenderData): string {\n // Set up the initial class name.\n let name = 'lm-CommandPalette-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the command palette item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the command palette item.\n */\n createItemDataset(data: IItemRenderData): ElementDataset {\n return { ...data.item.dataset, command: data.item.command };\n }\n\n /**\n * Create the class name for the command item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IItemRenderData): string {\n let name = 'lm-CommandPalette-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the header node.\n *\n * @param data - The data to use for the header content.\n *\n * @returns The content to add to the header node.\n */\n formatHeader(data: IHeaderRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.category;\n }\n return StringExt.highlight(data.category, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the empty message node.\n *\n * @param data - The data to use for the empty message content.\n *\n * @returns The content to add to the empty message node.\n */\n formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n return `No commands found that match '${data.query}'`;\n }\n\n /**\n * Create the render content for the item shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatItemShortcut(data: IItemRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n\n /**\n * Create the render content for the item label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatItemLabel(data: IItemRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.item.label;\n }\n return StringExt.highlight(data.item.label, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the item caption node.\n *\n * @param data - The data to use for the caption content.\n *\n * @returns The content to add to the caption node.\n */\n formatItemCaption(data: IItemRenderData): h.Child {\n return data.item.caption;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a command palette.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let search = document.createElement('div');\n let wrapper = document.createElement('div');\n let input = document.createElement('input');\n let content = document.createElement('ul');\n let clear = document.createElement('button');\n search.className = 'lm-CommandPalette-search';\n wrapper.className = 'lm-CommandPalette-wrapper';\n input.className = 'lm-CommandPalette-input';\n clear.className = 'lm-close-icon';\n\n content.className = 'lm-CommandPalette-content';\n content.setAttribute('role', 'menu');\n input.spellcheck = false;\n wrapper.appendChild(input);\n wrapper.appendChild(clear);\n search.appendChild(wrapper);\n node.appendChild(search);\n node.appendChild(content);\n return node;\n }\n\n /**\n * Create a new command item from a command registry and options.\n */\n export function createItem(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ): CommandPalette.IItem {\n return new CommandItem(commands, options);\n }\n\n /**\n * A search result object for a header label.\n */\n export interface IHeaderResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'header';\n\n /**\n * The category for the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched category characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A search result object for a command item.\n */\n export interface IItemResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'item';\n\n /**\n * The command item which was matched.\n */\n readonly item: CommandPalette.IItem;\n\n /**\n * The indices of the matched label characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A type alias for a search result item.\n */\n export type SearchResult = IHeaderResult | IItemResult;\n\n /**\n * Search an array of command items for fuzzy matches.\n */\n export function search(\n items: CommandPalette.IItem[],\n query: string\n ): SearchResult[] {\n // Fuzzy match the items for the query.\n let scores = matchItems(items, query);\n\n // Sort the items based on their score.\n scores.sort(scoreCmp);\n\n // Create the results for the search.\n return createResults(scores);\n }\n\n /**\n * Test whether a result item can be activated.\n */\n export function canActivate(result: SearchResult): boolean {\n return result.type === 'item' && result.item.isEnabled;\n }\n\n /**\n * Normalize a category for a command item.\n */\n function normalizeCategory(category: string): string {\n return category.trim().replace(/\\s+/g, ' ');\n }\n\n /**\n * Normalize the query text for a fuzzy search.\n */\n function normalizeQuery(text: string): string {\n return text.replace(/\\s+/g, '').toLowerCase();\n }\n\n /**\n * An enum of the supported match types.\n */\n const enum MatchType {\n Label,\n Category,\n Split,\n Default\n }\n\n /**\n * A text match score with associated command item.\n */\n interface IScore {\n /**\n * The numerical type for the text match.\n */\n matchType: MatchType;\n\n /**\n * The numerical score for the text match.\n */\n score: number;\n\n /**\n * The indices of the matched category characters.\n */\n categoryIndices: number[] | null;\n\n /**\n * The indices of the matched label characters.\n */\n labelIndices: number[] | null;\n\n /**\n * The command item associated with the match.\n */\n item: CommandPalette.IItem;\n }\n\n /**\n * Perform a fuzzy match on an array of command items.\n */\n function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n // Normalize the query text to lower case with no whitespace.\n query = normalizeQuery(query);\n\n // Create the array to hold the scores.\n let scores: IScore[] = [];\n\n // Iterate over the items and match against the query.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Ignore items which are not visible.\n let item = items[i];\n if (!item.isVisible) {\n continue;\n }\n\n // If the query is empty, all items are matched by default.\n if (!query) {\n scores.push({\n matchType: MatchType.Default,\n categoryIndices: null,\n labelIndices: null,\n score: 0,\n item\n });\n continue;\n }\n\n // Run the fuzzy search for the item and query.\n let score = fuzzySearch(item, query);\n\n // Ignore the item if it is not a match.\n if (!score) {\n continue;\n }\n\n // Penalize disabled items.\n // TODO - push disabled items all the way down in sort cmp?\n if (!item.isEnabled) {\n score.score += 1000;\n }\n\n // Add the score to the results.\n scores.push(score);\n }\n\n // Return the final array of scores.\n return scores;\n }\n\n /**\n * Perform a fuzzy search on a single command item.\n */\n function fuzzySearch(\n item: CommandPalette.IItem,\n query: string\n ): IScore | null {\n // Create the source text to be searched.\n let category = item.category.toLowerCase();\n let label = item.label.toLowerCase();\n let source = `${category} ${label}`;\n\n // Set up the match score and indices array.\n let score = Infinity;\n let indices: number[] | null = null;\n\n // The regex for search word boundaries\n let rgx = /\\b\\w/g;\n\n // Search the source by word boundary.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Find the next word boundary in the source.\n let rgxMatch = rgx.exec(source);\n\n // Break if there is no more source context.\n if (!rgxMatch) {\n break;\n }\n\n // Run the string match on the relevant substring.\n let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n // Break if there is no match.\n if (!match) {\n break;\n }\n\n // Update the match if the score is better.\n if (match.score <= score) {\n score = match.score;\n indices = match.indices;\n }\n }\n\n // Bail if there was no match.\n if (!indices || score === Infinity) {\n return null;\n }\n\n // Compute the pivot index between category and label text.\n let pivot = category.length + 1;\n\n // Find the slice index to separate matched indices.\n let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n // Extract the matched category and label indices.\n let categoryIndices = indices.slice(0, j);\n let labelIndices = indices.slice(j);\n\n // Adjust the label indices for the pivot offset.\n for (let i = 0, n = labelIndices.length; i < n; ++i) {\n labelIndices[i] -= pivot;\n }\n\n // Handle a pure label match.\n if (categoryIndices.length === 0) {\n return {\n matchType: MatchType.Label,\n categoryIndices: null,\n labelIndices,\n score,\n item\n };\n }\n\n // Handle a pure category match.\n if (labelIndices.length === 0) {\n return {\n matchType: MatchType.Category,\n categoryIndices,\n labelIndices: null,\n score,\n item\n };\n }\n\n // Handle a split match.\n return {\n matchType: MatchType.Split,\n categoryIndices,\n labelIndices,\n score,\n item\n };\n }\n\n /**\n * A sort comparison function for a match score.\n */\n function scoreCmp(a: IScore, b: IScore): number {\n // First compare based on the match type\n let m1 = a.matchType - b.matchType;\n if (m1 !== 0) {\n return m1;\n }\n\n // Otherwise, compare based on the match score.\n let d1 = a.score - b.score;\n if (d1 !== 0) {\n return d1;\n }\n\n // Find the match index based on the match type.\n let i1 = 0;\n let i2 = 0;\n switch (a.matchType) {\n case MatchType.Label:\n i1 = a.labelIndices![0];\n i2 = b.labelIndices![0];\n break;\n case MatchType.Category:\n case MatchType.Split:\n i1 = a.categoryIndices![0];\n i2 = b.categoryIndices![0];\n break;\n }\n\n // Compare based on the match index.\n if (i1 !== i2) {\n return i1 - i2;\n }\n\n // Otherwise, compare by category.\n let d2 = a.item.category.localeCompare(b.item.category);\n if (d2 !== 0) {\n return d2;\n }\n\n // Otherwise, compare by rank.\n let r1 = a.item.rank;\n let r2 = b.item.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity safe\n }\n\n // Finally, compare by label.\n return a.item.label.localeCompare(b.item.label);\n }\n\n /**\n * Create the results from an array of sorted scores.\n */\n function createResults(scores: IScore[]): SearchResult[] {\n // Set up the search results array.\n let results: SearchResult[] = [];\n\n // Iterate over each score in the array.\n for (let i = 0, n = scores.length; i < n; ++i) {\n // Extract the current item and indices.\n let { item, categoryIndices, labelIndices } = scores[i];\n\n // Extract the category for the current item.\n let category = item.category;\n\n // Is this the same category as the preceding result?\n if (i === 0 || category !== scores[i - 1].item.category) {\n // Add the header result for the category.\n results.push({ type: 'header', category, indices: categoryIndices });\n }\n\n // Create the item result for the score.\n results.push({ type: 'item', item, indices: labelIndices });\n }\n\n // Return the final results.\n return results;\n }\n\n /**\n * A concrete implementation of `CommandPalette.IItem`.\n */\n class CommandItem implements CommandPalette.IItem {\n /**\n * Construct a new command item.\n */\n constructor(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ) {\n this._commands = commands;\n this.category = normalizeCategory(options.category);\n this.command = options.command;\n this.args = options.args || JSONExt.emptyObject;\n this.rank = options.rank !== undefined ? options.rank : Infinity;\n }\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n get label(): string {\n return this._commands.label(this.command, this.args);\n }\n\n /**\n * The icon renderer for the command item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._commands.icon(this.command, this.args);\n }\n\n /**\n * The icon class for the command item.\n */\n get iconClass(): string {\n return this._commands.iconClass(this.command, this.args);\n }\n\n /**\n * The icon label for the command item.\n */\n get iconLabel(): string {\n return this._commands.iconLabel(this.command, this.args);\n }\n\n /**\n * The display caption for the command item.\n */\n get caption(): string {\n return this._commands.caption(this.command, this.args);\n }\n\n /**\n * The extra class name for the command item.\n */\n get className(): string {\n return this._commands.className(this.command, this.args);\n }\n\n /**\n * The dataset for the command item.\n */\n get dataset(): CommandRegistry.Dataset {\n return this._commands.dataset(this.command, this.args);\n }\n\n /**\n * Whether the command item is enabled.\n */\n get isEnabled(): boolean {\n return this._commands.isEnabled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggled.\n */\n get isToggled(): boolean {\n return this._commands.isToggled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggleable.\n */\n get isToggleable(): boolean {\n return this._commands.isToggleable(this.command, this.args);\n }\n\n /**\n * Whether the command item is visible.\n */\n get isVisible(): boolean {\n return this._commands.isVisible(this.command, this.args);\n }\n\n /**\n * The key binding for the command item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ARIAAttrNames,\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n pageXOffset: number;\n pageYOffset: number;\n clientWidth: number;\n clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n /**\n * Construct a new menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: Menu.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-Menu');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || Menu.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the menu.\n */\n dispose(): void {\n this.close();\n this._items.length = 0;\n super.dispose();\n }\n\n /**\n * A signal emitted just before the menu is closed.\n *\n * #### Notes\n * This signal is emitted when the menu receives a `'close-request'`\n * message, just before it removes itself from the DOM.\n *\n * This signal is not emitted if the menu is already detached from\n * the DOM when it receives the `'close-request'` message.\n */\n get aboutToClose(): ISignal {\n return this._aboutToClose;\n }\n\n /**\n * A signal emitted when a new menu is requested by the user.\n *\n * #### Notes\n * This signal is emitted whenever the user presses the right or left\n * arrow keys, and a submenu cannot be opened or closed in response.\n *\n * This signal is useful when implementing menu bars in order to open\n * the next or previous menu in response to a user key press.\n *\n * This signal is only emitted for the root menu in a hierarchy.\n */\n get menuRequested(): ISignal {\n return this._menuRequested;\n }\n\n /**\n * The command registry used by the menu.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the menu.\n */\n readonly renderer: Menu.IRenderer;\n\n /**\n * The parent menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu is an open submenu.\n */\n get parentMenu(): Menu | null {\n return this._parentMenu;\n }\n\n /**\n * The child menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu has an open submenu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The root menu of the menu hierarchy.\n */\n get rootMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._parentMenu) {\n menu = menu._parentMenu;\n }\n return menu;\n }\n\n /**\n * The leaf menu of the menu hierarchy.\n */\n get leafMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._childMenu) {\n menu = menu._childMenu;\n }\n return menu;\n }\n\n /**\n * The menu content node.\n *\n * #### Notes\n * This is the node which holds the menu item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-Menu-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu item.\n */\n get activeItem(): Menu.IItem | null {\n return this._items[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the item will be set to `null`.\n */\n set activeItem(value: Menu.IItem | null) {\n this.activeIndex = value ? this._items.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu item.\n *\n * #### Notes\n * This will be `-1` if no menu item is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._items.length) {\n value = -1;\n }\n\n // Ensure the item can be activated.\n if (value !== -1 && !Private.canActivate(this._items[value])) {\n value = -1;\n }\n\n // Bail if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Make active element in focus\n if (\n this._activeIndex >= 0 &&\n this.contentNode.childNodes[this._activeIndex]\n ) {\n (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n }\n\n // schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menu items in the menu.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Activate the next selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activateNextItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this.activeIndex = ArrayExt.findFirstIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Activate the previous selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activatePreviousItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this.activeIndex = ArrayExt.findLastIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Trigger the active menu item.\n *\n * #### Notes\n * If the active item is a submenu, it will be opened and the first\n * item will be activated.\n *\n * If the active item is a command, the command will be executed.\n *\n * If the menu is not attached, this is a no-op.\n *\n * If there is no active item, this is a no-op.\n */\n triggerActiveItem(): void {\n // Bail if the menu is not attached.\n if (!this.isAttached) {\n return;\n }\n\n // Bail if there is no active item.\n let item = this.activeItem;\n if (!item) {\n return;\n }\n\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // If the item is a submenu, open it.\n if (item.type === 'submenu') {\n this._openChildMenu(true);\n return;\n }\n\n // Close the root menu before executing the command.\n this.rootMenu.close();\n\n // Execute the command for the item.\n let { command, args } = item;\n if (this.commands.isEnabled(command, args)) {\n this.commands.execute(command, args);\n } else {\n console.log(`Command '${command}' is disabled.`);\n }\n }\n\n /**\n * Add a menu item to the end of the menu.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n */\n addItem(options: Menu.IItemOptions): Menu.IItem {\n return this.insertItem(this._items.length, options);\n }\n\n /**\n * Insert a menu item into the menu at the specified index.\n *\n * @param index - The index at which to insert the item.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n *\n * #### Notes\n * The index will be clamped to the bounds of the items.\n */\n insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Clamp the insert index to the array bounds.\n let i = Math.max(0, Math.min(index, this._items.length));\n\n // Create the item for the options.\n let item = Private.createItem(this, options);\n\n // Insert the item into the array.\n ArrayExt.insert(this._items, i, item);\n\n // Schedule an update of the items.\n this.update();\n\n // Return the item added to the menu.\n return item;\n }\n\n /**\n * Remove an item from the menu.\n *\n * @param item - The item to remove from the menu.\n *\n * #### Notes\n * This is a no-op if the item is not in the menu.\n */\n removeItem(item: Menu.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the menu.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Remove all menu items from the menu.\n */\n clearItems(): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the items.\n this._items.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Open the menu at the specified location.\n *\n * @param x - The client X coordinate of the menu location.\n *\n * @param y - The client Y coordinate of the menu location.\n *\n * @param options - The additional options for opening the menu.\n *\n * #### Notes\n * The menu will be opened at the given location unless it will not\n * fully fit on the screen. If it will not fit, it will be adjusted\n * to fit naturally on the screen.\n *\n * The menu will be attached under the `host` element in the DOM\n * (or `document.body` if `host` is `null`) and before the `ref`\n * element (or as the last child of `host` if `ref` is `null`).\n * The menu may be displayed outside of the `host` element\n * following the rules of CSS absolute positioning.\n *\n * This is a no-op if the menu is already attached to the DOM.\n */\n open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n // Bail early if the menu is already attached.\n if (this.isAttached) {\n return;\n }\n\n // Extract the menu options.\n let forceX = options.forceX || false;\n let forceY = options.forceY || false;\n const host = options.host ?? null;\n const ref = options.ref ?? null;\n\n // Open the menu as a root menu.\n Private.openRootMenu(this, x, y, forceX, forceY, host, ref);\n\n // Activate the menu to accept keyboard input.\n this.activate();\n }\n\n /**\n * Handle the DOM events for the menu.\n *\n * @param event - The DOM event sent to the menu.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu's DOM nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseenter':\n this._evtMouseEnter(event as MouseEvent);\n break;\n case 'mouseleave':\n this._evtMouseLeave(event as MouseEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mouseup', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseenter', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('contextmenu', this);\n document.addEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mouseup', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseenter', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('contextmenu', this);\n document.removeEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this.node.focus();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let items = this._items;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let collapsedFlags = Private.computeCollapsed(items);\n let content = new Array(items.length);\n for (let i = 0, n = items.length; i < n; ++i) {\n let item = items[i];\n let active = i === activeIndex;\n let collapsed = collapsedFlags[i];\n content[i] = renderer.renderItem({\n item,\n active,\n collapsed,\n onfocus: () => {\n this.activeIndex = i;\n }\n });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n */\n protected onCloseRequest(msg: Message): void {\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Close any open child menu.\n let childMenu = this._childMenu;\n if (childMenu) {\n this._childIndex = -1;\n this._childMenu = null;\n childMenu._parentMenu = null;\n childMenu.close();\n }\n\n // Remove this menu from its parent and activate the parent.\n let parentMenu = this._parentMenu;\n if (parentMenu) {\n this._parentMenu = null;\n parentMenu._childIndex = -1;\n parentMenu._childMenu = null;\n parentMenu.activate();\n }\n\n // Emit the `aboutToClose` signal if the menu is attached.\n if (this.isAttached) {\n this._aboutToClose.emit(undefined);\n }\n\n // Finish closing the menu.\n super.onCloseRequest(msg);\n }\n\n /**\n * Handle the `'keydown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // A menu handles all keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Enter\n if (kc === 13) {\n this.triggerActiveItem();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this.close();\n return;\n }\n\n // Left Arrow\n if (kc === 37) {\n if (this._parentMenu) {\n this.close();\n } else {\n this._menuRequested.emit('previous');\n }\n return;\n }\n\n // Up Arrow\n if (kc === 38) {\n this.activatePreviousItem();\n return;\n }\n\n // Right Arrow\n if (kc === 39) {\n let item = this.activeItem;\n if (item && item.type === 'submenu') {\n this.triggerActiveItem();\n } else {\n this.rootMenu._menuRequested.emit('next');\n }\n return;\n }\n\n // Down Arrow\n if (kc === 40) {\n this.activateNextItem();\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._items, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that item is triggered.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.triggerActiveItem();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n }\n }\n\n /**\n * Handle the `'mouseup'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseUp(event: MouseEvent): void {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.triggerActiveItem();\n }\n\n /**\n * Handle the `'mousemove'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Hit test the item nodes for the item under the mouse.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the mouse is already over the active index.\n if (index === this._activeIndex) {\n return;\n }\n\n // Update and coerce the active index.\n this.activeIndex = index;\n index = this.activeIndex;\n\n // If the index is the current child index, cancel the timers.\n if (index === this._childIndex) {\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n return;\n }\n\n // If a child menu is currently open, start the close timer.\n if (this._childIndex !== -1) {\n this._startCloseTimer();\n }\n\n // Cancel the open timer to give a full delay for opening.\n this._cancelOpenTimer();\n\n // Bail if the active item is not a valid submenu item.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n return;\n }\n\n // Start the open timer to open the active item submenu.\n this._startOpenTimer();\n }\n\n /**\n * Handle the `'mouseenter'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseEnter(event: MouseEvent): void {\n // Synchronize the active ancestor items.\n for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n menu._cancelOpenTimer();\n menu._cancelCloseTimer();\n menu.activeIndex = menu._childIndex;\n }\n }\n\n /**\n * Handle the `'mouseleave'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseLeave(event: MouseEvent): void {\n // Cancel any pending submenu opening.\n this._cancelOpenTimer();\n\n // If there is no open child menu, just reset the active index.\n if (!this._childMenu) {\n this.activeIndex = -1;\n return;\n }\n\n // If the mouse is over the child menu, cancel the close timer.\n let { clientX, clientY } = event;\n if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n this._cancelCloseTimer();\n return;\n }\n\n // Otherwise, reset the active index and start the close timer.\n this.activeIndex = -1;\n this._startCloseTimer();\n }\n\n /**\n * Handle the `'mousedown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the document node.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the menu is not a root menu.\n if (this._parentMenu) {\n return;\n }\n\n // The mouse button which is pressed is irrelevant. If the press\n // is not on a menu, the entire hierarchy is closed and the event\n // is allowed to propagate. This allows other code to act on the\n // event, such as focusing the clicked element.\n if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n event.preventDefault();\n event.stopPropagation();\n } else {\n this.close();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if the active item is not a valid submenu.\n */\n private _openChildMenu(activateFirst = false): void {\n // If the item is not a valid submenu, close the child menu.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n this._closeChildMenu();\n return;\n }\n\n // Do nothing if the child menu will not change.\n let submenu = item.submenu;\n if (submenu === this._childMenu) {\n return;\n }\n\n // Prior to any DOM modifications save window data\n Menu.saveWindowData();\n\n // Ensure the current child menu is closed.\n this._closeChildMenu();\n\n // Update the private child state.\n this._childMenu = submenu;\n this._childIndex = this._activeIndex;\n\n // Set the parent menu reference for the child.\n submenu._parentMenu = this;\n\n // Ensure the menu is updated and lookup the item node.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n let itemNode = this.contentNode.children[this._activeIndex];\n\n // Open the submenu at the active node.\n Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n // Activate the first item if desired.\n if (activateFirst) {\n submenu.activeIndex = -1;\n submenu.activateNextItem();\n }\n\n // Activate the child menu.\n submenu.activate();\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n if (this._childMenu) {\n this._childMenu.close();\n }\n }\n\n /**\n * Start the open timer, unless it is already pending.\n */\n private _startOpenTimer(): void {\n if (this._openTimerID === 0) {\n this._openTimerID = window.setTimeout(() => {\n this._openTimerID = 0;\n this._openChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Start the close timer, unless it is already pending.\n */\n private _startCloseTimer(): void {\n if (this._closeTimerID === 0) {\n this._closeTimerID = window.setTimeout(() => {\n this._closeTimerID = 0;\n this._closeChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Cancel the open timer, if the timer is pending.\n */\n private _cancelOpenTimer(): void {\n if (this._openTimerID !== 0) {\n clearTimeout(this._openTimerID);\n this._openTimerID = 0;\n }\n }\n\n /**\n * Cancel the close timer, if the timer is pending.\n */\n private _cancelCloseTimer(): void {\n if (this._closeTimerID !== 0) {\n clearTimeout(this._closeTimerID);\n this._closeTimerID = 0;\n }\n }\n\n /**\n * Save window data used for menu positioning in transient cache.\n *\n * In order to avoid layout trashing it is recommended to invoke this\n * method immediately prior to opening the menu and any DOM modifications\n * (like closing previously visible menu, or adding a class to menu widget).\n *\n * The transient cache will be released upon `open()` call.\n */\n static saveWindowData(): void {\n Private.saveWindowData();\n }\n\n private _childIndex = -1;\n private _activeIndex = -1;\n private _openTimerID = 0;\n private _closeTimerID = 0;\n private _items: Menu.IItem[] = [];\n private _childMenu: Menu | null = null;\n private _parentMenu: Menu | null = null;\n private _aboutToClose = new Signal(this);\n private _menuRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n /**\n * An options object for creating a menu.\n */\n export interface IOptions {\n /**\n * The command registry for use with the menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the menu.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for the `open` method on a menu.\n */\n export interface IOpenOptions {\n /**\n * Whether to force the X position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * X coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceX?: boolean;\n\n /**\n * Whether to force the Y position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * Y coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceY?: boolean;\n\n /**\n * The DOM node to use as the menu's host.\n *\n * If not specified then uses `document.body`.\n */\n host?: HTMLElement;\n\n /**\n * The child of `host` to use as the reference element.\n * If this is provided, the menu will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * menu to be added as the last child of the host.\n */\n ref?: HTMLElement;\n }\n\n /**\n * A type alias for a menu item type.\n */\n export type ItemType = 'command' | 'submenu' | 'separator';\n\n /**\n * An options object for creating a menu item.\n */\n export interface IItemOptions {\n /**\n * The type of the menu item.\n *\n * The default value is `'command'`.\n */\n type?: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n *\n * The default value is an empty string.\n */\n command?: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n *\n * The default value is `null`.\n */\n submenu?: Menu | null;\n }\n\n /**\n * An object which represents a menu item.\n *\n * #### Notes\n * Item objects are created automatically by a menu.\n */\n export interface IItem {\n /**\n * The type of the menu item.\n */\n readonly type: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n readonly label: string;\n\n /**\n * The mnemonic index for the menu item.\n */\n readonly mnemonic: number;\n\n /**\n * The icon renderer for the menu item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the menu item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the menu item.\n */\n readonly iconLabel: string;\n\n /**\n * The display caption for the menu item.\n */\n readonly caption: string;\n\n /**\n * The extra class name for the menu item.\n */\n readonly className: string;\n\n /**\n * The dataset for the menu item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the menu item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the menu item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the menu item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the menu item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * An object which holds the data to render a menu item.\n */\n export interface IRenderData {\n /**\n * The item to be rendered.\n */\n readonly item: IItem;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the item should be collapsed.\n */\n readonly collapsed: boolean;\n\n /**\n * Handler for when element is in focus.\n */\n readonly onfocus?: () => void;\n }\n\n /**\n * A renderer for use with a menu.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n tabindex: '0',\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderShortcut(data),\n this.renderSubmenu(data)\n );\n }\n\n /**\n * Render the icon element for a menu item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-Menu-itemLabel' }, content);\n }\n\n /**\n * Render the shortcut element for a menu item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the item shortcut.\n */\n renderShortcut(data: IRenderData): VirtualElement {\n let content = this.formatShortcut(data);\n return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n }\n\n /**\n * Render the submenu icon element for a menu item.\n *\n * @param data - The data to use for rendering the submenu icon.\n *\n * @returns A virtual element representing the submenu icon.\n */\n renderSubmenu(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n }\n\n /**\n * Create the class name for the menu item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n // Setup the initial class name.\n let name = 'lm-Menu-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (!data.item.isVisible) {\n name += ' lm-mod-hidden';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n if (data.collapsed) {\n name += ' lm-mod-collapsed';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the menu item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the menu item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n let result: ElementDataset;\n let { type, command, dataset } = data.item;\n if (type === 'command') {\n result = { ...dataset, type, command };\n } else {\n result = { ...dataset, type };\n }\n return result;\n }\n\n /**\n * Create the class name for the menu item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-Menu-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the aria attributes for menu item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n let aria: { [T in ARIAAttrNames]?: string } = {};\n switch (data.item.type) {\n case 'separator':\n aria.role = 'presentation';\n break;\n case 'submenu':\n aria['aria-haspopup'] = 'true';\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n break;\n default:\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n aria.role = 'menuitem';\n }\n return aria;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.item;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n\n /**\n * Create the render content for the shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatShortcut(data: IRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The ms delay for opening and closing a submenu.\n */\n export const TIMER_DELAY = 300;\n\n /**\n * The horizontal pixel overlap for an open submenu.\n */\n export const SUBMENU_OVERLAP = 3;\n\n let transientWindowDataCache: IWindowData | null = null;\n let transientCacheCounter: number = 0;\n\n function getWindowData(): IWindowData {\n // if transient cache is in use, take one from it\n if (transientCacheCounter > 0) {\n transientCacheCounter--;\n return transientWindowDataCache!;\n }\n return _getWindowData();\n }\n\n /**\n * Store window data in transient cache.\n *\n * The transient cache will be released upon `getWindowData()` call.\n * If this function is called multiple times, the cache will be\n * retained until as many calls to `getWindowData()` were made.\n *\n * Note: should be called before any DOM modifications.\n */\n export function saveWindowData(): void {\n transientWindowDataCache = _getWindowData();\n transientCacheCounter++;\n }\n\n /**\n * Create the DOM node for a menu.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-Menu-content';\n node.appendChild(content);\n content.setAttribute('role', 'menu');\n node.tabIndex = 0;\n return node;\n }\n\n /**\n * Test whether a menu item can be activated.\n */\n export function canActivate(item: Menu.IItem): boolean {\n return item.type !== 'separator' && item.isEnabled && item.isVisible;\n }\n\n /**\n * Create a new menu item for an owner menu.\n */\n export function createItem(\n owner: Menu,\n options: Menu.IItemOptions\n ): Menu.IItem {\n return new MenuItem(owner.commands, options);\n }\n\n /**\n * Hit test a menu hierarchy starting at the given root.\n */\n export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n if (ElementExt.hitTest(temp.node, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Compute which extra separator items should be collapsed.\n */\n export function computeCollapsed(\n items: ReadonlyArray\n ): boolean[] {\n // Allocate the return array and fill it with `false`.\n let result = new Array(items.length);\n ArrayExt.fill(result, false);\n\n // Collapse the leading separators.\n let k1 = 0;\n let n = items.length;\n for (; k1 < n; ++k1) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k1] = true;\n }\n\n // Hide the trailing separators.\n let k2 = n - 1;\n for (; k2 >= 0; --k2) {\n let item = items[k2];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k2] = true;\n }\n\n // Hide the remaining consecutive separators.\n let hide = false;\n while (++k1 < k2) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n hide = false;\n } else if (hide) {\n result[k1] = true;\n } else {\n hide = true;\n }\n }\n\n // Return the resulting flags.\n return result;\n }\n\n function _getWindowData(): IWindowData {\n return {\n pageXOffset: window.pageXOffset,\n pageYOffset: window.pageYOffset,\n clientWidth: document.documentElement.clientWidth,\n clientHeight: document.documentElement.clientHeight\n };\n }\n\n /**\n * Open a menu as a root menu at the target location.\n */\n export function openRootMenu(\n menu: Menu,\n x: number,\n y: number,\n forceX: boolean,\n forceY: boolean,\n host: HTMLElement | null,\n ref: HTMLElement | null\n ): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before attaching and measuring.\n MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch - (forceY ? y : 0);\n\n // Fetch common variables.\n let node = menu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(menu, host || document.body, ref);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Adjust the X position of the menu to fit on-screen.\n if (!forceX && x + width > px + cw) {\n x = px + cw - width;\n }\n\n // Adjust the Y position of the menu to fit on-screen.\n if (!forceY && y + height > py + ch) {\n if (y > py + ch) {\n y = py + ch - height;\n } else {\n y = y - height;\n }\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * Open a menu as a submenu using an item node for positioning.\n */\n export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before opening.\n MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch;\n\n // Fetch common variables.\n let node = submenu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(submenu, document.body);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Compute the box sizing for the menu.\n let box = ElementExt.boxSizing(submenu.node);\n\n // Get the bounding rect for the target item node.\n let itemRect = itemNode.getBoundingClientRect();\n\n // Compute the target X position.\n let x = itemRect.right - SUBMENU_OVERLAP;\n\n // Adjust the X position to fit on the screen.\n if (x + width > px + cw) {\n x = itemRect.left + SUBMENU_OVERLAP - width;\n }\n\n // Compute the target Y position.\n let y = itemRect.top - box.borderTop - box.paddingTop;\n\n // Adjust the Y position to fit on the screen.\n if (y + height > py + ch) {\n y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n items: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Lookup the item\n let item = items[k];\n\n // Ignore items which cannot be activated.\n if (!canActivate(item)) {\n continue;\n }\n\n // Ignore items with an empty label.\n let label = item.label;\n if (label.length === 0) {\n continue;\n }\n\n // Lookup the mnemonic index for the label.\n let mn = item.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < label.length) {\n if (label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n\n /**\n * A concrete implementation of `Menu.IItem`.\n */\n class MenuItem implements Menu.IItem {\n /**\n * Construct a new menu item.\n */\n constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n this._commands = commands;\n this.type = options.type || 'command';\n this.command = options.command || '';\n this.args = options.args || JSONExt.emptyObject;\n this.submenu = options.submenu || null;\n }\n\n /**\n * The type of the menu item.\n */\n readonly type: Menu.ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n get label(): string {\n if (this.type === 'command') {\n return this._commands.label(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.label;\n }\n return '';\n }\n\n /**\n * The mnemonic index for the menu item.\n */\n get mnemonic(): number {\n if (this.type === 'command') {\n return this._commands.mnemonic(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.mnemonic;\n }\n return -1;\n }\n\n /**\n * The icon renderer for the menu item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n if (this.type === 'command') {\n return this._commands.icon(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.icon;\n }\n return undefined;\n }\n\n /**\n * The icon class for the menu item.\n */\n get iconClass(): string {\n if (this.type === 'command') {\n return this._commands.iconClass(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconClass;\n }\n return '';\n }\n\n /**\n * The icon label for the menu item.\n */\n get iconLabel(): string {\n if (this.type === 'command') {\n return this._commands.iconLabel(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconLabel;\n }\n return '';\n }\n\n /**\n * The display caption for the menu item.\n */\n get caption(): string {\n if (this.type === 'command') {\n return this._commands.caption(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.caption;\n }\n return '';\n }\n\n /**\n * The extra class name for the menu item.\n */\n get className(): string {\n if (this.type === 'command') {\n return this._commands.className(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.className;\n }\n return '';\n }\n\n /**\n * The dataset for the menu item.\n */\n get dataset(): CommandRegistry.Dataset {\n if (this.type === 'command') {\n return this._commands.dataset(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.dataset;\n }\n return {};\n }\n\n /**\n * Whether the menu item is enabled.\n */\n get isEnabled(): boolean {\n if (this.type === 'command') {\n return this._commands.isEnabled(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * Whether the menu item is toggled.\n */\n get isToggled(): boolean {\n if (this.type === 'command') {\n return this._commands.isToggled(this.command, this.args);\n }\n return false;\n }\n\n /**\n * Whether the menu item is visible.\n */\n get isVisible(): boolean {\n if (this.type === 'command') {\n return this._commands.isVisible(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * The key binding for the menu item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n if (this.type === 'command') {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n return null;\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n /**\n * Construct a new context menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: ContextMenu.IOptions) {\n const { groupByTarget, sortBySelector, ...others } = options;\n this.menu = new Menu(others);\n this._groupByTarget = groupByTarget !== false;\n this._sortBySelector = sortBySelector !== false;\n }\n\n /**\n * The menu widget which displays the matched context items.\n */\n readonly menu: Menu;\n\n /**\n * Add an item to the context menu.\n *\n * @param options - The options for creating the item.\n *\n * @returns A disposable which will remove the item from the menu.\n */\n addItem(options: ContextMenu.IItemOptions): IDisposable {\n // Create an item from the given options.\n let item = Private.createItem(options, this._idTick++);\n\n // Add the item to the internal array.\n this._items.push(item);\n\n // Return a disposable which will remove the item.\n return new DisposableDelegate(() => {\n ArrayExt.removeFirstOf(this._items, item);\n });\n }\n\n /**\n * Open the context menu in response to a `'contextmenu'` event.\n *\n * @param event - The `'contextmenu'` event of interest.\n *\n * @returns `true` if the menu was opened, or `false` if no items\n * matched the event and the menu was not opened.\n *\n * #### Notes\n * This method will populate the context menu with items which match\n * the propagation path of the event, then open the menu at the mouse\n * position indicated by the event.\n */\n open(event: MouseEvent): boolean {\n // Prior to any DOM modifications update the window data.\n Menu.saveWindowData();\n\n // Clear the current contents of the context menu.\n this.menu.clearItems();\n\n // Bail early if there are no items to match.\n if (this._items.length === 0) {\n return false;\n }\n\n // Find the matching items for the event.\n let items = Private.matchItems(\n this._items,\n event,\n this._groupByTarget,\n this._sortBySelector\n );\n\n // Bail if there are no matching items.\n if (!items || items.length === 0) {\n return false;\n }\n\n // Add the filtered items to the menu.\n for (const item of items) {\n this.menu.addItem(item);\n }\n\n // Open the context menu at the current mouse position.\n this.menu.open(event.clientX, event.clientY);\n\n // Indicate success.\n return true;\n }\n\n private _groupByTarget: boolean = true;\n private _idTick = 0;\n private _items: Private.IItem[] = [];\n private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n /**\n * An options object for initializing a context menu.\n */\n export interface IOptions {\n /**\n * The command registry to use with the context menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the context menu.\n */\n renderer?: Menu.IRenderer;\n\n /**\n * Whether to sort by selector and rank or only rank.\n *\n * Default true.\n */\n sortBySelector?: boolean;\n\n /**\n * Whether to group items following the DOM hierarchy.\n *\n * Default true.\n *\n * #### Note\n * If true, when the mouse event occurs on element `span` within `div.top`,\n * the items matching `div.top` will be shown before the ones matching `body`.\n */\n groupByTarget?: boolean;\n }\n\n /**\n * An options object for creating a context menu item.\n */\n export interface IItemOptions extends Menu.IItemOptions {\n /**\n * The CSS selector for the context menu item.\n *\n * The context menu item will only be displayed in the context menu\n * when the selector matches a node on the propagation path of the\n * contextmenu event. This allows the menu item to be restricted to\n * user-defined contexts.\n *\n * The selector must not contain commas.\n */\n selector: string;\n\n /**\n * The rank for the item.\n *\n * The rank is used as a tie-breaker when ordering context menu\n * items for display. Items are sorted in the following order:\n * 1. Depth in the DOM tree (deeper is better)\n * 2. Selector specificity (higher is better)\n * 3. Rank (lower is better)\n * 4. Insertion order\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A normalized item for a context menu.\n */\n export interface IItem extends Menu.IItemOptions {\n /**\n * The selector for the item.\n */\n selector: string;\n\n /**\n * The rank for the item.\n */\n rank: number;\n\n /**\n * The tie-breaking id for the item.\n */\n id: number;\n }\n\n /**\n * Create a normalized context menu item from an options object.\n */\n export function createItem(\n options: ContextMenu.IItemOptions,\n id: number\n ): IItem {\n let selector = validateSelector(options.selector);\n let rank = options.rank !== undefined ? options.rank : Infinity;\n return { ...options, selector, rank, id };\n }\n\n /**\n * Find the items which match a context menu event.\n *\n * The results are sorted by DOM level, specificity, and rank.\n */\n export function matchItems(\n items: IItem[],\n event: MouseEvent,\n groupByTarget: boolean,\n sortBySelector: boolean\n ): IItem[] | null {\n // Look up the target of the event.\n let target = event.target as Element | null;\n\n // Bail if there is no target.\n if (!target) {\n return null;\n }\n\n // Look up the current target of the event.\n let currentTarget = event.currentTarget as Element | null;\n\n // Bail if there is no current target.\n if (!currentTarget) {\n return null;\n }\n\n // There are some third party libraries that cause the `target` to\n // be detached from the DOM before lumino can process the event.\n // If that happens, search for a new target node by point. If that\n // node is still dangling, bail.\n if (!currentTarget.contains(target)) {\n target = document.elementFromPoint(event.clientX, event.clientY);\n if (!target || !currentTarget.contains(target)) {\n return null;\n }\n }\n\n // Set up the result array.\n let result: IItem[] = [];\n\n // Copy the items array to allow in-place modification.\n let availableItems: Array = items.slice();\n\n // Walk up the DOM hierarchy searching for matches.\n while (target !== null) {\n // Set up the match array for this DOM level.\n let matches: IItem[] = [];\n\n // Search the remaining items for matches.\n for (let i = 0, n = availableItems.length; i < n; ++i) {\n // Fetch the item.\n let item = availableItems[i];\n\n // Skip items which are already consumed.\n if (!item) {\n continue;\n }\n\n // Skip items which do not match the element.\n if (!Selector.matches(target, item.selector)) {\n continue;\n }\n\n // Add the matched item to the result for this DOM level.\n matches.push(item);\n\n // Mark the item as consumed.\n availableItems[i] = null;\n }\n\n // Sort the matches for this level and add them to the results.\n if (matches.length !== 0) {\n if (groupByTarget) {\n matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n result.push(...matches);\n }\n\n // Stop searching at the limits of the DOM range.\n if (target === currentTarget) {\n break;\n }\n\n // Step to the parent DOM level.\n target = target.parentElement;\n }\n\n if (!groupByTarget) {\n result.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n\n // Return the matched and sorted results.\n return result;\n }\n\n /**\n * Validate the selector for a menu item.\n *\n * This returns the validated selector, or throws if the selector is\n * invalid or contains commas.\n */\n function validateSelector(selector: string): string {\n if (selector.indexOf(',') !== -1) {\n throw new Error(`Selector cannot contain commas: ${selector}`);\n }\n if (!Selector.isValid(selector)) {\n throw new Error(`Invalid selector: ${selector}`);\n }\n return selector;\n }\n\n /**\n * A sort comparison function for a context menu item by ranks.\n */\n function itemCmpRank(a: IItem, b: IItem): number {\n // Sort based on rank.\n let r1 = a.rank;\n let r2 = b.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity-safe\n }\n\n // When all else fails, sort by item id.\n return a.id - b.id;\n }\n\n /**\n * A sort comparison function for a context menu item by selectors and ranks.\n */\n function itemCmp(a: IItem, b: IItem): number {\n // Sort first based on selector specificity.\n let s1 = Selector.calculateSpecificity(a.selector);\n let s2 = Selector.calculateSpecificity(b.selector);\n if (s1 !== s2) {\n return s2 - s1;\n }\n\n // If specificities are equal\n return itemCmpRank(a, b);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ElementARIAAttrs,\n ElementBaseAttrs,\n ElementDataset,\n ElementInlineStyle,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n 'ArrowLeft',\n 'ArrowUp',\n 'ArrowRight',\n 'ArrowDown',\n 'Home',\n 'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar extends Widget {\n /**\n * Construct a new tab bar.\n *\n * @param options - The options for initializing the tab bar.\n */\n constructor(options: TabBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-TabBar');\n this.contentNode.setAttribute('role', 'tablist');\n this.setFlag(Widget.Flag.DisallowLayout);\n this._document = options.document || document;\n this.tabsMovable = options.tabsMovable || false;\n this.titlesEditable = options.titlesEditable || false;\n this.allowDeselect = options.allowDeselect || false;\n this.addButtonEnabled = options.addButtonEnabled || false;\n this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n this.name = options.name || '';\n this.orientation = options.orientation || 'horizontal';\n this.removeBehavior = options.removeBehavior || 'select-tab-after';\n this.renderer = options.renderer || TabBar.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._releaseMouse();\n this._titles.length = 0;\n this._previousTitle = null;\n super.dispose();\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when a tab is moved by the user.\n *\n * #### Notes\n * This signal is emitted when a tab is moved by user interaction.\n *\n * This signal is not emitted when a tab is moved programmatically.\n */\n get tabMoved(): ISignal> {\n return this._tabMoved;\n }\n\n /**\n * A signal emitted when a tab is clicked by the user.\n *\n * #### Notes\n * If the clicked tab is not the current tab, the clicked tab will be\n * made current and the `currentChanged` signal will be emitted first.\n *\n * This signal is emitted even if the clicked tab is the current tab.\n */\n get tabActivateRequested(): ISignal<\n this,\n TabBar.ITabActivateRequestedArgs\n > {\n return this._tabActivateRequested;\n }\n\n /**\n * A signal emitted when the tab bar add button is clicked.\n */\n get addRequested(): ISignal {\n return this._addRequested;\n }\n\n /**\n * A signal emitted when a tab close icon is clicked.\n *\n * #### Notes\n * This signal is not emitted unless the tab title is `closable`.\n */\n get tabCloseRequested(): ISignal> {\n return this._tabCloseRequested;\n }\n\n /**\n * A signal emitted when a tab is dragged beyond the detach threshold.\n *\n * #### Notes\n * This signal is emitted when the user drags a tab with the mouse,\n * and mouse is dragged beyond the detach threshold.\n *\n * The consumer of the signal should call `releaseMouse` and remove\n * the tab in order to complete the detach.\n *\n * This signal is only emitted once per drag cycle.\n */\n get tabDetachRequested(): ISignal> {\n return this._tabDetachRequested;\n }\n\n /**\n * The renderer used by the tab bar.\n */\n readonly renderer: TabBar.IRenderer;\n\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n get document(): Document | ShadowRoot {\n return this._document;\n }\n\n /**\n * Whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n tabsMovable: boolean;\n\n /**\n * Whether the titles can be user-edited.\n *\n */\n get titlesEditable(): boolean {\n return this._titlesEditable;\n }\n\n /**\n * Set whether titles can be user edited.\n *\n */\n set titlesEditable(value: boolean) {\n this._titlesEditable = value;\n }\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * #### Notes\n * Tabs can be always be deselected programmatically.\n */\n allowDeselect: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n */\n insertBehavior: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n */\n removeBehavior: TabBar.RemoveBehavior;\n\n /**\n * Get the currently selected title.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get currentTitle(): Title | null {\n return this._titles[this._currentIndex] || null;\n }\n\n /**\n * Set the currently selected title.\n *\n * #### Notes\n * If the title does not exist, the title will be set to `null`.\n */\n set currentTitle(value: Title | null) {\n this.currentIndex = value ? this._titles.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this._currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `-1`.\n */\n set currentIndex(value: number) {\n // Adjust for an out of range index.\n if (value < 0 || value >= this._titles.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._currentIndex === value) {\n return;\n }\n\n // Look up the previous index and title.\n let pi = this._currentIndex;\n let pt = this._titles[pi] || null;\n\n // Look up the current index and title.\n let ci = value;\n let ct = this._titles[ci] || null;\n\n // Update the current index and previous title.\n this._currentIndex = ci;\n this._previousTitle = pt;\n\n // Schedule an update of the tabs.\n this.update();\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: ci,\n currentTitle: ct\n });\n }\n\n /**\n * Get the name of the tab bar.\n */\n get name(): string {\n return this._name;\n }\n\n /**\n * Set the name of the tab bar.\n */\n set name(value: string) {\n this._name = value;\n if (value) {\n this.contentNode.setAttribute('aria-label', value);\n } else {\n this.contentNode.removeAttribute('aria-label');\n }\n }\n\n /**\n * Get the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n get orientation(): TabBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n set orientation(value: TabBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Toggle the orientation values.\n this._orientation = value;\n this.dataset['orientation'] = value;\n this.contentNode.setAttribute('aria-orientation', value);\n }\n\n /**\n * Whether the add button is enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add button is enabled.\n */\n set addButtonEnabled(value: boolean) {\n // Do nothing if the value does not change.\n if (this._addButtonEnabled === value) {\n return;\n }\n\n this._addButtonEnabled = value;\n if (value) {\n this.addButtonNode.classList.remove('lm-mod-hidden');\n } else {\n this.addButtonNode.classList.add('lm-mod-hidden');\n }\n }\n\n /**\n * A read-only array of the titles in the tab bar.\n */\n get titles(): ReadonlyArray> {\n return this._titles;\n }\n\n /**\n * The tab bar content node.\n *\n * #### Notes\n * This is the node which holds the tab nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * The tab bar add button node.\n *\n * #### Notes\n * This is the node which holds the add button.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get addButtonNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-addButton'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Add a tab to the end of the tab bar.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * If the title is already added to the tab bar, it will be moved.\n */\n addTab(value: Title | Title.IOptions): Title {\n return this.insertTab(this._titles.length, value);\n }\n\n /**\n * Insert a tab into the tab bar at the specified index.\n *\n * @param index - The index at which to insert the tab.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the tabs.\n *\n * If the title is already added to the tab bar, it will be moved.\n */\n insertTab(index: number, value: Title | Title.IOptions): Title {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Coerce the value to a title.\n let title = Private.asTitle(value);\n\n // Look up the index of the title.\n let i = this._titles.indexOf(title);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._titles.length));\n\n // If the title is not in the array, insert it.\n if (i === -1) {\n // Insert the title into the array.\n ArrayExt.insert(this._titles, j, title);\n\n // Connect to the title changed signal.\n title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the insert.\n this._adjustCurrentForInsert(j, title);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n // Otherwise, the title exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._titles.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return title;\n }\n\n // Move the title to the new location.\n ArrayExt.move(this._titles, i, j);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n /**\n * Remove a tab from the tab bar.\n *\n * @param title - The title for the tab to remove.\n *\n * #### Notes\n * This is a no-op if the title is not in the tab bar.\n */\n removeTab(title: Title): void {\n this.removeTabAt(this._titles.indexOf(title));\n }\n\n /**\n * Remove the tab at a given index from the tab bar.\n *\n * @param index - The index of the tab to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeTabAt(index: number): void {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Remove the title from the array.\n let title = ArrayExt.removeAt(this._titles, index);\n\n // Bail if the index is out of range.\n if (!title) {\n return;\n }\n\n // Disconnect from the title changed signal.\n title.changed.disconnect(this._onTitleChanged, this);\n\n // Clear the previous title if it's being removed.\n if (title === this._previousTitle) {\n this._previousTitle = null;\n }\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the remove.\n this._adjustCurrentForRemove(index, title);\n }\n\n /**\n * Remove all tabs from the tab bar.\n */\n clearTabs(): void {\n // Bail if there is nothing to remove.\n if (this._titles.length === 0) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Disconnect from the title changed signals.\n for (let title of this._titles) {\n title.changed.disconnect(this._onTitleChanged, this);\n }\n\n // Get the current index and title.\n let pi = this.currentIndex;\n let pt = this.currentTitle;\n\n // Reset the current index and previous title.\n this._currentIndex = -1;\n this._previousTitle = null;\n\n // Clear the title array.\n this._titles.length = 0;\n\n // Schedule an update of the tabs.\n this.update();\n\n // If no tab was selected, there's nothing else to do.\n if (pi === -1) {\n return;\n }\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n *\n * #### Notes\n * This will cause the tab bar to stop handling mouse events and to\n * restore the tabs to their non-dragged positions.\n */\n releaseMouse(): void {\n this._releaseMouse();\n }\n\n /**\n * Handle the DOM events for the tab bar.\n *\n * @param event - The DOM event sent to the tab bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tab bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'dblclick':\n this._evtDblClick(event as MouseEvent);\n break;\n case 'keydown':\n event.eventPhase === Event.CAPTURING_PHASE\n ? this._evtKeyDownCapturing(event as KeyboardEvent)\n : this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n this.node.addEventListener('dblclick', this);\n this.node.addEventListener('keydown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this.node.removeEventListener('dblclick', this);\n this.node.removeEventListener('keydown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let titles = this._titles;\n let renderer = this.renderer;\n let currentTitle = this.currentTitle;\n let content = new Array(titles.length);\n // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n // If the add button handles it, no need to do anything. If no element of the tab\n // bar handles it, set it on the current or the first tab to ensure one element\n // handles it after update.\n const tabHandlingTabindex =\n this._getCurrentTabindex() ??\n (this._currentIndex > -1 ? this._currentIndex : 0);\n\n for (let i = 0, n = titles.length; i < n; ++i) {\n let title = titles[i];\n let current = title === currentTitle;\n let zIndex = current ? n : n - i - 1;\n let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * Get the index of the tab which handles tabindex=\"0\".\n * If the add button handles tabindex=\"0\", -1 is returned.\n * If none of the previous handles tabindex=\"0\", null is returned.\n */\n private _getCurrentTabindex(): number | null {\n let index = null;\n const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n if (elemTabindex) {\n index = [...this.contentNode.children].indexOf(elemTabindex);\n } else if (\n this._addButtonEnabled &&\n this.addButtonNode.getAttribute('tabindex') === '0'\n ) {\n index = -1;\n }\n return index;\n }\n\n /**\n * Handle the `'dblclick'` event for the tab bar.\n */\n private _evtDblClick(event: MouseEvent): void {\n // Do nothing if titles are not editable\n if (!this.titlesEditable) {\n return;\n }\n\n let tabs = this.contentNode.children;\n\n // Find the index of the targeted tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab.\n if (index === -1) {\n return;\n }\n\n let title = this.titles[index];\n let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n if (label && label.contains(event.target as HTMLElement)) {\n let value = title.label || '';\n\n // Clear the label element\n let oldValue = label.innerHTML;\n label.innerHTML = '';\n\n let input = document.createElement('input');\n input.classList.add('lm-TabBar-tabInput');\n input.value = value;\n label.appendChild(input);\n\n let onblur = () => {\n input.removeEventListener('blur', onblur);\n label.innerHTML = oldValue;\n this.node.addEventListener('keydown', this);\n };\n\n input.addEventListener('dblclick', (event: Event) =>\n event.stopPropagation()\n );\n input.addEventListener('blur', onblur);\n input.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n if (input.value !== '') {\n title.label = title.caption = input.value;\n }\n onblur();\n } else if (event.key === 'Escape') {\n onblur();\n }\n });\n this.node.removeEventListener('keydown', this);\n input.select();\n input.focus();\n\n if (label.children.length > 0) {\n (label.children[0] as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at capturing phase.\n */\n private _evtKeyDownCapturing(event: KeyboardEvent): void {\n if (event.eventPhase !== Event.CAPTURING_PHASE) {\n return;\n }\n\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.key === 'Escape') {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at target phase.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Allow for navigation using tab key\n if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n return;\n }\n\n // Check if Enter or Spacebar key has been pressed and open that tab\n if (\n event.key === 'Enter' ||\n event.key === 'Spacebar' ||\n event.key === ' '\n ) {\n // Get focus element that is in focus by the tab key\n const focusedElement = document.activeElement;\n\n // Test first if the focus is on the add button node\n if (\n this.addButtonEnabled &&\n this.addButtonNode.contains(focusedElement)\n ) {\n event.preventDefault();\n event.stopPropagation();\n this._addRequested.emit();\n } else {\n const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n tab.contains(focusedElement)\n );\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this.currentIndex = index;\n }\n }\n // Handle the arrow keys to switch tabs.\n } else if (ARROW_KEYS.includes(event.key)) {\n // Create a list of all focusable elements in the tab bar.\n const focusable: Element[] = [...this.contentNode.children];\n if (this.addButtonEnabled) {\n focusable.push(this.addButtonNode);\n }\n // If the tab bar contains only one element, nothing to do.\n if (focusable.length <= 1) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n\n // Get the current focused element.\n let focusedIndex = focusable.indexOf(document.activeElement as Element);\n if (focusedIndex === -1) {\n focusedIndex = this._currentIndex;\n }\n\n // Find the next element to focus on.\n let nextFocused: Element | null | undefined;\n if (\n (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowDown' && this._orientation === 'vertical')\n ) {\n nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n } else if (\n (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowUp' && this._orientation === 'vertical')\n ) {\n nextFocused =\n focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n } else if (event.key === 'Home') {\n nextFocused = focusable[0];\n } else if (event.key === 'End') {\n nextFocused = focusable[focusable.length - 1];\n }\n\n // Change the focused element and the tabindex value.\n if (nextFocused) {\n focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n nextFocused?.setAttribute('tabindex', '0');\n (nextFocused as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the tab bar.\n */\n private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse press.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if a drag is in progress.\n if (this._dragData) {\n return;\n }\n\n // Do nothing if a title editable input was clicked.\n if (\n (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n ) {\n return;\n }\n\n // Check if the add button was clicked.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the pressed tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab or the add button.\n if (index === -1 && !addButtonClicked) {\n return;\n }\n\n // Pressing on a tab stops the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Initialize the non-measured parts of the drag data.\n this._dragData = {\n tab: tabs[index] as HTMLElement,\n index: index,\n pressX: event.clientX,\n pressY: event.clientY,\n tabPos: -1,\n tabSize: -1,\n tabPressPos: -1,\n targetIndex: -1,\n tabLayout: null,\n contentRect: null,\n override: null,\n dragActive: false,\n dragAborted: false,\n detachRequested: false\n };\n\n // Add the document pointer up listener.\n this.document.addEventListener('pointerup', this, true);\n\n // Do nothing else if the middle button or add button is clicked.\n if (event.button === 1 || addButtonClicked) {\n return;\n }\n\n // Do nothing else if the close icon is clicked.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n return;\n }\n\n // Add the extra listeners if the tabs are movable.\n if (this.tabsMovable) {\n this.document.addEventListener('pointermove', this, true);\n this.document.addEventListener('keydown', this, true);\n this.document.addEventListener('contextmenu', this, true);\n }\n\n // Update the current index as appropriate.\n if (this.allowDeselect && this.currentIndex === index) {\n this.currentIndex = -1;\n } else {\n this.currentIndex = index;\n }\n\n // Do nothing else if there is no current tab.\n if (this.currentIndex === -1) {\n return;\n }\n\n // Emit the tab activate request signal.\n this._tabActivateRequested.emit({\n index: this.currentIndex,\n title: this.currentTitle!\n });\n }\n\n /**\n * Handle the `'pointermove'` event for the tab bar.\n */\n private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Suppress the event during a drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Bail early if the drag threshold has not been met.\n if (!data.dragActive && !Private.dragExceeded(data, event)) {\n return;\n }\n\n // Activate the drag if necessary.\n if (!data.dragActive) {\n // Fill in the rest of the drag data measurements.\n let tabRect = data.tab.getBoundingClientRect();\n if (this._orientation === 'horizontal') {\n data.tabPos = data.tab.offsetLeft;\n data.tabSize = tabRect.width;\n data.tabPressPos = data.pressX - tabRect.left;\n } else {\n data.tabPos = data.tab.offsetTop;\n data.tabSize = tabRect.height;\n data.tabPressPos = data.pressY - tabRect.top;\n }\n data.tabPressOffset = {\n x: data.pressX - tabRect.left,\n y: data.pressY - tabRect.top\n };\n data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n data.contentRect = this.contentNode.getBoundingClientRect();\n data.override = Drag.overrideCursor('default');\n\n // Add the dragging style classes.\n data.tab.classList.add('lm-mod-dragging');\n this.addClass('lm-mod-dragging');\n\n // Mark the drag as active.\n data.dragActive = true;\n }\n\n // Emit the detach requested signal if the threshold is exceeded.\n if (!data.detachRequested && Private.detachExceeded(data, event)) {\n // Only emit the signal once per drag cycle.\n data.detachRequested = true;\n\n // Setup the arguments for the signal.\n let index = data.index;\n let clientX = event.clientX;\n let clientY = event.clientY;\n let tab = tabs[index] as HTMLElement;\n let title = this._titles[index];\n\n // Emit the tab detach requested signal.\n this._tabDetachRequested.emit({\n index,\n title,\n tab,\n clientX,\n clientY,\n offset: data.tabPressOffset\n });\n\n // Bail if the signal handler aborted the drag.\n if (data.dragAborted) {\n return;\n }\n }\n\n // Update the positions of the tabs.\n Private.layoutTabs(tabs, data, event, this._orientation);\n }\n\n /**\n * Handle the `'pointerup'` event for the document.\n */\n private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse release.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if no drag is in progress.\n const data = this._dragData;\n if (!data) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Remove the extra mouse event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Handle a release when the drag is not active.\n if (!data.dragActive) {\n // Clear the drag data.\n this._dragData = null;\n\n // Handle clicking the add button.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n if (addButtonClicked) {\n this._addRequested.emit(undefined);\n return;\n }\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the released tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the release is not on the original pressed tab.\n if (index !== data.index) {\n return;\n }\n\n // Ignore the release if the title is not closable.\n let title = this._titles[index];\n if (!title.closable) {\n return;\n }\n\n // Emit the close requested signal if the middle button is released.\n if (event.button === 1) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Emit the close requested signal if the close icon was released.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Otherwise, there is nothing left to do.\n return;\n }\n\n // Do nothing if the left button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Position the tab at its final resting position.\n Private.finalizeTabPosition(data, this._orientation);\n\n // Remove the dragging class from the tab so it can be transitioned.\n data.tab.classList.remove('lm-mod-dragging');\n\n // Parse the transition duration for releasing the tab.\n let duration = Private.parseTransitionDuration(data.tab);\n\n // Complete the release on a timer to allow the tab to transition.\n setTimeout(() => {\n // Do nothing if the drag has been aborted.\n if (data.dragAborted) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Reset the positions of the tabs.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor grab.\n data.override!.dispose();\n\n // Remove the remaining dragging style.\n this.removeClass('lm-mod-dragging');\n\n // If the tab was not moved, there is nothing else to do.\n let i = data.index;\n let j = data.targetIndex;\n if (j === -1 || i === j) {\n return;\n }\n\n // Move the title to the new locations.\n ArrayExt.move(this._titles, i, j);\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Emit the tab moved signal.\n this._tabMoved.emit({\n fromIndex: i,\n toIndex: j,\n title: this._titles[j]\n });\n\n // Update the tabs immediately to prevent flicker.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n }, duration);\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n */\n private _releaseMouse(): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Remove the extra document event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Indicate the drag has been aborted. This allows the mouse\n // event handlers to return early when the drag is canceled.\n data.dragAborted = true;\n\n // If the drag is not active, there's nothing more to do.\n if (!data.dragActive) {\n return;\n }\n\n // Reset the tabs to their non-dragged positions.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor override.\n data.override!.dispose();\n\n // Clear the dragging style classes.\n data.tab.classList.remove('lm-mod-dragging');\n this.removeClass('lm-mod-dragging');\n }\n\n /**\n * Adjust the current index for a tab insert operation.\n *\n * This method accounts for the tab bar's insertion behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForInsert(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ct = this.currentTitle;\n let ci = this._currentIndex;\n let bh = this.insertBehavior;\n\n // TODO: do we need to do an update to update the aria-selected attribute?\n\n // Handle the behavior where the new tab is always selected,\n // or the behavior where the new tab is selected if needed.\n if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n this._currentIndex = i;\n this._previousTitle = ct;\n this._currentChanged.emit({\n previousIndex: ci,\n previousTitle: ct,\n currentIndex: i,\n currentTitle: title\n });\n return;\n }\n\n // Otherwise, silently adjust the current index if needed.\n if (ci >= i) {\n this._currentIndex++;\n }\n }\n\n /**\n * Adjust the current index for a tab move operation.\n *\n * This method will not cause the actual current tab to change.\n * It silently adjusts the index to account for the given move.\n */\n private _adjustCurrentForMove(i: number, j: number): void {\n if (this._currentIndex === i) {\n this._currentIndex = j;\n } else if (this._currentIndex < i && this._currentIndex >= j) {\n this._currentIndex++;\n } else if (this._currentIndex > i && this._currentIndex <= j) {\n this._currentIndex--;\n }\n }\n\n /**\n * Adjust the current index for a tab remove operation.\n *\n * This method accounts for the tab bar's remove behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForRemove(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ci = this._currentIndex;\n let bh = this.removeBehavior;\n\n // Silently adjust the index if the current tab is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._currentIndex--;\n }\n return;\n }\n\n // TODO: do we need to do an update to adjust the aria-selected value?\n\n // No tab gets selected if the tab bar is empty.\n if (this._titles.length === 0) {\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n return;\n }\n\n // Handle behavior where the next sibling tab is selected.\n if (bh === 'select-tab-after') {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous sibling tab is selected.\n if (bh === 'select-tab-before') {\n this._currentIndex = Math.max(0, i - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous history tab is selected.\n if (bh === 'select-previous-tab') {\n if (this._previousTitle) {\n this._currentIndex = this._titles.indexOf(this._previousTitle);\n this._previousTitle = null;\n } else {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n }\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Otherwise, no tab gets selected.\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n this.update();\n }\n\n private _name: string;\n private _currentIndex = -1;\n private _titles: Title[] = [];\n private _orientation: TabBar.Orientation;\n private _document: Document | ShadowRoot;\n private _titlesEditable: boolean = false;\n private _previousTitle: Title | null = null;\n private _dragData: Private.IDragData | null = null;\n private _addButtonEnabled: boolean = false;\n private _tabMoved = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n private _addRequested = new Signal(this);\n private _tabCloseRequested = new Signal<\n this,\n TabBar.ITabCloseRequestedArgs\n >(this);\n private _tabDetachRequested = new Signal<\n this,\n TabBar.ITabDetachRequestedArgs\n >(this);\n private _tabActivateRequested = new Signal<\n this,\n TabBar.ITabActivateRequestedArgs\n >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n /**\n * A type alias for a tab bar orientation.\n */\n export type Orientation =\n | /**\n * The tabs are arranged in a single row, left-to-right.\n *\n * The tab text orientation is horizontal.\n */\n 'horizontal'\n\n /**\n * The tabs are arranged in a single column, top-to-bottom.\n *\n * The tab text orientation is horizontal.\n */\n | 'vertical';\n\n /**\n * A type alias for the selection behavior on tab insert.\n */\n export type InsertBehavior =\n | /**\n * The selected tab will not be changed.\n */\n 'none'\n\n /**\n * The inserted tab will be selected.\n */\n | 'select-tab'\n\n /**\n * The inserted tab will be selected if the current tab is null.\n */\n | 'select-tab-if-needed';\n\n /**\n * A type alias for the selection behavior on tab remove.\n */\n export type RemoveBehavior =\n | /**\n * No tab will be selected.\n */\n 'none'\n\n /**\n * The tab after the removed tab will be selected if possible.\n */\n | 'select-tab-after'\n\n /**\n * The tab before the removed tab will be selected if possible.\n */\n | 'select-tab-before'\n\n /**\n * The previously selected tab will be selected if possible.\n */\n | 'select-previous-tab';\n\n /**\n * An options object for creating a tab bar.\n */\n export interface IOptions {\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n\n /**\n * Name of the tab bar.\n *\n * This is used for accessibility reasons. The default is the empty string.\n */\n name?: string;\n\n /**\n * The layout orientation of the tab bar.\n *\n * The default is `horizontal`.\n */\n orientation?: TabBar.Orientation;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * The default is `false`.\n */\n allowDeselect?: boolean;\n\n /**\n * Whether the titles can be directly edited by the user.\n *\n * The default is `false`.\n */\n titlesEditable?: boolean;\n\n /**\n * Whether the add button is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n *\n * The default is `'select-tab-if-needed'`.\n */\n insertBehavior?: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n *\n * The default is `'select-tab-after'`.\n */\n removeBehavior?: TabBar.RemoveBehavior;\n\n /**\n * A renderer to use with the tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n readonly previousIndex: number;\n\n /**\n * The previously selected title.\n */\n readonly previousTitle: Title | null;\n\n /**\n * The currently selected index.\n */\n readonly currentIndex: number;\n\n /**\n * The currently selected title.\n */\n readonly currentTitle: Title | null;\n }\n\n /**\n * The arguments object for the `tabMoved` signal.\n */\n export interface ITabMovedArgs {\n /**\n * The previous index of the tab.\n */\n readonly fromIndex: number;\n\n /**\n * The current index of the tab.\n */\n readonly toIndex: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabActivateRequested` signal.\n */\n export interface ITabActivateRequestedArgs {\n /**\n * The index of the tab to activate.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabCloseRequested` signal.\n */\n export interface ITabCloseRequestedArgs {\n /**\n * The index of the tab to close.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabDetachRequested` signal.\n */\n export interface ITabDetachRequestedArgs {\n /**\n * The index of the tab to detach.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n\n /**\n * The node representing the tab.\n */\n readonly tab: HTMLElement;\n\n /**\n * The current client X position of the mouse.\n */\n readonly clientX: number;\n\n /**\n * The current client Y position of the mouse.\n */\n readonly clientY: number;\n\n /**\n * The mouse position in the tab coordinate.\n */\n readonly offset?: { x: number; y: number };\n }\n\n /**\n * An object which holds the data to render a tab.\n */\n export interface IRenderData {\n /**\n * The title associated with the tab.\n */\n readonly title: Title;\n\n /**\n * Whether the tab is the current tab.\n */\n readonly current: boolean;\n\n /**\n * The z-index for the tab.\n */\n readonly zIndex: number;\n\n /**\n * The tabindex value for the tab.\n */\n readonly tabIndex?: number;\n }\n\n /**\n * A renderer for use with a tab bar.\n */\n export interface IRenderer {\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector: string;\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n constructor() {\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement {\n let title = data.title.caption;\n let key = this.createTabKey(data);\n let id = key;\n let style = this.createTabStyle(data);\n let className = this.createTabClass(data);\n let dataset = this.createTabDataset(data);\n let aria = this.createTabARIA(data);\n if (data.title.closable) {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderCloseIcon(data)\n );\n } else {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n }\n\n /**\n * Render the icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n const { title } = data;\n let className = this.createIconClass(data);\n\n // If title.icon is undefined, it will be ignored.\n return h.div({ className }, title.icon!, title.iconLabel);\n }\n\n /**\n * Render the label element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n }\n\n /**\n * Render the close icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab close icon.\n */\n renderCloseIcon(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n }\n\n /**\n * Create a unique render key for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The unique render key for the tab.\n *\n * #### Notes\n * This method caches the key against the tab title the first time\n * the key is generated. This enables efficient rendering of moved\n * tabs and avoids subtle hover style artifacts.\n */\n createTabKey(data: IRenderData): string {\n let key = this._tabKeys.get(data.title);\n if (key === undefined) {\n key = `tab-key-${this._uuid}-${this._tabID++}`;\n this._tabKeys.set(data.title, key);\n }\n return key;\n }\n\n /**\n * Create the inline style object for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The inline style data for the tab.\n */\n createTabStyle(data: IRenderData): ElementInlineStyle {\n return { zIndex: `${data.zIndex}` };\n }\n\n /**\n * Create the class name for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab.\n */\n createTabClass(data: IRenderData): string {\n let name = 'lm-TabBar-tab';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.title.closable) {\n name += ' lm-mod-closable';\n }\n if (data.current) {\n name += ' lm-mod-current';\n }\n return name;\n }\n\n /**\n * Create the dataset for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The dataset for the tab.\n */\n createTabDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the ARIA attributes for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The ARIA attributes for the tab.\n */\n createTabARIA(data: IRenderData): ElementARIAAttrs | ElementBaseAttrs {\n return {\n role: 'tab',\n 'aria-selected': data.current.toString(),\n tabindex: `${data.tabIndex ?? '-1'}`\n };\n }\n\n /**\n * Create the class name for the tab icon.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-TabBar-tabIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _tabID = 0;\n private _tabKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * A selector which matches the add button node in the tab bar.\n */\n export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The start drag distance threshold.\n */\n export const DRAG_THRESHOLD = 5;\n\n /**\n * The detach distance threshold.\n */\n export const DETACH_THRESHOLD = 20;\n\n /**\n * A struct which holds the drag data for a tab bar.\n */\n export interface IDragData {\n /**\n * The tab node being dragged.\n */\n tab: HTMLElement;\n\n /**\n * The index of the tab being dragged.\n */\n index: number;\n\n /**\n * The mouse press client X position.\n */\n pressX: number;\n\n /**\n * The mouse press client Y position.\n */\n pressY: number;\n\n /**\n * The offset left/top of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPos: number;\n\n /**\n * The offset width/height of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabSize: number;\n\n /**\n * The original mouse X/Y position in tab coordinates.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPressPos: number;\n\n /**\n * The original mouse position in tab coordinates.\n *\n * This is undefined if the drag is not active.\n */\n tabPressOffset?: { x: number; y: number };\n\n /**\n * The tab target index upon mouse release.\n *\n * This will be `-1` if the drag is not active.\n */\n targetIndex: number;\n\n /**\n * The array of tab layout objects snapped at drag start.\n *\n * This will be `null` if the drag is not active.\n */\n tabLayout: ITabLayout[] | null;\n\n /**\n * The bounding client rect of the tab bar content node.\n *\n * This will be `null` if the drag is not active.\n */\n contentRect: DOMRect | null;\n\n /**\n * The disposable to clean up the cursor override.\n *\n * This will be `null` if the drag is not active.\n */\n override: IDisposable | null;\n\n /**\n * Whether the drag is currently active.\n */\n dragActive: boolean;\n\n /**\n * Whether the drag has been aborted.\n */\n dragAborted: boolean;\n\n /**\n * Whether a detach request as been made.\n */\n detachRequested: boolean;\n }\n\n /**\n * An object which holds layout data for a tab.\n */\n export interface ITabLayout {\n /**\n * The left/top margin value for the tab.\n */\n margin: number;\n\n /**\n * The offset left/top position of the tab.\n */\n pos: number;\n\n /**\n * The offset width/height of the tab.\n */\n size: number;\n }\n\n /**\n * Create the DOM node for a tab bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.setAttribute('role', 'tablist');\n content.className = 'lm-TabBar-content';\n node.appendChild(content);\n\n let add = document.createElement('div');\n add.className = 'lm-TabBar-addButton lm-mod-hidden';\n add.setAttribute('tabindex', '-1');\n add.setAttribute('role', 'button');\n node.appendChild(add);\n return node;\n }\n\n /**\n * Coerce a title or options into a real title.\n */\n export function asTitle(value: Title | Title.IOptions): Title {\n return value instanceof Title ? value : new Title(value);\n }\n\n /**\n * Parse the transition duration for a tab node.\n */\n export function parseTransitionDuration(tab: HTMLElement): number {\n let style = window.getComputedStyle(tab);\n return 1000 * (parseFloat(style.transitionDuration!) || 0);\n }\n\n /**\n * Get a snapshot of the current tab layout values.\n */\n export function snapTabLayout(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): ITabLayout[] {\n let layout = new Array(tabs.length);\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let node = tabs[i] as HTMLElement;\n let style = window.getComputedStyle(node);\n if (orientation === 'horizontal') {\n layout[i] = {\n pos: node.offsetLeft,\n size: node.offsetWidth,\n margin: parseFloat(style.marginLeft!) || 0\n };\n } else {\n layout[i] = {\n pos: node.offsetTop,\n size: node.offsetHeight,\n margin: parseFloat(style.marginTop!) || 0\n };\n }\n }\n return layout;\n }\n\n /**\n * Test if the event exceeds the drag threshold.\n */\n export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n let dx = Math.abs(event.clientX - data.pressX);\n let dy = Math.abs(event.clientY - data.pressY);\n return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n }\n\n /**\n * Test if the event exceeds the drag detach threshold.\n */\n export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n let rect = data.contentRect!;\n return (\n event.clientX < rect.left - DETACH_THRESHOLD ||\n event.clientX >= rect.right + DETACH_THRESHOLD ||\n event.clientY < rect.top - DETACH_THRESHOLD ||\n event.clientY >= rect.bottom + DETACH_THRESHOLD\n );\n }\n\n /**\n * Update the relative tab positions and computed target index.\n */\n export function layoutTabs(\n tabs: HTMLCollection,\n data: IDragData,\n event: MouseEvent,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive values.\n let pressPos: number;\n let localPos: number;\n let clientPos: number;\n let clientSize: number;\n if (orientation === 'horizontal') {\n pressPos = data.pressX;\n localPos = event.clientX - data.contentRect!.left;\n clientPos = event.clientX;\n clientSize = data.contentRect!.width;\n } else {\n pressPos = data.pressY;\n localPos = event.clientY - data.contentRect!.top;\n clientPos = event.clientY;\n clientSize = data.contentRect!.height;\n }\n\n // Compute the target data.\n let targetIndex = data.index;\n let targetPos = localPos - data.tabPressPos;\n let targetEnd = targetPos + data.tabSize;\n\n // Update the relative tab positions.\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let pxPos: string;\n let layout = data.tabLayout![i];\n let threshold = layout.pos + (layout.size >> 1);\n if (i < data.index && targetPos < threshold) {\n pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n targetIndex = Math.min(targetIndex, i);\n } else if (i > data.index && targetEnd > threshold) {\n pxPos = `${-data.tabSize - layout.margin}px`;\n targetIndex = Math.max(targetIndex, i);\n } else if (i === data.index) {\n let ideal = clientPos - pressPos;\n let limit = clientSize - (data.tabPos + data.tabSize);\n pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n } else {\n pxPos = '';\n }\n if (orientation === 'horizontal') {\n (tabs[i] as HTMLElement).style.left = pxPos;\n } else {\n (tabs[i] as HTMLElement).style.top = pxPos;\n }\n }\n\n // Update the computed target index.\n data.targetIndex = targetIndex;\n }\n\n /**\n * Position the drag tab at its final resting relative position.\n */\n export function finalizeTabPosition(\n data: IDragData,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive client size.\n let clientSize: number;\n if (orientation === 'horizontal') {\n clientSize = data.contentRect!.width;\n } else {\n clientSize = data.contentRect!.height;\n }\n\n // Compute the ideal final tab position.\n let ideal: number;\n if (data.targetIndex === data.index) {\n ideal = 0;\n } else if (data.targetIndex > data.index) {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n } else {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos - data.tabPos;\n }\n\n // Compute the tab position limit.\n let limit = clientSize - (data.tabPos + data.tabSize);\n let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n // Set the final orientation-sensitive position.\n if (orientation === 'horizontal') {\n data.tab.style.left = `${final}px`;\n } else {\n data.tab.style.top = `${final}px`;\n }\n }\n\n /**\n * Reset the relative positions of the given tabs.\n */\n export function resetTabPositions(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): void {\n for (const tab of tabs) {\n if (orientation === 'horizontal') {\n (tab as HTMLElement).style.left = '';\n } else {\n (tab as HTMLElement).style.top = '';\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n /**\n * Construct a new dock layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: DockLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n this._document = options.document || document;\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n */\n dispose(): void {\n // Get an iterator over the widgets in the layout.\n let widgets = this[Symbol.iterator]();\n\n // Dispose of the layout items.\n this._items.forEach(item => {\n item.dispose();\n });\n\n // Clear the layout state before disposing the widgets.\n this._box = null;\n this._root = null;\n this._items.clear();\n\n // Dispose of the widgets contained in the old layout root.\n for (const widget of widgets) {\n widget.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The renderer used by the dock layout.\n */\n readonly renderer: DockLayout.IRenderer;\n\n /**\n * The method for hiding child widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n for (const bar of this.tabBars()) {\n if (bar.titles.length > 1) {\n for (const title of bar.titles) {\n title.owner.hiddenMode = this._hiddenMode;\n }\n }\n }\n }\n\n /**\n * Get the inter-element spacing for the dock layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the dock layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Whether the dock layout is empty.\n */\n get isEmpty(): boolean {\n return this._root === null;\n }\n\n /**\n * Create an iterator over all widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This iterator includes the generated tab bars.\n */\n [Symbol.iterator](): IterableIterator {\n return this._root ? this._root.iterAllWidgets() : empty();\n }\n\n /**\n * Create an iterator over the user widgets in the layout.\n *\n * @returns A new iterator over the user widgets in the layout.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n widgets(): IterableIterator {\n return this._root ? this._root.iterUserWidgets() : empty();\n }\n\n /**\n * Create an iterator over the selected widgets in the layout.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the layout.\n */\n selectedWidgets(): IterableIterator {\n return this._root ? this._root.iterSelectedWidgets() : empty();\n }\n\n /**\n * Create an iterator over the tab bars in the layout.\n *\n * @returns A new iterator over the tab bars in the layout.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n tabBars(): IterableIterator> {\n return this._root ? this._root.iterTabBars() : empty();\n }\n\n /**\n * Create an iterator over the handles in the layout.\n *\n * @returns A new iterator over the handles in the layout.\n */\n handles(): IterableIterator {\n return this._root ? this._root.iterHandles() : empty();\n }\n\n /**\n * Move a handle to the given offset position.\n *\n * @param handle - The handle to move.\n *\n * @param offsetX - The desired offset X position of the handle.\n *\n * @param offsetY - The desired offset Y position of the handle.\n *\n * #### Notes\n * If the given handle is not contained in the layout, this is no-op.\n *\n * The handle will be moved as close as possible to the desired\n * position without violating any of the layout constraints.\n *\n * Only one of the coordinates is used depending on the orientation\n * of the handle. This method accepts both coordinates to make it\n * easy to invoke from a mouse move event without needing to know\n * the handle orientation.\n */\n moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n // Bail early if there is no root or if the handle is hidden.\n let hidden = handle.classList.contains('lm-mod-hidden');\n if (!this._root || hidden) {\n return;\n }\n\n // Lookup the split node for the handle.\n let data = this._root.findSplitNode(handle);\n if (!data) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (data.node.orientation === 'horizontal') {\n delta = offsetX - handle.offsetLeft;\n } else {\n delta = offsetY - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent sibling resizing unless needed.\n data.node.holdSizes();\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Save the current configuration of the dock layout.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockLayout.ILayoutConfig {\n // Bail early if there is no root.\n if (!this._root) {\n return { main: null };\n }\n\n // Hold the current sizes in the layout tree.\n this._root.holdAllSizes();\n\n // Return the layout config.\n return { main: this._root.createConfig() };\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n */\n restoreLayout(config: DockLayout.ILayoutConfig): void {\n // Create the widget set for validating the config.\n let widgetSet = new Set();\n\n // Normalize the main area config and collect the widgets.\n let mainConfig: DockLayout.AreaConfig | null;\n if (config.main) {\n mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n } else {\n mainConfig = null;\n }\n\n // Create iterators over the old content.\n let oldWidgets = this.widgets();\n let oldTabBars = this.tabBars();\n let oldHandles = this.handles();\n\n // Clear the root before removing the old content.\n this._root = null;\n\n // Unparent the old widgets which are not in the new config.\n for (const widget of oldWidgets) {\n if (!widgetSet.has(widget)) {\n widget.parent = null;\n }\n }\n\n // Dispose of the old tab bars.\n for (const tabBar of oldTabBars) {\n tabBar.dispose();\n }\n\n // Remove the old handles.\n for (const handle of oldHandles) {\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n }\n\n // Reparent the new widgets to the current parent.\n for (const widget of widgetSet) {\n widget.parent = this.parent;\n }\n\n // Create the root node for the new config.\n if (mainConfig) {\n this._root = Private.realizeAreaConfig(\n mainConfig,\n {\n // Ignoring optional `document` argument as we must reuse `this._document`\n createTabBar: (document?: Document | ShadowRoot) =>\n this._createTabBar(),\n createHandle: () => this._createHandle()\n },\n this._document\n );\n } else {\n this._root = null;\n }\n\n // If there is no parent, there is nothing more to do.\n if (!this.parent) {\n return;\n }\n\n // Attach the new widgets to the parent.\n widgetSet.forEach(widget => {\n this.attachWidget(widget);\n });\n\n // Post a fit request to the parent.\n this.parent.fit();\n }\n\n /**\n * Add a widget to the dock layout.\n *\n * @param widget - The widget to add to the dock layout.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * The widget will be moved if it is already contained in the layout.\n *\n * An error will be thrown if the reference widget is invalid.\n */\n addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n // Parse the options.\n let ref = options.ref || null;\n let mode = options.mode || 'tab-after';\n\n // Find the tab node which holds the reference widget.\n let refNode: Private.TabLayoutNode | null = null;\n if (this._root && ref) {\n refNode = this._root.findTabNode(ref);\n }\n\n // Throw an error if the reference widget is invalid.\n if (ref && !refNode) {\n throw new Error('Reference widget is not in the layout.');\n }\n\n // Reparent the widget to the current layout parent.\n widget.parent = this.parent;\n\n // Insert the widget according to the insert mode.\n switch (mode) {\n case 'tab-after':\n this._insertTab(widget, ref, refNode, true);\n break;\n case 'tab-before':\n this._insertTab(widget, ref, refNode, false);\n break;\n case 'split-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false);\n break;\n case 'split-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false);\n break;\n case 'split-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true);\n break;\n case 'split-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true);\n break;\n case 'merge-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n break;\n case 'merge-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n break;\n case 'merge-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n break;\n case 'merge-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n break;\n }\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Ensure the widget is attached to the parent widget.\n this.attachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Remove the widget from its current layout location.\n this._removeWidget(widget);\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Detach the widget from the parent widget.\n this.detachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Find the tab area which contains the given client position.\n *\n * @param clientX - The client X position of interest.\n *\n * @param clientY - The client Y position of interest.\n *\n * @returns The geometry of the tab area at the given position, or\n * `null` if there is no tab area at the given position.\n */\n hitTestTabAreas(\n clientX: number,\n clientY: number\n ): DockLayout.ITabAreaGeometry | null {\n // Bail early if hit testing cannot produce valid results.\n if (!this._root || !this.parent || !this.parent.isVisible) {\n return null;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent.node);\n }\n\n // Convert from client to local coordinates.\n let rect = this.parent.node.getBoundingClientRect();\n let x = clientX - rect.left - this._box.borderLeft;\n let y = clientY - rect.top - this._box.borderTop;\n\n // Find the tab layout node at the local position.\n let tabNode = this._root.hitTestTabNodes(x, y);\n\n // Bail if a tab layout node was not found.\n if (!tabNode) {\n return null;\n }\n\n // Extract the data from the tab node.\n let { tabBar, top, left, width, height } = tabNode;\n\n // Compute the right and bottom edges of the tab area.\n let borderWidth = this._box.borderLeft + this._box.borderRight;\n let borderHeight = this._box.borderTop + this._box.borderBottom;\n let right = rect.width - borderWidth - (left + width);\n let bottom = rect.height - borderHeight - (top + height);\n\n // Return the hit test results.\n return { tabBar, x, y, top, left, right, bottom, width, height };\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n // Perform superclass initialization.\n super.init();\n\n // Attach each widget to the parent.\n for (const widget of this) {\n this.attachWidget(widget);\n }\n\n // Attach each handle to the parent.\n for (const handle of this.handles()) {\n this.parent!.node.appendChild(handle);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Attach the widget to the layout parent widget.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a no-op if the widget is already attached.\n */\n protected attachWidget(widget: Widget): void {\n // Do nothing if the widget is already attached.\n if (this.parent!.node === widget.node.parentNode) {\n return;\n }\n\n // Create the layout item for the widget.\n this._items.set(widget, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach the widget from the layout parent widget.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a no-op if the widget is not attached.\n */\n protected detachWidget(widget: Widget): void {\n // Do nothing if the widget is not attached.\n if (this.parent!.node !== widget.node.parentNode) {\n return;\n }\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Delete the layout item for the widget.\n let item = this._items.get(widget);\n if (item) {\n this._items.delete(widget);\n item.dispose();\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Remove the specified widget from the layout structure.\n *\n * #### Notes\n * This is a no-op if the widget is not in the layout tree.\n *\n * This does not detach the widget from the parent node.\n */\n private _removeWidget(widget: Widget): void {\n // Bail early if there is no layout root.\n if (!this._root) {\n return;\n }\n\n // Find the tab node which contains the given widget.\n let tabNode = this._root.findTabNode(widget);\n\n // Bail early if the tab node is not found.\n if (!tabNode) {\n return;\n }\n\n Private.removeAria(widget);\n\n // If there are multiple tabs, just remove the widget's tab.\n if (tabNode.tabBar.titles.length > 1) {\n tabNode.tabBar.removeTab(widget.title);\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n tabNode.tabBar.titles.length == 1\n ) {\n const existingWidget = tabNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Display;\n }\n return;\n }\n\n // Otherwise, the tab node needs to be removed...\n\n // Dispose the tab bar.\n tabNode.tabBar.dispose();\n\n // Handle the case where the tab node is the root.\n if (this._root === tabNode) {\n this._root = null;\n return;\n }\n\n // Otherwise, remove the tab node from its parent...\n\n // Prevent widget resizing unless needed.\n this._root.holdAllSizes();\n\n // Clear the parent reference on the tab node.\n let splitNode = tabNode.parent!;\n tabNode.parent = null;\n\n // Remove the tab node from its parent split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n ArrayExt.removeAt(splitNode.sizers, i);\n\n // Remove the handle from its parent DOM node.\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n\n // If there are multiple children, just update the handles.\n if (splitNode.children.length > 1) {\n splitNode.syncHandles();\n return;\n }\n\n // Otherwise, the split node also needs to be removed...\n\n // Clear the parent reference on the split node.\n let maybeParent = splitNode.parent;\n splitNode.parent = null;\n\n // Lookup the remaining child node and handle.\n let childNode = splitNode.children[0];\n let childHandle = splitNode.handles[0];\n\n // Clear the split node data.\n splitNode.children.length = 0;\n splitNode.handles.length = 0;\n splitNode.sizers.length = 0;\n\n // Remove the child handle from its parent node.\n if (childHandle.parentNode) {\n childHandle.parentNode.removeChild(childHandle);\n }\n\n // Handle the case where the split node is the root.\n if (this._root === splitNode) {\n childNode.parent = null;\n this._root = childNode;\n return;\n }\n\n // Otherwise, move the child node to the parent node...\n let parentNode = maybeParent!;\n\n // Lookup the index of the split node.\n let j = parentNode.children.indexOf(splitNode);\n\n // Handle the case where the child node is a tab node.\n if (childNode instanceof Private.TabLayoutNode) {\n childNode.parent = parentNode;\n parentNode.children[j] = childNode;\n return;\n }\n\n // Remove the split data from the parent.\n let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n ArrayExt.removeAt(parentNode.children, j);\n ArrayExt.removeAt(parentNode.sizers, j);\n\n // Remove the handle from its parent node.\n if (splitHandle.parentNode) {\n splitHandle.parentNode.removeChild(splitHandle);\n }\n\n // The child node and the split parent node will have the same\n // orientation. Merge the grand-children with the parent node.\n for (let i = 0, n = childNode.children.length; i < n; ++i) {\n let gChild = childNode.children[i];\n let gHandle = childNode.handles[i];\n let gSizer = childNode.sizers[i];\n ArrayExt.insert(parentNode.children, j + i, gChild);\n ArrayExt.insert(parentNode.handles, j + i, gHandle);\n ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n gChild.parent = parentNode;\n }\n\n // Clear the child node.\n childNode.children.length = 0;\n childNode.handles.length = 0;\n childNode.sizers.length = 0;\n childNode.parent = null;\n\n // Sync the handles on the parent node.\n parentNode.syncHandles();\n }\n\n /**\n * Create the tab layout node to hold the widget.\n */\n private _createTabNode(widget: Widget): Private.TabLayoutNode {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n Private.addAria(widget, tabNode.tabBar);\n return tabNode;\n }\n\n /**\n * Insert a widget next to an existing tab.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertTab(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n after: boolean\n ): void {\n // Do nothing if the tab is inserted next to itself.\n if (widget === ref) {\n return;\n }\n\n // Create the root if it does not exist.\n if (!this._root) {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n this._root = tabNode;\n Private.addAria(widget, tabNode.tabBar);\n return;\n }\n\n // Use the first tab node as the ref node if needed.\n if (!refNode) {\n refNode = this._root.findFirstTabNode()!;\n }\n\n // If the widget is not contained in the ref node, ensure it is\n // removed from the layout and hidden before being added again.\n if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n this._removeWidget(widget);\n widget.hide();\n }\n\n // Lookup the target index for inserting the tab.\n let index: number;\n if (ref) {\n index = refNode.tabBar.titles.indexOf(ref.title);\n } else {\n index = refNode.tabBar.currentIndex;\n }\n\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n if (refNode.tabBar.titles.length === 0) {\n // Singular tab should use display mode to limit number of layers.\n widget.hiddenMode = Widget.HiddenMode.Display;\n } else if (refNode.tabBar.titles.length == 1) {\n // If we are adding a second tab, switch the existing tab back to scale.\n const existingWidget = refNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n // For the third and subsequent tabs no special action is needed.\n widget.hiddenMode = Widget.HiddenMode.Scale;\n }\n } else {\n // For all other modes just propagate the current mode.\n widget.hiddenMode = this._hiddenMode;\n }\n\n // Insert the widget's tab relative to the target index.\n refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n Private.addAria(widget, refNode.tabBar);\n }\n\n /**\n * Insert a widget as a new split area.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertSplit(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n orientation: Private.Orientation,\n after: boolean,\n merge: boolean = false\n ): void {\n // Do nothing if there is no effective split.\n if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n return;\n }\n\n // Ensure the widget is removed from the current layout.\n this._removeWidget(widget);\n\n // Set the root if it does not exist.\n if (!this._root) {\n this._root = this._createTabNode(widget);\n return;\n }\n\n // If the ref node parent is null, split the root.\n if (!refNode || !refNode.parent) {\n // Ensure the root is split with the correct orientation.\n let root = this._splitRoot(orientation);\n\n // Determine the insert index for the new tab node.\n let i = after ? root.children.length : 0;\n\n // Normalize the split node.\n root.normalizeSizes();\n\n // Create the sizer for new tab node.\n let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n // Insert the tab node sized to the golden ratio.\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(root.children, i, tabNode);\n ArrayExt.insert(root.sizers, i, sizer);\n ArrayExt.insert(root.handles, i, this._createHandle());\n tabNode.parent = root;\n\n // Re-normalize the split node to maintain the ratios.\n root.normalizeSizes();\n\n // Finally, synchronize the visibility of the handles.\n root.syncHandles();\n return;\n }\n\n // Lookup the split node for the ref widget.\n let splitNode = refNode.parent;\n\n // If the split node already had the correct orientation,\n // the widget can be inserted into the split node directly.\n if (splitNode.orientation === orientation) {\n // Find the index of the ref node.\n let i = splitNode.children.indexOf(refNode);\n\n // Conditionally reuse a tab layout found in the wanted position.\n if (merge) {\n let j = i + (after ? 1 : -1);\n let sibling = splitNode.children[j];\n if (sibling instanceof Private.TabLayoutNode) {\n this._insertTab(widget, null, sibling, true);\n ++sibling.tabBar.currentIndex;\n return;\n }\n }\n\n // Normalize the split node.\n splitNode.normalizeSizes();\n\n // Consume half the space for the insert location.\n let s = (splitNode.sizers[i].sizeHint /= 2);\n\n // Insert the tab node sized to the other half.\n let j = i + (after ? 1 : 0);\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(splitNode.children, j, tabNode);\n ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n ArrayExt.insert(splitNode.handles, j, this._createHandle());\n tabNode.parent = splitNode;\n\n // Finally, synchronize the visibility of the handles.\n splitNode.syncHandles();\n return;\n }\n\n // Remove the ref node from the split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n // Create a new normalized split node for the children.\n let childNode = new Private.SplitLayoutNode(orientation);\n childNode.normalized = true;\n\n // Add the ref node sized to half the space.\n childNode.children.push(refNode);\n childNode.sizers.push(Private.createSizer(0.5));\n childNode.handles.push(this._createHandle());\n refNode.parent = childNode;\n\n // Add the tab node sized to the other half.\n let j = after ? 1 : 0;\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(childNode.children, j, tabNode);\n ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n ArrayExt.insert(childNode.handles, j, this._createHandle());\n tabNode.parent = childNode;\n\n // Synchronize the visibility of the handles.\n childNode.syncHandles();\n\n // Finally, add the new child node to the original split node.\n ArrayExt.insert(splitNode.children, i, childNode);\n childNode.parent = splitNode;\n }\n\n /**\n * Ensure the root is a split node with the given orientation.\n */\n private _splitRoot(\n orientation: Private.Orientation\n ): Private.SplitLayoutNode {\n // Bail early if the root already meets the requirements.\n let oldRoot = this._root;\n if (oldRoot instanceof Private.SplitLayoutNode) {\n if (oldRoot.orientation === orientation) {\n return oldRoot;\n }\n }\n\n // Create a new root node with the specified orientation.\n let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n // Add the old root to the new root.\n if (oldRoot) {\n newRoot.children.push(oldRoot);\n newRoot.sizers.push(Private.createSizer(0));\n newRoot.handles.push(this._createHandle());\n oldRoot.parent = newRoot;\n }\n\n // Return the new root as a convenience.\n return newRoot;\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the size limits for the layout tree.\n if (this._root) {\n let limits = this._root.fit(this._spacing, this._items);\n minW = limits.minWidth;\n minH = limits.minHeight;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Bail early if there is no root layout node.\n if (!this._root) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let x = this._box.paddingTop;\n let y = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the geometry of the layout tree.\n this._root.update(x, y, width, height, this._spacing, this._items);\n }\n\n /**\n * Create a new tab bar for use by the dock layout.\n *\n * #### Notes\n * The tab bar will be attached to the parent if it exists.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar using the renderer.\n let tabBar = this.renderer.createTabBar(this._document);\n\n // Enforce necessary tab bar behavior.\n tabBar.orientation = 'horizontal';\n\n // Attach the tab bar to the parent if possible.\n if (this.parent) {\n this.attachWidget(tabBar);\n }\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for the dock layout.\n *\n * #### Notes\n * The handle will be attached to the parent if it exists.\n */\n private _createHandle(): HTMLDivElement {\n // Create the handle using the renderer.\n let handle = this.renderer.createHandle();\n\n // Initialize the handle layout behavior.\n let style = handle.style;\n style.position = 'absolute';\n style.contain = 'strict';\n style.top = '0';\n style.left = '0';\n style.width = '0';\n style.height = '0';\n\n // Attach the handle to the parent if it exists.\n if (this.parent) {\n this.parent.node.appendChild(handle);\n }\n\n // Return the initialized handle.\n return handle;\n }\n\n private _spacing = 4;\n private _dirty = false;\n private _root: Private.LayoutNode | null = null;\n private _box: ElementExt.IBoxSizing | null = null;\n private _document: Document | ShadowRoot;\n private _hiddenMode: Widget.HiddenMode;\n private _items: Private.ItemMap = new Map();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n /**\n * An options object for creating a dock layout.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * The renderer to use for the dock layout.\n */\n renderer: IRenderer;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a dock layout.\n */\n export interface IRenderer {\n /**\n * Create a new tab bar for use with a dock layout.\n *\n * @returns A new tab bar for a dock layout.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar;\n\n /**\n * Create a new handle node for use with a dock layout.\n *\n * @returns A new handle node for a dock layout.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * A type alias for the supported insertion modes.\n *\n * An insert mode is used to specify how a widget should be added\n * to the dock layout relative to a reference widget.\n */\n export type InsertMode =\n | /**\n * The area to the top of the reference widget.\n *\n * The widget will be inserted just above the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the top edge of the dock layout.\n */\n 'split-top'\n\n /**\n * The area to the left of the reference widget.\n *\n * The widget will be inserted just left of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the left edge of the dock layout.\n */\n | 'split-left'\n\n /**\n * The area to the right of the reference widget.\n *\n * The widget will be inserted just right of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the right edge of the dock layout.\n */\n | 'split-right'\n\n /**\n * The area to the bottom of the reference widget.\n *\n * The widget will be inserted just below the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the bottom edge of the dock layout.\n */\n | 'split-bottom'\n\n /**\n * Like `split-top` but if a tab layout exists above the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-top'\n\n /**\n * Like `split-left` but if a tab layout exists left of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-left'\n\n /**\n * Like `split-right` but if a tab layout exists right of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-right'\n\n /**\n * Like `split-bottom` but if a tab layout exists below the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-bottom'\n\n /**\n * The tab position before the reference widget.\n *\n * The widget will be added as a tab before the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-before'\n\n /**\n * The tab position after the reference widget.\n *\n * The widget will be added as a tab after the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-after';\n\n /**\n * An options object for adding a widget to the dock layout.\n */\n export interface IAddOptions {\n /**\n * The insertion mode for adding the widget.\n *\n * The default is `'tab-after'`.\n */\n mode?: InsertMode;\n\n /**\n * The reference widget for the insert location.\n *\n * The default is `null`.\n */\n ref?: Widget | null;\n }\n\n /**\n * A layout config object for a tab area.\n */\n export interface ITabAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'tab-area';\n\n /**\n * The widgets contained in the tab area.\n */\n widgets: Widget[];\n\n /**\n * The index of the selected tab.\n */\n currentIndex: number;\n }\n\n /**\n * A layout config object for a split area.\n */\n export interface ISplitAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'split-area';\n\n /**\n * The orientation of the split area.\n */\n orientation: 'horizontal' | 'vertical';\n\n /**\n * The children in the split area.\n */\n children: AreaConfig[];\n\n /**\n * The relative sizes of the children.\n */\n sizes: number[];\n }\n\n /**\n * A type alias for a general area config.\n */\n export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n /**\n * A dock layout configuration object.\n */\n export interface ILayoutConfig {\n /**\n * The layout config for the main dock area.\n */\n main: AreaConfig | null;\n }\n\n /**\n * An object which represents the geometry of a tab area.\n */\n export interface ITabAreaGeometry {\n /**\n * The tab bar for the tab area.\n */\n tabBar: TabBar;\n\n /**\n * The local X position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the local X coordinate of the hit test query.\n */\n x: number;\n\n /**\n * The local Y position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the local Y coordinate of the hit test query.\n */\n y: number;\n\n /**\n * The local coordinate of the top edge of the tab area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the top edge of the tab area.\n */\n top: number;\n\n /**\n * The local coordinate of the left edge of the tab area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the left edge of the tab area.\n */\n left: number;\n\n /**\n * The local coordinate of the right edge of the tab area.\n *\n * #### Notes\n * This is the distance from the right edge of the layout parent\n * widget, to the right edge of the tab area.\n */\n right: number;\n\n /**\n * The local coordinate of the bottom edge of the tab area.\n *\n * #### Notes\n * This is the distance from the bottom edge of the layout parent\n * widget, to the bottom edge of the tab area.\n */\n bottom: number;\n\n /**\n * The width of the tab area.\n *\n * #### Notes\n * This is total width allocated for the tab area.\n */\n width: number;\n\n /**\n * The height of the tab area.\n *\n * #### Notes\n * This is total height allocated for the tab area.\n */\n height: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * A type alias for a dock layout node.\n */\n export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n /**\n * A type alias for the orientation of a split layout node.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a layout item map.\n */\n export type ItemMap = Map;\n\n /**\n * Create a box sizer with an initial size hint.\n */\n export function createSizer(hint: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = hint;\n sizer.size = hint;\n return sizer;\n }\n\n /**\n * Normalize an area config object and collect the visited widgets.\n */\n export function normalizeAreaConfig(\n config: DockLayout.AreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n let result: DockLayout.AreaConfig | null;\n if (config.type === 'tab-area') {\n result = normalizeTabAreaConfig(config, widgetSet);\n } else {\n result = normalizeSplitAreaConfig(config, widgetSet);\n }\n return result;\n }\n\n /**\n * Convert a normalized area config into a layout tree.\n */\n export function realizeAreaConfig(\n config: DockLayout.AreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): LayoutNode {\n let node: LayoutNode;\n if (config.type === 'tab-area') {\n node = realizeTabAreaConfig(config, renderer, document);\n } else {\n node = realizeSplitAreaConfig(config, renderer, document);\n }\n return node;\n }\n\n /**\n * A layout node which holds the data for a tabbed area.\n */\n export class TabLayoutNode {\n /**\n * Construct a new tab layout node.\n *\n * @param tabBar - The tab bar to use for the layout node.\n */\n constructor(tabBar: TabBar) {\n let tabSizer = new BoxSizer();\n let widgetSizer = new BoxSizer();\n tabSizer.stretch = 0;\n widgetSizer.stretch = 1;\n this.tabBar = tabBar;\n this.sizers = [tabSizer, widgetSizer];\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * The tab bar for the layout node.\n */\n readonly tabBar: TabBar;\n\n /**\n * The sizers for the layout node.\n */\n readonly sizers: [BoxSizer, BoxSizer];\n\n /**\n * The most recent value for the `top` edge of the layout box.\n */\n get top(): number {\n return this._top;\n }\n\n /**\n * The most recent value for the `left` edge of the layout box.\n */\n get left(): number {\n return this._left;\n }\n\n /**\n * The most recent value for the `width` of the layout box.\n */\n get width(): number {\n return this._width;\n }\n\n /**\n * The most recent value for the `height` of the layout box.\n */\n get height(): number {\n return this._height;\n }\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n yield this.tabBar;\n yield* this.iterUserWidgets();\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const title of this.tabBar.titles) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n let title = this.tabBar.currentTitle;\n if (title) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n yield this.tabBar;\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n // eslint-disable-next-line require-yield\n *iterHandles(): IterableIterator {\n return;\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n return this;\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n if (x < this._left || x >= this._left + this._width) {\n return null;\n }\n if (y < this._top || y >= this._top + this._height) {\n return null;\n }\n return this;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ITabAreaConfig {\n let widgets = this.tabBar.titles.map(title => title.owner);\n let currentIndex = this.tabBar.currentIndex;\n return { type: 'tab-area', widgets, currentIndex };\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n return;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Set up the limit variables.\n let minWidth = 0;\n let minHeight = 0;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Lookup the tab bar and widget sizers.\n let [tabBarSizer, widgetSizer] = this.sizers;\n\n // Update the tab bar limits.\n if (tabBarItem) {\n tabBarItem.fit();\n }\n\n // Update the widget limits.\n if (widgetItem) {\n widgetItem.fit();\n }\n\n // Update the results and sizer for the tab bar.\n if (tabBarItem && !tabBarItem.isHidden) {\n minWidth = Math.max(minWidth, tabBarItem.minWidth);\n minHeight += tabBarItem.minHeight;\n tabBarSizer.minSize = tabBarItem.minHeight;\n tabBarSizer.maxSize = tabBarItem.maxHeight;\n } else {\n tabBarSizer.minSize = 0;\n tabBarSizer.maxSize = 0;\n }\n\n // Update the results and sizer for the current widget.\n if (widgetItem && !widgetItem.isHidden) {\n minWidth = Math.max(minWidth, widgetItem.minWidth);\n minHeight += widgetItem.minHeight;\n widgetSizer.minSize = widgetItem.minHeight;\n widgetSizer.maxSize = Infinity;\n } else {\n widgetSizer.minSize = 0;\n widgetSizer.maxSize = Infinity;\n }\n\n // Return the computed size limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Update the layout box values.\n this._top = top;\n this._left = left;\n this._width = width;\n this._height = height;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, height);\n\n // Update the tab bar item using the computed size.\n if (tabBarItem && !tabBarItem.isHidden) {\n let size = this.sizers[0].size;\n tabBarItem.update(left, top, width, size);\n top += size;\n }\n\n // Layout the widget using the computed size.\n if (widgetItem && !widgetItem.isHidden) {\n let size = this.sizers[1].size;\n widgetItem.update(left, top, width, size);\n }\n }\n\n private _top = 0;\n private _left = 0;\n private _width = 0;\n private _height = 0;\n }\n\n /**\n * A layout node which holds the data for a split area.\n */\n export class SplitLayoutNode {\n /**\n * Construct a new split layout node.\n *\n * @param orientation - The orientation of the node.\n */\n constructor(orientation: Orientation) {\n this.orientation = orientation;\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * Whether the sizers have been normalized.\n */\n normalized = false;\n\n /**\n * The orientation of the node.\n */\n readonly orientation: Orientation;\n\n /**\n * The child nodes for the split node.\n */\n readonly children: LayoutNode[] = [];\n\n /**\n * The box sizers for the layout children.\n */\n readonly sizers: BoxSizer[] = [];\n\n /**\n * The handles for the layout children.\n */\n readonly handles: HTMLDivElement[] = [];\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterAllWidgets();\n }\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterUserWidgets();\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterSelectedWidgets();\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n for (const child of this.children) {\n yield* child.iterTabBars();\n }\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n *iterHandles(): IterableIterator {\n yield* this.handles;\n for (const child of this.children) {\n yield* child.iterHandles();\n }\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findTabNode(widget);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n let index = this.handles.indexOf(handle);\n if (index !== -1) {\n return { index, node: this };\n }\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findSplitNode(handle);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n if (this.children.length === 0) {\n return null;\n }\n return this.children[0].findFirstTabNode();\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].hitTestTabNodes(x, y);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ISplitAreaConfig {\n let orientation = this.orientation;\n let sizes = this.createNormalizedSizes();\n let children = this.children.map(child => child.createConfig());\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Sync the visibility and orientation of the handles.\n */\n syncHandles(): void {\n this.handles.forEach((handle, i) => {\n handle.setAttribute('data-orientation', this.orientation);\n if (i === this.handles.length - 1) {\n handle.classList.add('lm-mod-hidden');\n } else {\n handle.classList.remove('lm-mod-hidden');\n }\n });\n }\n\n /**\n * Hold the current sizes of the box sizers.\n *\n * This sets the size hint of each sizer to its current size.\n */\n holdSizes(): void {\n for (const sizer of this.sizers) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n for (const child of this.children) {\n child.holdAllSizes();\n }\n this.holdSizes();\n }\n\n /**\n * Normalize the sizes of the split layout node.\n */\n normalizeSizes(): void {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return;\n }\n\n // Hold the current sizes of the sizers.\n this.holdSizes();\n\n // Compute the sum of the sizes.\n let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint = 1 / n;\n }\n } else {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint /= sum;\n }\n }\n\n // Mark the sizes as normalized.\n this.normalized = true;\n }\n\n /**\n * Snap the normalized sizes of the split layout node.\n */\n createNormalizedSizes(): number[] {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return [];\n }\n\n // Grab the current sizes of the sizers.\n let sizes = this.sizers.map(sizer => sizer.size);\n\n // Compute the sum of the sizes.\n let sum = sizes.reduce((v, size) => v + size, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] = 1 / n;\n }\n } else {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] /= sum;\n }\n }\n\n // Return the normalized sizes.\n return sizes;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Compute the required fixed space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n // Set up the limit variables.\n let minWidth = horizontal ? fixed : 0;\n let minHeight = horizontal ? 0 : fixed;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Fit the children and update the limits.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let limits = this.children[i].fit(spacing, items);\n if (horizontal) {\n minHeight = Math.max(minHeight, limits.minHeight);\n minWidth += limits.minWidth;\n this.sizers[i].minSize = limits.minWidth;\n } else {\n minWidth = Math.max(minWidth, limits.minWidth);\n minHeight += limits.minHeight;\n this.sizers[i].minSize = limits.minHeight;\n }\n }\n\n // Return the computed limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Compute the available layout space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n // De-normalize the sizes if needed.\n if (this.normalized) {\n for (const sizer of this.sizers) {\n sizer.sizeHint *= space;\n }\n this.normalized = false;\n }\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, space);\n\n // Update the geometry of the child nodes and handles.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let child = this.children[i];\n let size = this.sizers[i].size;\n let handleStyle = this.handles[i].style;\n if (horizontal) {\n child.update(left, top, size, height, spacing, items);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${spacing}px`;\n handleStyle.height = `${height}px`;\n left += spacing;\n } else {\n child.update(left, top, width, size, spacing, items);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${spacing}px`;\n top += spacing;\n }\n }\n }\n }\n\n export function addAria(widget: Widget, tabBar: TabBar): void {\n widget.node.setAttribute('role', 'tabpanel');\n let renderer = tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n export function removeAria(widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n }\n\n /**\n * Normalize a tab area config and collect the visited widgets.\n */\n function normalizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n widgetSet: Set\n ): DockLayout.ITabAreaConfig | null {\n // Bail early if there is no content.\n if (config.widgets.length === 0) {\n return null;\n }\n\n // Setup the filtered widgets array.\n let widgets: Widget[] = [];\n\n // Filter the config for unique widgets.\n for (const widget of config.widgets) {\n if (!widgetSet.has(widget)) {\n widgetSet.add(widget);\n widgets.push(widget);\n }\n }\n\n // Bail if there are no effective widgets.\n if (widgets.length === 0) {\n return null;\n }\n\n // Normalize the current index.\n let index = config.currentIndex;\n if (index !== -1 && (index < 0 || index >= widgets.length)) {\n index = 0;\n }\n\n // Return a normalized config object.\n return { type: 'tab-area', widgets, currentIndex: index };\n }\n\n /**\n * Normalize a split area config and collect the visited widgets.\n */\n function normalizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n // Set up the result variables.\n let orientation = config.orientation;\n let children: DockLayout.AreaConfig[] = [];\n let sizes: number[] = [];\n\n // Normalize the config children.\n for (let i = 0, n = config.children.length; i < n; ++i) {\n // Normalize the child config.\n let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n // Ignore an empty child.\n if (!child) {\n continue;\n }\n\n // Add the child or hoist its content as appropriate.\n if (child.type === 'tab-area' || child.orientation !== orientation) {\n children.push(child);\n sizes.push(Math.abs(config.sizes[i] || 0));\n } else {\n children.push(...child.children);\n sizes.push(...child.sizes);\n }\n }\n\n // Bail if there are no effective children.\n if (children.length === 0) {\n return null;\n }\n\n // If there is only one effective child, return that child.\n if (children.length === 1) {\n return children[0];\n }\n\n // Return a normalized config object.\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Convert a normalized tab area config into a layout tree.\n */\n function realizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): TabLayoutNode {\n // Create the tab bar for the layout node.\n let tabBar = renderer.createTabBar(document);\n\n // Hide each widget and add it to the tab bar.\n for (const widget of config.widgets) {\n widget.hide();\n tabBar.addTab(widget.title);\n Private.addAria(widget, tabBar);\n }\n\n // Set the current index of the tab bar.\n tabBar.currentIndex = config.currentIndex;\n\n // Return the new tab layout node.\n return new TabLayoutNode(tabBar);\n }\n\n /**\n * Convert a normalized split area config into a layout tree.\n */\n function realizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): SplitLayoutNode {\n // Create the split layout node.\n let node = new SplitLayoutNode(config.orientation);\n\n // Add each child to the layout node.\n config.children.forEach((child, i) => {\n // Create the child data for the layout node.\n let childNode = realizeAreaConfig(child, renderer, document);\n let sizer = createSizer(config.sizes[i]);\n let handle = renderer.createHandle();\n\n // Add the child data to the layout node.\n node.children.push(childNode);\n node.handles.push(handle);\n node.sizers.push(sizer);\n\n // Update the parent for the child node.\n childNode.parent = node;\n });\n\n // Synchronize the handle state for the layout node.\n node.syncHandles();\n\n // Normalize the sizes for the layout node.\n node.normalizeSizes();\n\n // Return the new layout node.\n return node;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n */\nexport class DockPanel extends Widget {\n /**\n * Construct a new dock panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: DockPanel.IOptions = {}) {\n super();\n this.addClass('lm-DockPanel');\n this._document = options.document || document;\n this._mode = options.mode || 'multiple-document';\n this._renderer = options.renderer || DockPanel.defaultRenderer;\n this._edges = options.edges || Private.DEFAULT_EDGES;\n if (options.tabsMovable !== undefined) {\n this._tabsMovable = options.tabsMovable;\n }\n if (options.tabsConstrained !== undefined) {\n this._tabsConstrained = options.tabsConstrained;\n }\n if (options.addButtonEnabled !== undefined) {\n this._addButtonEnabled = options.addButtonEnabled;\n }\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = this._mode;\n\n // Create the delegate renderer for the layout.\n let renderer: DockPanel.IRenderer = {\n createTabBar: () => this._createTabBar(),\n createHandle: () => this._createHandle()\n };\n\n // Set up the dock layout for the panel.\n this.layout = new DockLayout({\n document: this._document,\n renderer,\n spacing: options.spacing,\n hiddenMode: options.hiddenMode\n });\n\n // Set up the overlay drop indicator.\n this.overlay = options.overlay || new DockPanel.Overlay();\n this.node.appendChild(this.overlay.node);\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n // Ensure the mouse is released.\n this._releaseMouse();\n\n // Hide the overlay.\n this.overlay.hide(0);\n\n // Cancel a drag if one is in progress.\n if (this._drag) {\n this._drag.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The method for hiding widgets.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as DockLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as DockLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when the layout configuration is modified.\n *\n * #### Notes\n * This signal is emitted whenever the current layout configuration\n * may have changed.\n *\n * This signal is emitted asynchronously in a collapsed fashion, so\n * that multiple synchronous modifications results in only a single\n * emit of the signal.\n */\n get layoutModified(): ISignal {\n return this._layoutModified;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The overlay used by the dock panel.\n */\n readonly overlay: DockPanel.IOverlay;\n\n /**\n * The renderer used by the dock panel.\n */\n get renderer(): DockPanel.IRenderer {\n return (this.layout as DockLayout).renderer;\n }\n\n /**\n * Get the spacing between the widgets.\n */\n get spacing(): number {\n return (this.layout as DockLayout).spacing;\n }\n\n /**\n * Set the spacing between the widgets.\n */\n set spacing(value: number) {\n (this.layout as DockLayout).spacing = value;\n }\n\n /**\n * Get the mode for the dock panel.\n */\n get mode(): DockPanel.Mode {\n return this._mode;\n }\n\n /**\n * Set the mode for the dock panel.\n *\n * #### Notes\n * Changing the mode is a destructive operation with respect to the\n * panel's layout configuration. If layout state must be preserved,\n * save the current layout config before changing the mode.\n */\n set mode(value: DockPanel.Mode) {\n // Bail early if the mode does not change.\n if (this._mode === value) {\n return;\n }\n\n // Update the internal mode.\n this._mode = value;\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = value;\n\n // Get the layout for the panel.\n let layout = this.layout as DockLayout;\n\n // Configure the layout for the specified mode.\n switch (value) {\n case 'multiple-document':\n for (const tabBar of layout.tabBars()) {\n tabBar.show();\n }\n break;\n case 'single-document':\n layout.restoreLayout(Private.createSingleDocumentConfig(this));\n break;\n default:\n throw 'unreachable';\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Whether the tabs can be dragged / moved at runtime.\n */\n get tabsMovable(): boolean {\n return this._tabsMovable;\n }\n\n /**\n * Enable / Disable draggable / movable tabs.\n */\n set tabsMovable(value: boolean) {\n this._tabsMovable = value;\n for (const tabBar of this.tabBars()) {\n tabBar.tabsMovable = value;\n }\n }\n\n /**\n * Whether the tabs are constrained to their source dock panel\n */\n get tabsConstrained(): boolean {\n return this._tabsConstrained;\n }\n\n /**\n * Constrain/Allow tabs to be dragged outside of this dock panel\n */\n set tabsConstrained(value: boolean) {\n this._tabsConstrained = value;\n }\n\n /**\n * Whether the add buttons for each tab bar are enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add buttons for each tab bar are enabled.\n */\n set addButtonEnabled(value: boolean) {\n this._addButtonEnabled = value;\n for (const tabBar of this.tabBars()) {\n tabBar.addButtonEnabled = value;\n }\n }\n\n /**\n * Whether the dock panel is empty.\n */\n get isEmpty(): boolean {\n return (this.layout as DockLayout).isEmpty;\n }\n\n /**\n * Create an iterator over the user widgets in the panel.\n *\n * @returns A new iterator over the user widgets in the panel.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n *widgets(): IterableIterator {\n yield* (this.layout as DockLayout).widgets();\n }\n\n /**\n * Create an iterator over the selected widgets in the panel.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the panel.\n */\n *selectedWidgets(): IterableIterator {\n yield* (this.layout as DockLayout).selectedWidgets();\n }\n\n /**\n * Create an iterator over the tab bars in the panel.\n *\n * @returns A new iterator over the tab bars in the panel.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n *tabBars(): IterableIterator> {\n yield* (this.layout as DockLayout).tabBars();\n }\n\n /**\n * Create an iterator over the handles in the panel.\n *\n * @returns A new iterator over the handles in the panel.\n */\n *handles(): IterableIterator {\n yield* (this.layout as DockLayout).handles();\n }\n\n /**\n * Select a specific widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will make the widget the current widget in its tab area.\n */\n selectWidget(widget: Widget): void {\n // Find the tab bar which contains the widget.\n let tabBar = find(this.tabBars(), bar => {\n return bar.titles.indexOf(widget.title) !== -1;\n });\n\n // Throw an error if no tab bar is found.\n if (!tabBar) {\n throw new Error('Widget is not contained in the dock panel.');\n }\n\n // Ensure the widget is the current widget.\n tabBar.currentTitle = widget.title;\n }\n\n /**\n * Activate a specified widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will select and activate the given widget.\n */\n activateWidget(widget: Widget): void {\n this.selectWidget(widget);\n widget.activate();\n }\n\n /**\n * Save the current layout configuration of the dock panel.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockPanel.ILayoutConfig {\n return (this.layout as DockLayout).saveLayout();\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n *\n * The dock panel automatically reverts to `'multiple-document'`\n * mode when a layout config is restored.\n */\n restoreLayout(config: DockPanel.ILayoutConfig): void {\n // Reset the mode.\n this._mode = 'multiple-document';\n\n // Restore the layout.\n (this.layout as DockLayout).restoreLayout(config);\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Add a widget to the dock panel.\n *\n * @param widget - The widget to add to the dock panel.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * If the panel is in single document mode, the options are ignored\n * and the widget is always added as tab in the hidden tab bar.\n */\n addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n // Add the widget to the layout.\n if (this._mode === 'single-document') {\n (this.layout as DockLayout).addWidget(widget);\n } else {\n (this.layout as DockLayout).addWidget(widget, options);\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n */\n processMessage(msg: Message): void {\n if (msg.type === 'layout-modified') {\n this._layoutModified.emit(undefined);\n } else {\n super.processMessage(msg);\n }\n }\n\n /**\n * Handle the DOM events for the dock panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'lm-dragenter':\n this._evtDragEnter(event as Drag.Event);\n break;\n case 'lm-dragleave':\n this._evtDragLeave(event as Drag.Event);\n break;\n case 'lm-dragover':\n this._evtDragOver(event as Drag.Event);\n break;\n case 'lm-drop':\n this._evtDrop(event as Drag.Event);\n break;\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('lm-dragenter', this);\n this.node.addEventListener('lm-dragleave', this);\n this.node.addEventListener('lm-dragover', this);\n this.node.addEventListener('lm-drop', this);\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('lm-dragenter', this);\n this.node.removeEventListener('lm-dragleave', this);\n this.node.removeEventListener('lm-dragover', this);\n this.node.removeEventListener('lm-drop', this);\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Add the widget class to the child.\n msg.child.addClass('lm-DockPanel-widget');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Remove the widget class from the child.\n msg.child.removeClass('lm-DockPanel-widget');\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `'lm-dragenter'` event for the dock panel.\n */\n private _evtDragEnter(event: Drag.Event): void {\n // If the factory mime type is present, mark the event as\n // handled in order to get the rest of the drag events.\n if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handle the `'lm-dragleave'` event for the dock panel.\n */\n private _evtDragLeave(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n if (this._tabsConstrained && event.source !== this) return;\n\n event.stopPropagation();\n\n // The new target might be a descendant, so we might still handle the drop.\n // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n // hide is cancelled by the lm-dragover handler's show overlay logic.\n this.overlay.hide(1);\n }\n\n /**\n * Handle the `'lm-dragover'` event for the dock panel.\n */\n private _evtDragOver(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Show the drop indicator overlay and update the drop\n // action based on the drop target zone under the mouse.\n if (\n (this._tabsConstrained && event.source !== this) ||\n this._showOverlay(event.clientX, event.clientY) === 'invalid'\n ) {\n event.dropAction = 'none';\n } else {\n event.stopPropagation();\n event.dropAction = event.proposedAction;\n }\n }\n\n /**\n * Handle the `'lm-drop'` event for the dock panel.\n */\n private _evtDrop(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Hide the drop indicator overlay.\n this.overlay.hide(0);\n\n // Bail if the proposed action is to do nothing.\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n\n // Find the drop target under the mouse.\n let { clientX, clientY } = event;\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // Bail if the drop zone is invalid.\n if (\n (this._tabsConstrained && event.source !== this) ||\n zone === 'invalid'\n ) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory mime type has invalid data.\n let mimeData = event.mimeData;\n let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n if (typeof factory !== 'function') {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory does not produce a widget.\n let widget = factory();\n if (!(widget instanceof Widget)) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the widget is an ancestor of the dock panel.\n if (widget.contains(this)) {\n event.dropAction = 'none';\n return;\n }\n\n // Find the reference widget for the drop target.\n let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n // Add the widget according to the indicated drop zone.\n switch (zone) {\n case 'root-all':\n this.addWidget(widget);\n break;\n case 'root-top':\n this.addWidget(widget, { mode: 'split-top' });\n break;\n case 'root-left':\n this.addWidget(widget, { mode: 'split-left' });\n break;\n case 'root-right':\n this.addWidget(widget, { mode: 'split-right' });\n break;\n case 'root-bottom':\n this.addWidget(widget, { mode: 'split-bottom' });\n break;\n case 'widget-all':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n case 'widget-top':\n this.addWidget(widget, { mode: 'split-top', ref });\n break;\n case 'widget-left':\n this.addWidget(widget, { mode: 'split-left', ref });\n break;\n case 'widget-right':\n this.addWidget(widget, { mode: 'split-right', ref });\n break;\n case 'widget-bottom':\n this.addWidget(widget, { mode: 'split-bottom', ref });\n break;\n case 'widget-tab':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n default:\n throw 'unreachable';\n }\n\n // Accept the proposed drop action.\n event.dropAction = event.proposedAction;\n\n // Stop propagation if we have not bailed so far.\n event.stopPropagation();\n\n // Activate the dropped widget.\n this.activateWidget(widget);\n }\n\n /**\n * Handle the `'keydown'` event for the dock panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the dock panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the left mouse button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the mouse target, if any.\n let layout = this.layout as DockLayout;\n let target = event.target as HTMLElement;\n let handle = find(layout.handles(), handle => handle.contains(target));\n if (!handle) {\n return;\n }\n\n // Stop the event when a handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n this._document.addEventListener('keydown', this, true);\n this._document.addEventListener('pointerup', this, true);\n this._document.addEventListener('pointermove', this, true);\n this._document.addEventListener('contextmenu', this, true);\n\n // Compute the offset deltas for the handle press.\n let rect = handle.getBoundingClientRect();\n let deltaX = event.clientX - rect.left;\n let deltaY = event.clientY - rect.top;\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!, this._document);\n this._pressData = { handle, deltaX, deltaY, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the dock panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event when dragging a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let rect = this.node.getBoundingClientRect();\n let xPos = event.clientX - rect.left - this._pressData.deltaX;\n let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n // Set the handle as close to the desired position as possible.\n let layout = this.layout as DockLayout;\n layout.moveHandle(this._pressData.handle, xPos, yPos);\n }\n\n /**\n * Handle the `'pointerup'` event for the dock panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the left mouse button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Release the mouse grab for the dock panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra document listeners.\n this._document.removeEventListener('keydown', this, true);\n this._document.removeEventListener('pointerup', this, true);\n this._document.removeEventListener('pointermove', this, true);\n this._document.removeEventListener('contextmenu', this, true);\n }\n\n /**\n * Show the overlay indicator at the given client position.\n *\n * Returns the drop zone at the specified client position.\n *\n * #### Notes\n * If the position is not over a valid zone, the overlay is hidden.\n */\n private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n // Find the dock target for the given client position.\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // If the drop zone is invalid, hide the overlay and bail.\n if (zone === 'invalid') {\n this.overlay.hide(100);\n return zone;\n }\n\n // Setup the variables needed to compute the overlay geometry.\n let top: number;\n let left: number;\n let right: number;\n let bottom: number;\n let box = ElementExt.boxSizing(this.node); // TODO cache this?\n let rect = this.node.getBoundingClientRect();\n\n // Compute the overlay geometry based on the dock zone.\n switch (zone) {\n case 'root-all':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-top':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = rect.height * Private.GOLDEN_RATIO;\n break;\n case 'root-left':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = rect.width * Private.GOLDEN_RATIO;\n bottom = box.paddingBottom;\n break;\n case 'root-right':\n top = box.paddingTop;\n left = rect.width * Private.GOLDEN_RATIO;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-bottom':\n top = rect.height * Private.GOLDEN_RATIO;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'widget-all':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-top':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height / 2;\n break;\n case 'widget-left':\n top = target!.top;\n left = target!.left;\n right = target!.right + target!.width / 2;\n bottom = target!.bottom;\n break;\n case 'widget-right':\n top = target!.top;\n left = target!.left + target!.width / 2;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-bottom':\n top = target!.top + target!.height / 2;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-tab': {\n const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height - tabHeight;\n break;\n }\n default:\n throw 'unreachable';\n }\n\n // Show the overlay with the computed geometry.\n this.overlay.show({ top, left, right, bottom });\n\n // Finally, return the computed drop zone.\n return zone;\n }\n\n /**\n * Create a new tab bar for use by the panel.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar.\n let tabBar = this._renderer.createTabBar(this._document);\n\n // Set the generated tab bar property for the tab bar.\n Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n // Hide the tab bar when in single document mode.\n if (this._mode === 'single-document') {\n tabBar.hide();\n }\n\n // Enforce necessary tab bar behavior.\n // TODO do we really want to enforce *all* of these?\n tabBar.tabsMovable = this._tabsMovable;\n tabBar.allowDeselect = false;\n tabBar.addButtonEnabled = this._addButtonEnabled;\n tabBar.removeBehavior = 'select-previous-tab';\n tabBar.insertBehavior = 'select-tab-if-needed';\n\n // Connect the signal handlers for the tab bar.\n tabBar.tabMoved.connect(this._onTabMoved, this);\n tabBar.currentChanged.connect(this._onCurrentChanged, this);\n tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for use by the panel.\n */\n private _createHandle(): HTMLDivElement {\n return this._renderer.createHandle();\n }\n\n /**\n * Handle the `tabMoved` signal from a tab bar.\n */\n private _onTabMoved(): void {\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `currentChanged` signal from a tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousTitle, currentTitle } = args;\n\n // Hide the previous widget.\n if (previousTitle) {\n previousTitle.owner.hide();\n }\n\n // Show the current widget.\n if (currentTitle) {\n currentTitle.owner.show();\n }\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `addRequested` signal from a tab bar.\n */\n private _onTabAddRequested(sender: TabBar): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from a tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from a tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabDetachRequested` signal from a tab bar.\n */\n private _onTabDetachRequested(\n sender: TabBar,\n args: TabBar.ITabDetachRequestedArgs\n ): void {\n // Do nothing if a drag is already in progress.\n if (this._drag) {\n return;\n }\n\n // Release the tab bar's hold on the mouse.\n sender.releaseMouse();\n\n // Extract the data from the args.\n let { title, tab, clientX, clientY, offset } = args;\n\n // Setup the mime data for the drag operation.\n let mimeData = new MimeData();\n let factory = () => title.owner;\n mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n // Create the drag image for the drag operation.\n let dragImage = tab.cloneNode(true) as HTMLElement;\n if (offset) {\n dragImage.style.top = `-${offset.y}px`;\n dragImage.style.left = `-${offset.x}px`;\n }\n\n // Create the drag object to manage the drag-drop operation.\n this._drag = new Drag({\n document: this._document,\n mimeData,\n dragImage,\n proposedAction: 'move',\n supportedActions: 'move',\n source: this\n });\n\n // Hide the tab node in the original tab.\n tab.classList.add('lm-mod-hidden');\n let cleanup = () => {\n this._drag = null;\n tab.classList.remove('lm-mod-hidden');\n };\n\n // Start the drag operation and cleanup when done.\n this._drag.start(clientX, clientY).then(cleanup);\n }\n\n private _edges: DockPanel.IEdges;\n private _document: Document | ShadowRoot;\n private _mode: DockPanel.Mode;\n private _drag: Drag | null = null;\n private _renderer: DockPanel.IRenderer;\n private _tabsMovable: boolean = true;\n private _tabsConstrained: boolean = false;\n private _addButtonEnabled: boolean = false;\n private _pressData: Private.IPressData | null = null;\n private _layoutModified = new Signal(this);\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n /**\n * An options object for creating a dock panel.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n /**\n * The overlay to use with the dock panel.\n *\n * The default is a new `Overlay` instance.\n */\n overlay?: IOverlay;\n\n /**\n * The renderer to use for the dock panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The spacing between the items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The mode for the dock panel.\n *\n * The default is `'multiple-document'`.\n */\n mode?: DockPanel.Mode;\n\n /**\n * The sizes of the edge drop zones, in pixels.\n * If not given, default values will be used.\n */\n edges?: IEdges;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * Allow tabs to be draggable / movable by user.\n *\n * The default is `'true'`.\n */\n tabsMovable?: boolean;\n\n /**\n * Constrain tabs to this dock panel\n *\n * The default is `'false'`.\n */\n tabsConstrained?: boolean;\n\n /**\n * Enable add buttons in each of the dock panel's tab bars.\n *\n * The default is `'false'`.\n */\n addButtonEnabled?: boolean;\n }\n\n /**\n * The sizes of the edge drop zones, in pixels.\n */\n export interface IEdges {\n /**\n * The size of the top edge drop zone.\n */\n top: number;\n\n /**\n * The size of the right edge drop zone.\n */\n right: number;\n\n /**\n * The size of the bottom edge drop zone.\n */\n bottom: number;\n\n /**\n * The size of the left edge drop zone.\n */\n left: number;\n }\n\n /**\n * A type alias for the supported dock panel modes.\n */\n export type Mode =\n | /**\n * The single document mode.\n *\n * In this mode, only a single widget is visible at a time, and that\n * widget fills the available layout space. No tab bars are visible.\n */\n 'single-document'\n\n /**\n * The multiple document mode.\n *\n * In this mode, multiple documents are displayed in separate tab\n * areas, and those areas can be individually resized by the user.\n */\n | 'multiple-document';\n\n /**\n * A type alias for a layout configuration object.\n */\n export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n /**\n * A type alias for the supported insertion modes.\n */\n export type InsertMode = DockLayout.InsertMode;\n\n /**\n * A type alias for the add widget options.\n */\n export type IAddOptions = DockLayout.IAddOptions;\n\n /**\n * An object which holds the geometry for overlay positioning.\n */\n export interface IOverlayGeometry {\n /**\n * The distance between the overlay and parent top edges.\n */\n top: number;\n\n /**\n * The distance between the overlay and parent left edges.\n */\n left: number;\n\n /**\n * The distance between the overlay and parent right edges.\n */\n right: number;\n\n /**\n * The distance between the overlay and parent bottom edges.\n */\n bottom: number;\n }\n\n /**\n * An object which manages the overlay node for a dock panel.\n */\n export interface IOverlay {\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n *\n * #### Notes\n * The given geometry values assume the node will use absolute\n * positioning.\n *\n * This is called on every mouse move event during a drag in order\n * to update the position of the overlay. It should be efficient.\n */\n show(geo: IOverlayGeometry): void;\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 should hide the overlay immediately.\n *\n * #### Notes\n * This is called whenever the overlay node should been hidden.\n */\n hide(delay: number): void;\n }\n\n /**\n * A concrete implementation of `IOverlay`.\n *\n * This is the default overlay implementation for a dock panel.\n */\n export class Overlay implements IOverlay {\n /**\n * Construct a new overlay.\n */\n constructor() {\n this.node = document.createElement('div');\n this.node.classList.add('lm-DockPanel-overlay');\n this.node.classList.add('lm-mod-hidden');\n this.node.style.position = 'absolute';\n this.node.style.contain = 'strict';\n }\n\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n */\n show(geo: IOverlayGeometry): void {\n // Update the position of the overlay.\n let style = this.node.style;\n style.top = `${geo.top}px`;\n style.left = `${geo.left}px`;\n style.right = `${geo.right}px`;\n style.bottom = `${geo.bottom}px`;\n\n // Clear any pending hide timer.\n clearTimeout(this._timer);\n this._timer = -1;\n\n // If the overlay is already visible, we're done.\n if (!this._hidden) {\n return;\n }\n\n // Clear the hidden flag.\n this._hidden = false;\n\n // Finally, show the overlay.\n this.node.classList.remove('lm-mod-hidden');\n }\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 will hide the overlay immediately.\n */\n hide(delay: number): void {\n // Do nothing if the overlay is already hidden.\n if (this._hidden) {\n return;\n }\n\n // Hide immediately if the delay is <= 0.\n if (delay <= 0) {\n clearTimeout(this._timer);\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n return;\n }\n\n // Do nothing if a hide is already pending.\n if (this._timer !== -1) {\n return;\n }\n\n // Otherwise setup the hide timer.\n this._timer = window.setTimeout(() => {\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n }, delay);\n }\n\n private _timer = -1;\n private _hidden = true;\n }\n\n /**\n * A type alias for a dock panel renderer;\n */\n export type IRenderer = DockLayout.IRenderer;\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new tab bar for use with a dock panel.\n *\n * @returns A new tab bar for a dock panel.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar {\n let bar = new TabBar({ document });\n bar.addClass('lm-DockPanel-tabBar');\n return bar;\n }\n\n /**\n * Create a new handle node for use with a dock panel.\n *\n * @returns A new handle node for a dock panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-DockPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * The default sizes for the edge drop zones, in pixels.\n */\n export const DEFAULT_EDGES = {\n /**\n * The size of the top edge dock zone for the root panel, in pixels.\n * This is different from the others to distinguish between the top\n * tab bar and the top root zone.\n */\n top: 12,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n right: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n bottom: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n left: 40\n };\n\n /**\n * A singleton `'layout-modified'` conflatable message.\n */\n export const LayoutModified = new ConflatableMessage('layout-modified');\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The handle which was pressed.\n */\n handle: HTMLDivElement;\n\n /**\n * The X offset of the press in handle coordinates.\n */\n deltaX: number;\n\n /**\n * The Y offset of the press in handle coordinates.\n */\n deltaY: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * A type alias for a drop zone.\n */\n export type DropZone =\n | /**\n * An invalid drop zone.\n */\n 'invalid'\n\n /**\n * The entirety of the root dock area.\n */\n | 'root-all'\n\n /**\n * The top portion of the root dock area.\n */\n | 'root-top'\n\n /**\n * The left portion of the root dock area.\n */\n | 'root-left'\n\n /**\n * The right portion of the root dock area.\n */\n | 'root-right'\n\n /**\n * The bottom portion of the root dock area.\n */\n | 'root-bottom'\n\n /**\n * The entirety of a tabbed widget area.\n */\n | 'widget-all'\n\n /**\n * The top portion of tabbed widget area.\n */\n | 'widget-top'\n\n /**\n * The left portion of tabbed widget area.\n */\n | 'widget-left'\n\n /**\n * The right portion of tabbed widget area.\n */\n | 'widget-right'\n\n /**\n * The bottom portion of tabbed widget area.\n */\n | 'widget-bottom'\n\n /**\n * The the bar of a tabbed widget area.\n */\n | 'widget-tab';\n\n /**\n * An object which holds the drop target zone and widget.\n */\n export interface IDropTarget {\n /**\n * The semantic zone for the mouse position.\n */\n zone: DropZone;\n\n /**\n * The tab area geometry for the drop zone, or `null`.\n */\n target: DockLayout.ITabAreaGeometry | null;\n }\n\n /**\n * An attached property used to track generated tab bars.\n */\n export const isGeneratedTabBarProperty = new AttachedProperty<\n Widget,\n boolean\n >({\n name: 'isGeneratedTabBar',\n create: () => false\n });\n\n /**\n * Create a single document config for the widgets in a dock panel.\n */\n export function createSingleDocumentConfig(\n panel: DockPanel\n ): DockPanel.ILayoutConfig {\n // Return an empty config if the panel is empty.\n if (panel.isEmpty) {\n return { main: null };\n }\n\n // Get a flat array of the widgets in the panel.\n let widgets = Array.from(panel.widgets());\n\n // Get the first selected widget in the panel.\n let selected = panel.selectedWidgets().next().value;\n\n // Compute the current index for the new config.\n let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n // Return the single document config.\n return { main: { type: 'tab-area', widgets, currentIndex } };\n }\n\n /**\n * Find the drop target at the given client position.\n */\n export function findDropTarget(\n panel: DockPanel,\n clientX: number,\n clientY: number,\n edges: DockPanel.IEdges\n ): IDropTarget {\n // Bail if the mouse is not over the dock panel.\n if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n return { zone: 'invalid', target: null };\n }\n\n // Look up the layout for the panel.\n let layout = panel.layout as DockLayout;\n\n // If the layout is empty, indicate the entire root drop zone.\n if (layout.isEmpty) {\n return { zone: 'root-all', target: null };\n }\n\n // Test the edge zones when in multiple document mode.\n if (panel.mode === 'multiple-document') {\n // Get the client rect for the dock panel.\n let panelRect = panel.node.getBoundingClientRect();\n\n // Compute the distance to each edge of the panel.\n let pl = clientX - panelRect.left + 1;\n let pt = clientY - panelRect.top + 1;\n let pr = panelRect.right - clientX;\n let pb = panelRect.bottom - clientY;\n\n // Find the minimum distance to an edge.\n let pd = Math.min(pt, pr, pb, pl);\n\n // Return a root zone if the mouse is within an edge.\n switch (pd) {\n case pt:\n if (pt < edges.top) {\n return { zone: 'root-top', target: null };\n }\n break;\n case pr:\n if (pr < edges.right) {\n return { zone: 'root-right', target: null };\n }\n break;\n case pb:\n if (pb < edges.bottom) {\n return { zone: 'root-bottom', target: null };\n }\n break;\n case pl:\n if (pl < edges.left) {\n return { zone: 'root-left', target: null };\n }\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Hit test the dock layout at the given client position.\n let target = layout.hitTestTabAreas(clientX, clientY);\n\n // Bail if no target area was found.\n if (!target) {\n return { zone: 'invalid', target: null };\n }\n\n // Return the whole tab area when in single document mode.\n if (panel.mode === 'single-document') {\n return { zone: 'widget-all', target };\n }\n\n // Compute the distance to each edge of the tab area.\n let al = target.x - target.left + 1;\n let at = target.y - target.top + 1;\n let ar = target.left + target.width - target.x;\n let ab = target.top + target.height - target.y;\n\n const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n if (at < tabHeight) {\n return { zone: 'widget-tab', target };\n }\n\n // Get the X and Y edge sizes for the area.\n let rx = Math.round(target.width / 3);\n let ry = Math.round(target.height / 3);\n\n // If the mouse is not within an edge, indicate the entire area.\n if (al > rx && ar > rx && at > ry && ab > ry) {\n return { zone: 'widget-all', target };\n }\n\n // Scale the distances by the slenderness ratio.\n al /= rx;\n at /= ry;\n ar /= rx;\n ab /= ry;\n\n // Find the minimum distance to the area edge.\n let ad = Math.min(al, at, ar, ab);\n\n // Find the widget zone for the area edge.\n let zone: DropZone;\n switch (ad) {\n case al:\n zone = 'widget-left';\n break;\n case at:\n zone = 'widget-top';\n break;\n case ar:\n zone = 'widget-right';\n break;\n case ab:\n zone = 'widget-bottom';\n break;\n default:\n throw 'unreachable';\n }\n\n // Return the final drop target.\n return { zone, target };\n }\n\n /**\n * Get the drop reference widget for a tab bar.\n */\n export function getDropRef(tabBar: TabBar): Widget | null {\n if (tabBar.titles.length === 0) {\n return null;\n }\n if (tabBar.currentTitle) {\n return tabBar.currentTitle.owner;\n }\n return tabBar.titles[tabBar.titles.length - 1].owner;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n /**\n * Construct a new grid layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: GridLayout.IOptions = {}) {\n super(options);\n if (options.rowCount !== undefined) {\n Private.reallocSizers(this._rowSizers, options.rowCount);\n }\n if (options.columnCount !== undefined) {\n Private.reallocSizers(this._columnSizers, options.columnCount);\n }\n if (options.rowSpacing !== undefined) {\n this._rowSpacing = Private.clampValue(options.rowSpacing);\n }\n if (options.columnSpacing !== undefined) {\n this._columnSpacing = Private.clampValue(options.columnSpacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the widgets and layout items.\n for (const item of this._items) {\n let widget = item.widget;\n item.dispose();\n widget.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._rowStarts.length = 0;\n this._rowSizers.length = 0;\n this._columnStarts.length = 0;\n this._columnSizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the number of rows in the layout.\n */\n get rowCount(): number {\n return this._rowSizers.length;\n }\n\n /**\n * Set the number of rows in the layout.\n *\n * #### Notes\n * The minimum row count is `1`.\n */\n set rowCount(value: number) {\n // Do nothing if the row count does not change.\n if (value === this.rowCount) {\n return;\n }\n\n // Reallocate the row sizers.\n Private.reallocSizers(this._rowSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the number of columns in the layout.\n */\n get columnCount(): number {\n return this._columnSizers.length;\n }\n\n /**\n * Set the number of columns in the layout.\n *\n * #### Notes\n * The minimum column count is `1`.\n */\n set columnCount(value: number) {\n // Do nothing if the column count does not change.\n if (value === this.columnCount) {\n return;\n }\n\n // Reallocate the column sizers.\n Private.reallocSizers(this._columnSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the row spacing for the layout.\n */\n get rowSpacing(): number {\n return this._rowSpacing;\n }\n\n /**\n * Set the row spacing for the layout.\n */\n set rowSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._rowSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._rowSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the column spacing for the layout.\n */\n get columnSpacing(): number {\n return this._columnSpacing;\n }\n\n /**\n * Set the col spacing for the layout.\n */\n set columnSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._columnSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._columnSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @returns The stretch factor for the row.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n rowStretch(index: number): number {\n let sizer = this._rowSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @param value - The stretch factor for the row.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setRowStretch(index: number, value: number): void {\n // Look up the row sizer.\n let sizer = this._rowSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Get the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @returns The stretch factor for the column.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n columnStretch(index: number): number {\n let sizer = this._columnSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @param value - The stretch factor for the column.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setColumnStretch(index: number, value: number): void {\n // Look up the column sizer.\n let sizer = this._columnSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n for (const item of this._items) {\n yield item.widget;\n }\n }\n\n /**\n * Add a widget to the grid layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, this is no-op.\n */\n addWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is already in the layout.\n if (i !== -1) {\n return;\n }\n\n // Add the widget to the layout.\n this._items.push(new LayoutItem(widget));\n\n // Attach the widget to the parent.\n if (this.parent) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Remove a widget from the grid layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is not in the layout.\n if (i === -1) {\n return;\n }\n\n // Remove the widget from the layout.\n let item = ArrayExt.removeAt(this._items, i)!;\n\n // Detach the widget from the parent.\n if (this.parent) {\n this.detachWidget(widget);\n }\n\n // Dispose the layout item.\n item.dispose();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Reset the min sizes of the sizers.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n this._rowSizers[i].minSize = 0;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n this._columnSizers[i].minSize = 0;\n }\n\n // Filter for the visible layout items.\n let items = this._items.filter(it => !it.isHidden);\n\n // Fit the layout items.\n for (let i = 0, n = items.length; i < n; ++i) {\n items[i].fit();\n }\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Sort the items by row span.\n items.sort(Private.rowSpanCmp);\n\n // Update the min sizes of the row sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the row bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n // Distribute the minimum height to the sizers as needed.\n Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n }\n\n // Sort the items by column span.\n items.sort(Private.columnSpanCmp);\n\n // Update the min sizes of the column sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the column bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let c1 = Math.min(config.column, maxCol);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Distribute the minimum width to the sizers as needed.\n Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n }\n\n // If no size constraint is needed, just update the parent.\n if (this.fitPolicy === 'set-no-constraint') {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n return;\n }\n\n // Set up the computed min size.\n let minH = maxRow * this._rowSpacing;\n let minW = maxCol * this._columnSpacing;\n\n // Add the sizer minimums to the computed min size.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n minH += this._rowSizers[i].minSize;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n minW += this._columnSizers[i].minSize;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Compute the total fixed row and column space.\n let fixedRowSpace = maxRow * this._rowSpacing;\n let fixedColSpace = maxCol * this._columnSpacing;\n\n // Distribute the available space to the box sizers.\n BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n // Update the row start positions.\n for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n this._rowStarts[i] = pos;\n pos += this._rowSizers[i].size + this._rowSpacing;\n }\n\n // Update the column start positions.\n for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n this._columnStarts[i] = pos;\n pos += this._columnSizers[i].size + this._columnSpacing;\n }\n\n // Update the geometry of the layout items.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the cell bounds for the widget.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let c1 = Math.min(config.column, maxCol);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Compute the cell geometry.\n let x = this._columnStarts[c1];\n let y = this._rowStarts[r1];\n let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n // Update the geometry of the layout item.\n item.update(x, y, w, h);\n }\n }\n\n private _dirty = false;\n private _rowSpacing = 4;\n private _columnSpacing = 4;\n private _items: LayoutItem[] = [];\n private _rowStarts: number[] = [];\n private _columnStarts: number[] = [];\n private _rowSizers: BoxSizer[] = [new BoxSizer()];\n private _columnSizers: BoxSizer[] = [new BoxSizer()];\n private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n /**\n * An options object for initializing a grid layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The initial row count for the layout.\n *\n * The default is `1`.\n */\n rowCount?: number;\n\n /**\n * The initial column count for the layout.\n *\n * The default is `1`.\n */\n columnCount?: number;\n\n /**\n * The spacing between rows in the layout.\n *\n * The default is `4`.\n */\n rowSpacing?: number;\n\n /**\n * The spacing between columns in the layout.\n *\n * The default is `4`.\n */\n columnSpacing?: number;\n }\n\n /**\n * An object which holds the cell configuration for a widget.\n */\n export interface ICellConfig {\n /**\n * The row index for the widget.\n */\n readonly row: number;\n\n /**\n * The column index for the widget.\n */\n readonly column: number;\n\n /**\n * The row span for the widget.\n */\n readonly rowSpan: number;\n\n /**\n * The column span for the widget.\n */\n readonly columnSpan: number;\n }\n\n /**\n * Get the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The cell config for the widget.\n */\n export function getCellConfig(widget: Widget): ICellConfig {\n return Private.cellConfigProperty.get(widget);\n }\n\n /**\n * Set the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the cell config.\n */\n export function setCellConfig(\n widget: Widget,\n value: Partial\n ): void {\n Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for the widget cell config.\n */\n export const cellConfigProperty = new AttachedProperty<\n Widget,\n GridLayout.ICellConfig\n >({\n name: 'cellConfig',\n create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n changed: onChildCellConfigChanged\n });\n\n /**\n * Normalize a partial cell config object.\n */\n export function normalizeConfig(\n config: Partial\n ): GridLayout.ICellConfig {\n let row = Math.max(0, Math.floor(config.row || 0));\n let column = Math.max(0, Math.floor(config.column || 0));\n let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n return { row, column, rowSpan, columnSpan };\n }\n\n /**\n * Clamp a value to an integer >= 0.\n */\n export function clampValue(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * A sort comparison function for row spans.\n */\n export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.rowSpan - c2.rowSpan;\n }\n\n /**\n * A sort comparison function for column spans.\n */\n export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.columnSpan - c2.columnSpan;\n }\n\n /**\n * Reallocate the box sizers for the given grid dimensions.\n */\n export function reallocSizers(sizers: BoxSizer[], count: number): void {\n // Coerce the count to the valid range.\n count = Math.max(1, Math.floor(count));\n\n // Add the missing sizers.\n while (sizers.length < count) {\n sizers.push(new BoxSizer());\n }\n\n // Remove the extra sizers.\n if (sizers.length > count) {\n sizers.length = count;\n }\n }\n\n /**\n * Distribute a min size constraint across a range of sizers.\n */\n export function distributeMin(\n sizers: BoxSizer[],\n i1: number,\n i2: number,\n minSize: number\n ): void {\n // Sanity check the indices.\n if (i2 < i1) {\n return;\n }\n\n // Handle the simple case of no cell span.\n if (i1 === i2) {\n let sizer = sizers[i1];\n sizer.minSize = Math.max(sizer.minSize, minSize);\n return;\n }\n\n // Compute the total current min size of the span.\n let totalMin = 0;\n for (let i = i1; i <= i2; ++i) {\n totalMin += sizers[i].minSize;\n }\n\n // Do nothing if the total is greater than the required.\n if (totalMin >= minSize) {\n return;\n }\n\n // Compute the portion of the space to allocate to each sizer.\n let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n // Add the portion to each sizer.\n for (let i = i1; i <= i2; ++i) {\n sizers[i].minSize += portion;\n }\n }\n\n /**\n * The change handler for the child cell config property.\n */\n function onChildCellConfigChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof GridLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n */\nexport class MenuBar extends Widget {\n /**\n * Construct a new menu bar.\n *\n * @param options - The options for initializing the menu bar.\n */\n constructor(options: MenuBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-MenuBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.renderer = options.renderer || MenuBar.defaultRenderer;\n this._forceItemsPosition = options.forceItemsPosition || {\n forceX: true,\n forceY: true\n };\n this._overflowMenuOptions = options.overflowMenuOptions || {\n isVisible: true\n };\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._closeChildMenu();\n this._menus.length = 0;\n super.dispose();\n }\n\n /**\n * The renderer used by the menu bar.\n */\n readonly renderer: MenuBar.IRenderer;\n\n /**\n * The child menu of the menu bar.\n *\n * #### Notes\n * This will be `null` if the menu bar does not have an open menu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The overflow index of the menu bar.\n */\n get overflowIndex(): number {\n return this._overflowIndex;\n }\n\n /**\n * The overflow menu of the menu bar.\n */\n get overflowMenu(): Menu | null {\n return this._overflowMenu;\n }\n\n /**\n * Get the menu bar content node.\n *\n * #### Notes\n * This is the node which holds the menu title nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-MenuBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu.\n */\n get activeMenu(): Menu | null {\n return this._menus[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu.\n *\n * #### Notes\n * If the menu does not exist, the menu will be set to `null`.\n */\n set activeMenu(value: Menu | null) {\n this.activeIndex = value ? this._menus.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu.\n *\n * #### Notes\n * This will be `-1` if no menu is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu.\n *\n * #### Notes\n * If the menu cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._menus.length) {\n value = -1;\n }\n\n // An empty menu cannot be active\n if (value > -1 && this._menus[value].items.length === 0) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menus in the menu bar.\n */\n get menus(): ReadonlyArray {\n return this._menus;\n }\n\n /**\n * Open the active menu and activate its first menu item.\n *\n * #### Notes\n * If there is no active menu, this is a no-op.\n */\n openActiveMenu(): void {\n // Bail early if there is no active item.\n if (this._activeIndex === -1) {\n return;\n }\n\n // Open the child menu.\n this._openChildMenu();\n\n // Activate the first item in the child menu.\n if (this._childMenu) {\n this._childMenu.activeIndex = -1;\n this._childMenu.activateNextItem();\n }\n }\n\n /**\n * Add a menu to the end of the menu bar.\n *\n * @param menu - The menu to add to the menu bar.\n *\n * #### Notes\n * If the menu is already added to the menu bar, it will be moved.\n */\n addMenu(menu: Menu, update: boolean = true): void {\n this.insertMenu(this._menus.length, menu, update);\n }\n\n /**\n * Insert a menu into the menu bar at the specified index.\n *\n * @param index - The index at which to insert the menu.\n *\n * @param menu - The menu to insert into the menu bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the menus.\n *\n * If the menu is already added to the menu bar, it will be moved.\n */\n insertMenu(index: number, menu: Menu, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Look up the index of the menu.\n let i = this._menus.indexOf(menu);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._menus.length));\n\n // If the menu is not in the array, insert it.\n if (i === -1) {\n // Insert the menu into the array.\n ArrayExt.insert(this._menus, j, menu);\n\n // Add the styling class to the menu.\n menu.addClass('lm-MenuBar-menu');\n\n // Connect to the menu signals.\n menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n menu.menuRequested.connect(this._onMenuMenuRequested, this);\n menu.title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the menu exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._menus.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the menu to the new locations.\n ArrayExt.move(this._menus, i, j);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove a menu from the menu bar.\n *\n * @param menu - The menu to remove from the menu bar.\n *\n * #### Notes\n * This is a no-op if the menu is not in the menu bar.\n */\n removeMenu(menu: Menu, update: boolean = true): void {\n this.removeMenuAt(this._menus.indexOf(menu), update);\n }\n\n /**\n * Remove the menu at a given index from the menu bar.\n *\n * @param index - The index of the menu to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeMenuAt(index: number, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Remove the menu from the array.\n let menu = ArrayExt.removeAt(this._menus, index);\n\n // Bail if the index is out of range.\n if (!menu) {\n return;\n }\n\n // Disconnect from the menu signals.\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n\n // Remove the styling class from the menu.\n menu.removeClass('lm-MenuBar-menu');\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove all menus from the menu bar.\n */\n clearMenus(): void {\n // Bail if there is nothing to remove.\n if (this._menus.length === 0) {\n return;\n }\n\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Disconnect from the menu signals and remove the styling class.\n for (let menu of this._menus) {\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n menu.removeClass('lm-MenuBar-menu');\n }\n\n // Clear the menus array.\n this._menus.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Handle the DOM events for the menu bar.\n *\n * @param event - The DOM event sent to the menu bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu bar's DOM nodes. It\n * should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'focusout':\n this._evtFocusOut(event as FocusEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mousedown', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('focusout', this);\n this.node.addEventListener('contextmenu', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mousedown', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('focusout', this);\n this.node.removeEventListener('contextmenu', this);\n this._closeChildMenu();\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this._focusItemAt(0);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n this.update();\n super.onResize(msg);\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let menus = this._menus;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let tabFocusIndex =\n this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n ? this._tabFocusIndex\n : 0;\n let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n let totalMenuSize = 0;\n let isVisible = false;\n\n // Check that the overflow menu doesn't count\n length = this._overflowMenu !== null ? length - 1 : length;\n let content = new Array(length);\n\n // Render visible menus\n for (let i = 0; i < length; ++i) {\n content[i] = renderer.renderItem({\n title: menus[i].title,\n active: i === activeIndex,\n tabbable: i === tabFocusIndex,\n disabled: menus[i].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = i;\n this.activeIndex = i;\n }\n });\n // Calculate size of current menu\n totalMenuSize += this._menuItemSizes[i];\n // Check if overflow menu is already rendered\n if (menus[i].title.label === this._overflowMenuOptions.title) {\n isVisible = true;\n length--;\n }\n }\n // Render overflow menu if needed and active\n if (this._overflowMenuOptions.isVisible) {\n if (this._overflowIndex > -1 && !isVisible) {\n // Create overflow menu\n if (this._overflowMenu === null) {\n const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n this._overflowMenu.title.label = overflowMenuTitle;\n this._overflowMenu.title.mnemonic = 0;\n this.addMenu(this._overflowMenu, false);\n }\n // Move menus to overflow menu\n for (let i = menus.length - 2; i >= length; i--) {\n const submenu = this.menus[i];\n submenu.title.mnemonic = 0;\n this._overflowMenu.insertItem(0, {\n type: 'submenu',\n submenu: submenu\n });\n this.removeMenu(submenu, false);\n }\n content[length] = renderer.renderItem({\n title: this._overflowMenu.title,\n active: length === activeIndex && menus[length].items.length !== 0,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n } else if (this._overflowMenu !== null) {\n // Remove submenus from overflow menu\n let overflowMenuItems = this._overflowMenu.items;\n let screenSize = this.node.offsetWidth;\n let n = this._overflowMenu.items.length;\n for (let i = 0; i < n; ++i) {\n let index = menus.length - 1 - i;\n if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n let menu = overflowMenuItems[0].submenu as Menu;\n this._overflowMenu.removeItemAt(0);\n this.insertMenu(length, menu, false);\n content[length] = renderer.renderItem({\n title: menu.title,\n active: false,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n }\n }\n if (this._overflowMenu.items.length === 0) {\n this.removeMenu(this._overflowMenu, false);\n content.pop();\n this._overflowMenu = null;\n this._overflowIndex = -1;\n }\n }\n }\n VirtualDOM.render(content, this.contentNode);\n this._updateOverflowIndex();\n }\n\n /**\n * Calculate and update the current overflow index.\n */\n private _updateOverflowIndex(): void {\n if (!this._overflowMenuOptions.isVisible) {\n return;\n }\n\n // Get elements visible in the main menu bar\n const itemMenus = this.contentNode.childNodes;\n let screenSize = this.node.offsetWidth;\n let totalMenuSize = 0;\n let index = -1;\n let n = itemMenus.length;\n\n if (this._menuItemSizes.length == 0) {\n // Check if it is the first resize and get info about menu items sizes\n for (let i = 0; i < n; i++) {\n let item = itemMenus[i] as HTMLLIElement;\n // Add sizes to array\n totalMenuSize += item.offsetWidth;\n this._menuItemSizes.push(item.offsetWidth);\n if (totalMenuSize > screenSize && index === -1) {\n index = i;\n }\n }\n } else {\n // Calculate current menu size\n for (let i = 0; i < this._menuItemSizes.length; i++) {\n totalMenuSize += this._menuItemSizes[i];\n if (totalMenuSize > screenSize) {\n index = i;\n break;\n }\n }\n }\n this._overflowIndex = index;\n }\n\n /**\n * Handle the `'keydown'` event for the menu bar.\n *\n * #### Notes\n * All keys are trapped except the tab key that is ignored.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Reset the active index on tab, but do not trap the tab key.\n if (kc === 9) {\n this.activeIndex = -1;\n return;\n }\n\n // A menu bar handles all other keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Enter, Space, Up Arrow, Down Arrow\n if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n // The active index may have changed (for example, user hovers over an\n // item with the mouse), so be sure to use the focus index.\n this.activeIndex = this._tabFocusIndex;\n if (this.activeIndex !== this._tabFocusIndex) {\n // Bail if the setter refused to set activeIndex to tabFocusIndex\n // because it means that the item at tabFocusIndex cannot be opened (for\n // example, it has an empty menu)\n return;\n }\n this.openActiveMenu();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this._closeChildMenu();\n this._focusItemAt(this.activeIndex);\n return;\n }\n\n // Left or Right Arrow\n if (kc === 37 || kc === 39) {\n let direction = kc === 37 ? -1 : 1;\n let start = this._tabFocusIndex + direction;\n let n = this._menus.length;\n for (let i = 0; i < n; i++) {\n let index = (n + start + direction * i) % n;\n if (this._menus[index].items.length) {\n this._focusItemAt(index);\n return;\n }\n }\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._menus, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that menu is opened.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.openActiveMenu();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n this._focusItemAt(this.activeIndex);\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n this._focusItemAt(this.activeIndex);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the menu bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the mouse press was not on the menu bar. This can occur\n // when the document listener is installed for an active menu bar.\n if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n return;\n }\n\n // Stop the propagation of the event. Immediate propagation is\n // also stopped so that an open menu does not handle the event.\n event.stopPropagation();\n event.stopImmediatePropagation();\n\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // If the press was not on an item, close the child menu.\n if (index === -1) {\n this._closeChildMenu();\n return;\n }\n\n // If the press was not the left mouse button, do nothing further.\n if (event.button !== 0) {\n return;\n }\n\n // Otherwise, toggle the open state of the child menu.\n if (this._childMenu) {\n this._closeChildMenu();\n this.activeIndex = index;\n } else {\n // If we don't call preventDefault() here, then the item in the menu\n // bar will take focus over the menu that is being opened.\n event.preventDefault();\n const position = this._positionForMenu(index);\n Menu.saveWindowData();\n // Begin DOM modifications.\n this.activeIndex = index;\n this._openChildMenu(position);\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the menu bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the active index will not change.\n if (index === this._activeIndex) {\n return;\n }\n\n // Bail early if a child menu is open and the mouse is not over\n // an item. This allows the child menu to be kept open when the\n // mouse is over the empty part of the menu bar.\n if (index === -1 && this._childMenu) {\n return;\n }\n\n // Get position for the new menu >before< updating active index.\n const position =\n index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n // Before any modification, update window data.\n Menu.saveWindowData();\n\n // Begin DOM modifications.\n\n // Update the active index to the hovered item.\n this.activeIndex = index;\n\n // Open the new menu if a menu is already open.\n if (position) {\n this._openChildMenu(position);\n }\n }\n\n /**\n * Find initial position for the menu based on menubar item position.\n *\n * NOTE: this should be called before updating active index to avoid\n * an additional layout and style invalidation as changing active\n * index modifies DOM.\n */\n private _positionForMenu(index: number): Private.IPosition {\n let itemNode = this.contentNode.children[index];\n let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n return {\n top: bottom,\n left\n };\n }\n\n /**\n * Handle the `'focusout'` event for the menu bar.\n */\n private _evtFocusOut(event: FocusEvent): void {\n // Reset the active index if there is no open menu and the menubar is losing focus.\n if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n this.activeIndex = -1;\n }\n }\n\n /**\n * Focus an item in the menu bar.\n *\n * #### Notes\n * Does not open the associated menu.\n */\n private _focusItemAt(index: number): void {\n const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n if (itemNode) {\n itemNode.focus();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if there is no active menu.\n */\n private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n // If there is no active menu, close the current menu.\n let newMenu = this.activeMenu;\n if (!newMenu) {\n this._closeChildMenu();\n return;\n }\n\n // Bail if there is no effective menu change.\n let oldMenu = this._childMenu;\n if (oldMenu === newMenu) {\n return;\n }\n\n // Swap the internal menu reference.\n this._childMenu = newMenu;\n\n // Close the current menu, or setup for the new menu.\n if (oldMenu) {\n oldMenu.close();\n } else {\n document.addEventListener('mousedown', this, true);\n }\n\n // Update the tab focus index and ensure the menu bar is updated.\n this._tabFocusIndex = this.activeIndex;\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n // Get the positioning data for the new menu.\n let { left, top } = options;\n if (typeof left === 'undefined' || typeof top === 'undefined') {\n ({ left, top } = this._positionForMenu(this._activeIndex));\n }\n // Begin DOM modifications\n\n if (!oldMenu) {\n // Continue setup for new menu\n this.addClass('lm-mod-active');\n }\n\n // Open the new menu at the computed location.\n if (newMenu.items.length > 0) {\n newMenu.open(left, top, this._forceItemsPosition);\n }\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n // Bail if no child menu is open.\n if (!this._childMenu) {\n return;\n }\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n let menu = this._childMenu;\n this._childMenu = null;\n\n // Close the menu.\n menu.close();\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `aboutToClose` signal of a menu.\n */\n private _onMenuAboutToClose(sender: Menu): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n this._childMenu = null;\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `menuRequested` signal of a child menu.\n */\n private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Look up the active index and menu count.\n let i = this._activeIndex;\n let n = this._menus.length;\n\n // Active the next requested index.\n switch (args) {\n case 'next':\n this.activeIndex = i === n - 1 ? 0 : i + 1;\n break;\n case 'previous':\n this.activeIndex = i === 0 ? n - 1 : i - 1;\n break;\n }\n\n // Open the active menu.\n this.openActiveMenu();\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(): void {\n this.update();\n }\n\n // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n private _activeIndex = -1;\n // Track which item can be focused using the TAB key. Unlike _activeIndex will\n // always point to a menuitem. Whenever you update this value, it's important\n // to follow it with an \"update-request\" message so that the `tabindex`\n // attribute on each menubar item gets properly updated.\n private _tabFocusIndex = 0;\n private _forceItemsPosition: Menu.IOpenOptions;\n private _overflowMenuOptions: IOverflowMenuOptions;\n private _menus: Menu[] = [];\n private _childMenu: Menu | null = null;\n private _overflowMenu: Menu | null = null;\n private _menuItemSizes: number[] = [];\n private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n /**\n * An options object for creating a menu bar.\n */\n export interface IOptions {\n /**\n * A custom renderer for creating menu bar content.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n /**\n * Whether to force the position of the menu. The MenuBar forces the\n * coordinates of its menus by default. With this option you can disable it.\n *\n * Setting to `false` will enable the logic which repositions the\n * coordinates of the menu if it will not fit entirely on screen.\n *\n * The default is `true`.\n */\n forceItemsPosition?: Menu.IOpenOptions;\n /**\n * Whether to add a overflow menu if there's overflow.\n *\n * Setting to `true` will enable the logic that creates an overflow menu\n * to show the menu items that don't fit entirely on the screen.\n *\n * The default is `true`.\n */\n overflowMenuOptions?: IOverflowMenuOptions;\n }\n\n /**\n * An object which holds the data to render a menu bar item.\n */\n export interface IRenderData {\n /**\n * The title to be rendered.\n */\n readonly title: Title;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the user can tab to the item.\n */\n readonly tabbable: boolean;\n\n /**\n * Whether the item is disabled.\n *\n * #### Notes\n * A disabled item cannot be active.\n * A disabled item cannot be focussed.\n */\n readonly disabled?: boolean;\n\n readonly onfocus?: (event: FocusEvent) => void;\n }\n\n /**\n * A renderer for use with a menu bar.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n\n /**\n * Render the icon element for a menu bar item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.title.icon is undefined, it will be ignored.\n return h.div({ className }, data.title.icon!, data.title.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n }\n\n /**\n * Create the class name for the menu bar item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n let name = 'lm-MenuBar-item';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.active && !data.disabled) {\n name += ' lm-mod-active';\n }\n return name;\n }\n\n /**\n * Create the dataset for a menu bar item.\n *\n * @param data - The data to use for the item.\n *\n * @returns The dataset for the menu bar item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the aria attributes for menu bar item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n return {\n role: 'menuitem',\n 'aria-haspopup': 'true',\n 'aria-disabled': data.disabled ? 'true' : 'false'\n };\n }\n\n /**\n * Create the class name for the menu bar item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-MenuBar-itemIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.title;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n /**\n * Determines if a overflow menu appears when the menu items overflow.\n *\n * Defaults to `true`.\n */\n isVisible: boolean;\n /**\n * Determines the title of the overflow menu.\n *\n * Default: `...`.\n */\n title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a menu bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-MenuBar-content';\n node.appendChild(content);\n content.setAttribute('role', 'menubar');\n return node;\n }\n\n /**\n * Position for the menu relative to top-left screen corner.\n */\n export interface IPosition {\n /**\n * Pixels right from screen origin.\n */\n left: number;\n /**\n * Pixels down from screen origin.\n */\n top: number;\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n menus: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = menus.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Look up the menu title.\n let title = menus[k].title;\n\n // Ignore titles with an empty label.\n if (title.label.length === 0) {\n continue;\n }\n\n // Look up the mnemonic index for the label.\n let mn = title.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < title.label.length) {\n if (title.label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n /**\n * Construct a new scroll bar.\n *\n * @param options - The options for initializing the scroll bar.\n */\n constructor(options: ScrollBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-ScrollBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n\n // Set the orientation.\n this._orientation = options.orientation || 'vertical';\n this.dataset['orientation'] = this._orientation;\n\n // Parse the rest of the options.\n if (options.maximum !== undefined) {\n this._maximum = Math.max(0, options.maximum);\n }\n if (options.page !== undefined) {\n this._page = Math.max(0, options.page);\n }\n if (options.value !== undefined) {\n this._value = Math.max(0, Math.min(options.value, this._maximum));\n }\n }\n\n /**\n * A signal emitted when the user moves the scroll thumb.\n *\n * #### Notes\n * The payload is the current value of the scroll bar.\n */\n get thumbMoved(): ISignal {\n return this._thumbMoved;\n }\n\n /**\n * A signal emitted when the user clicks a step button.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get stepRequested(): ISignal {\n return this._stepRequested;\n }\n\n /**\n * A signal emitted when the user clicks the scroll track.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get pageRequested(): ISignal {\n return this._pageRequested;\n }\n\n /**\n * Get the orientation of the scroll bar.\n */\n get orientation(): ScrollBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the scroll bar.\n */\n set orientation(value: ScrollBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making changes.\n this._releaseMouse();\n\n // Update the internal orientation.\n this._orientation = value;\n this.dataset['orientation'] = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the current value of the scroll bar.\n */\n get value(): number {\n return this._value;\n }\n\n /**\n * Set the current value of the scroll bar.\n *\n * #### Notes\n * The value will be clamped to the range `[0, maximum]`.\n */\n set value(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Do nothing if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the page size of the scroll bar.\n *\n * #### Notes\n * The page size is the amount of visible content in the scrolled\n * region, expressed in data units. It determines the size of the\n * scroll bar thumb.\n */\n get page(): number {\n return this._page;\n }\n\n /**\n * Set the page size of the scroll bar.\n *\n * #### Notes\n * The page size will be clamped to the range `[0, Infinity]`.\n */\n set page(value: number) {\n // Clamp the page size to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._page === value) {\n return;\n }\n\n // Update the internal page size.\n this._page = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the maximum value of the scroll bar.\n */\n get maximum(): number {\n return this._maximum;\n }\n\n /**\n * Set the maximum value of the scroll bar.\n *\n * #### Notes\n * The max size will be clamped to the range `[0, Infinity]`.\n */\n set maximum(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._maximum === value) {\n return;\n }\n\n // Update the internal values.\n this._maximum = value;\n\n // Clamp the current value to the new range.\n this._value = Math.min(this._value, value);\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * The scroll bar decrement button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get decrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar increment button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get incrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[1] as HTMLDivElement;\n }\n\n /**\n * The scroll bar track node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get trackNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-track'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar thumb node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get thumbNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-thumb'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Handle the DOM events for the scroll bar.\n *\n * @param event - The DOM event sent to the scroll bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the scroll bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A method invoked on a 'before-attach' message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('mousedown', this);\n this.update();\n }\n\n /**\n * A method invoked on an 'after-detach' message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n }\n\n /**\n * A method invoked on an 'update-request' message.\n */\n protected onUpdateRequest(msg: Message): void {\n // Convert the value and page into percentages.\n let value = (this._value * 100) / this._maximum;\n let page = (this._page * 100) / (this._page + this._maximum);\n\n // Clamp the value and page to the relevant range.\n value = Math.max(0, Math.min(value, 100));\n page = Math.max(0, Math.min(page, 100));\n\n // Fetch the thumb style.\n let thumbStyle = this.thumbNode.style;\n\n // Update the thumb style for the current orientation.\n if (this._orientation === 'horizontal') {\n thumbStyle.top = '';\n thumbStyle.height = '';\n thumbStyle.left = `${value}%`;\n thumbStyle.width = `${page}%`;\n thumbStyle.transform = `translate(${-value}%, 0%)`;\n } else {\n thumbStyle.left = '';\n thumbStyle.width = '';\n thumbStyle.top = `${value}%`;\n thumbStyle.height = `${page}%`;\n thumbStyle.transform = `translate(0%, ${-value}%)`;\n }\n }\n\n /**\n * Handle the `'keydown'` event for the scroll bar.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Ignore anything except the `Escape` key.\n if (event.keyCode !== 27) {\n return;\n }\n\n // Fetch the previous scroll value.\n let value = this._pressData ? this._pressData.value : -1;\n\n // Release the mouse.\n this._releaseMouse();\n\n // Restore the old scroll value if possible.\n if (value !== -1) {\n this._moveThumb(value);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the scroll bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Do nothing if it's not a left mouse press.\n if (event.button !== 0) {\n return;\n }\n\n // Send an activate request to the scroll bar. This can be\n // used by message hooks to activate something relevant.\n this.activate();\n\n // Do nothing if the mouse is already captured.\n if (this._pressData) {\n return;\n }\n\n // Find the pressed scroll bar part.\n let part = Private.findPart(this, event.target as HTMLElement);\n\n // Do nothing if the part is not of interest.\n if (!part) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Override the mouse cursor.\n let override = Drag.overrideCursor('default');\n\n // Set up the press data.\n this._pressData = {\n part,\n override,\n delta: -1,\n value: -1,\n mouseX: event.clientX,\n mouseY: event.clientY\n };\n\n // Add the extra event listeners.\n document.addEventListener('mousemove', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Handle a thumb press.\n if (part === 'thumb') {\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Update the press data delta for the current orientation.\n if (this._orientation === 'horizontal') {\n this._pressData.delta = event.clientX - thumbRect.left;\n } else {\n this._pressData.delta = event.clientY - thumbRect.top;\n }\n\n // Add the active class to the thumb node.\n thumbNode.classList.add('lm-mod-active');\n\n // Store the current value in the press data.\n this._pressData.value = this._value;\n\n // Finished.\n return;\n }\n\n // Handle a track press.\n if (part === 'track') {\n // Fetch the client rect for the thumb.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n\n // Handle a decrement button press.\n if (part === 'decrement') {\n // Add the active class to the decrement node.\n this.decrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button press.\n if (part === 'increment') {\n // Add the active class to the increment node.\n this.incrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the scroll bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Do nothing if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Update the mouse position.\n this._pressData.mouseX = event.clientX;\n this._pressData.mouseY = event.clientY;\n\n // Bail if the thumb is not being dragged.\n if (this._pressData.part !== 'thumb') {\n return;\n }\n\n // Get the client rect for the thumb and track.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n let trackRect = this.trackNode.getBoundingClientRect();\n\n // Fetch the scroll geometry based on the orientation.\n let trackPos: number;\n let trackSpan: number;\n if (this._orientation === 'horizontal') {\n trackPos = event.clientX - trackRect.left - this._pressData.delta;\n trackSpan = trackRect.width - thumbRect.width;\n } else {\n trackPos = event.clientY - trackRect.top - this._pressData.delta;\n trackSpan = trackRect.height - thumbRect.height;\n }\n\n // Compute the desired value from the scroll geometry.\n let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n // Move the thumb to the computed value.\n this._moveThumb(value);\n }\n\n /**\n * Handle the `'mouseup'` event for the scroll bar.\n */\n private _evtMouseUp(event: MouseEvent): void {\n // Do nothing if it's not a left mouse release.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse and restore the node states.\n */\n private _releaseMouse(): void {\n // Bail if there is no press data.\n if (!this._pressData) {\n return;\n }\n\n // Clear the repeat timer.\n clearTimeout(this._repeatTimer);\n this._repeatTimer = -1;\n\n // Clear the press data.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra event listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n\n // Remove the active classes from the nodes.\n this.thumbNode.classList.remove('lm-mod-active');\n this.decrementNode.classList.remove('lm-mod-active');\n this.incrementNode.classList.remove('lm-mod-active');\n }\n\n /**\n * Move the thumb to the specified position.\n */\n private _moveThumb(value: number): void {\n // Clamp the value to the allowed range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Bail if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update of the scroll bar.\n this.update();\n\n // Emit the thumb moved signal.\n this._thumbMoved.emit(value);\n }\n\n /**\n * A timeout callback for repeating the mouse press.\n */\n private _onRepeat = () => {\n // Clear the repeat timer id.\n this._repeatTimer = -1;\n\n // Bail if the mouse has been released.\n if (!this._pressData) {\n return;\n }\n\n // Look up the part that was pressed.\n let part = this._pressData.part;\n\n // Bail if the thumb was pressed.\n if (part === 'thumb') {\n return;\n }\n\n // Schedule the timer for another repeat.\n this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n // Get the current mouse position.\n let mouseX = this._pressData.mouseX;\n let mouseY = this._pressData.mouseY;\n\n // Handle a decrement button repeat.\n if (part === 'decrement') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button repeat.\n if (part === 'increment') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n\n // Handle a track repeat.\n if (part === 'track') {\n // Bail if the mouse is not over the track.\n if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Bail if the mouse is over the thumb.\n if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n };\n\n private _value = 0;\n private _page = 10;\n private _maximum = 100;\n private _repeatTimer = -1;\n private _orientation: ScrollBar.Orientation;\n private _pressData: Private.IPressData | null = null;\n private _thumbMoved = new Signal(this);\n private _stepRequested = new Signal(this);\n private _pageRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n /**\n * A type alias for a scroll bar orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * An options object for creating a scroll bar.\n */\n export interface IOptions {\n /**\n * The orientation of the scroll bar.\n *\n * The default is `'vertical'`.\n */\n orientation?: Orientation;\n\n /**\n * The value for the scroll bar.\n *\n * The default is `0`.\n */\n value?: number;\n\n /**\n * The page size for the scroll bar.\n *\n * The default is `10`.\n */\n page?: number;\n\n /**\n * The maximum value for the scroll bar.\n *\n * The default is `100`.\n */\n maximum?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A type alias for the parts of a scroll bar.\n */\n export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The scroll bar part which was pressed.\n */\n part: ScrollBarPart;\n\n /**\n * The offset of the press in thumb coordinates, or -1.\n */\n delta: number;\n\n /**\n * The scroll value at the time the thumb was pressed, or -1.\n */\n value: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n\n /**\n * The current X position of the mouse.\n */\n mouseX: number;\n\n /**\n * The current Y position of the mouse.\n */\n mouseY: number;\n }\n\n /**\n * Create the DOM node for a scroll bar.\n */\n export function createNode(): HTMLElement {\n let node = document.createElement('div');\n let decrement = document.createElement('div');\n let increment = document.createElement('div');\n let track = document.createElement('div');\n let thumb = document.createElement('div');\n decrement.className = 'lm-ScrollBar-button';\n increment.className = 'lm-ScrollBar-button';\n decrement.dataset['action'] = 'decrement';\n increment.dataset['action'] = 'increment';\n track.className = 'lm-ScrollBar-track';\n thumb.className = 'lm-ScrollBar-thumb';\n track.appendChild(thumb);\n node.appendChild(decrement);\n node.appendChild(track);\n node.appendChild(increment);\n return node;\n }\n\n /**\n * Find the scroll bar part which contains the given target.\n */\n export function findPart(\n scrollBar: ScrollBar,\n target: HTMLElement\n ): ScrollBarPart | null {\n // Test the thumb.\n if (scrollBar.thumbNode.contains(target)) {\n return 'thumb';\n }\n\n // Test the track.\n if (scrollBar.trackNode.contains(target)) {\n return 'track';\n }\n\n // Test the decrement button.\n if (scrollBar.decrementNode.contains(target)) {\n return 'decrement';\n }\n\n // Test the increment button.\n if (scrollBar.incrementNode.contains(target)) {\n return 'increment';\n }\n\n // Indicate no match.\n return null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n /**\n * Construct a new stacked panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: StackedPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-StackedPanel');\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as StackedLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as StackedLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when a widget is removed from a stacked panel.\n */\n get widgetRemoved(): ISignal {\n return this._widgetRemoved;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-StackedPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-StackedPanel-child');\n this._widgetRemoved.emit(msg.child);\n }\n\n private _widgetRemoved = new Signal(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n /**\n * An options object for creating a stacked panel.\n */\n export interface IOptions {\n /**\n * The stacked layout to use for the stacked panel.\n *\n * The default is a new `StackedLayout`.\n */\n layout?: StackedLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a stacked layout for the given panel options.\n */\n export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n return options.layout || new StackedLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n constructor(options: TabPanel.IOptions = {}) {\n super();\n this.addClass('lm-TabPanel');\n\n // Create the tab bar and stacked panel.\n this.tabBar = new TabBar(options);\n this.tabBar.addClass('lm-TabPanel-tabBar');\n this.stackedPanel = new StackedPanel();\n this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n // Connect the tab bar signal handlers.\n this.tabBar.tabMoved.connect(this._onTabMoved, this);\n this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n this.tabBar.tabActivateRequested.connect(\n this._onTabActivateRequested,\n this\n );\n this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Connect the stacked panel signal handlers.\n this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n // Get the data related to the placement.\n this._tabPlacement = options.tabPlacement || 'top';\n let direction = Private.directionFromPlacement(this._tabPlacement);\n let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = this._tabPlacement;\n\n // Create the box layout.\n let layout = new BoxLayout({ direction, spacing: 0 });\n\n // Set the stretch factors for the child widgets.\n BoxLayout.setStretch(this.tabBar, 0);\n BoxLayout.setStretch(this.stackedPanel, 1);\n\n // Add the child widgets to the layout.\n layout.addWidget(this.tabBar);\n layout.addWidget(this.stackedPanel);\n\n // Install the layout on the tab panel.\n this.layout = layout;\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal {\n return this._currentChanged;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this.tabBar.currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `-1`.\n */\n set currentIndex(value: number) {\n this.tabBar.currentIndex = value;\n }\n\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get currentWidget(): Widget | null {\n let title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n }\n\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set currentWidget(value: Widget | null) {\n this.tabBar.currentTitle = value ? value.title : null;\n }\n\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get tabsMovable(): boolean {\n return this.tabBar.tabsMovable;\n }\n\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set tabsMovable(value: boolean) {\n this.tabBar.tabsMovable = value;\n }\n\n /**\n * Get the whether the add button is enabled.\n *\n */\n get addButtonEnabled(): boolean {\n return this.tabBar.addButtonEnabled;\n }\n\n /**\n * Set the whether the add button is enabled.\n *\n */\n set addButtonEnabled(value: boolean) {\n this.tabBar.addButtonEnabled = value;\n }\n\n /**\n * Get the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n get tabPlacement(): TabPanel.TabPlacement {\n return this._tabPlacement;\n }\n\n /**\n * Set the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n set tabPlacement(value: TabPanel.TabPlacement) {\n // Bail if the placement does not change.\n if (this._tabPlacement === value) {\n return;\n }\n\n // Update the internal value.\n this._tabPlacement = value;\n\n // Get the values related to the placement.\n let direction = Private.directionFromPlacement(value);\n let orientation = Private.orientationFromPlacement(value);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = value;\n\n // Update the layout direction.\n (this.layout as BoxLayout).direction = direction;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The tab bar used by the tab panel.\n *\n * #### Notes\n * Modifying the tab bar directly can lead to undefined behavior.\n */\n readonly tabBar: TabBar;\n\n /**\n * The stacked panel used by the tab panel.\n *\n * #### Notes\n * Modifying the panel directly can lead to undefined behavior.\n */\n readonly stackedPanel: StackedPanel;\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return this.stackedPanel.widgets;\n }\n\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this.widgets.length, widget);\n }\n\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n insertWidget(index: number, widget: Widget): void {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.stackedPanel.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n\n widget.node.setAttribute('role', 'tabpanel');\n\n let renderer = this.tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n // Extract the widgets from the titles.\n let previousWidget = previousTitle ? previousTitle.owner : null;\n let currentWidget = currentTitle ? currentTitle.owner : null;\n\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex,\n previousWidget,\n currentIndex,\n currentWidget\n });\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n }\n\n /**\n * Handle the `tabAddRequested` signal from the tab bar.\n */\n private _onTabAddRequested(sender: TabBar, args: void): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n private _onTabMoved(\n sender: TabBar,\n args: TabBar.ITabMovedArgs\n ): void {\n this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n }\n\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n this.tabBar.removeTab(widget.title);\n }\n\n private _tabPlacement: TabPanel.TabPlacement;\n private _currentChanged = new Signal(\n this\n );\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n /**\n * A type alias for tab placement in a tab bar.\n */\n export type TabPlacement =\n | /**\n * The tabs are placed as a row above the content.\n */\n 'top'\n\n /**\n * The tabs are placed as a column to the left of the content.\n */\n | 'left'\n\n /**\n * The tabs are placed as a column to the right of the content.\n */\n | 'right'\n\n /**\n * The tabs are placed as a row below the content.\n */\n | 'bottom';\n\n /**\n * An options object for initializing a tab panel.\n */\n export interface IOptions {\n /**\n * The document to use with the tab panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether the button to add new tabs is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The placement of the tab bar relative to the content.\n *\n * The default is `'top'`.\n */\n tabPlacement?: TabPlacement;\n\n /**\n * The renderer for the panel's tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: TabBar.IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n previousIndex: number;\n\n /**\n * The previously selected widget.\n */\n previousWidget: Widget | null;\n\n /**\n * The currently selected index.\n */\n currentIndex: number;\n\n /**\n * The currently selected widget.\n */\n currentWidget: Widget | null;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Convert a tab placement to tab bar orientation.\n */\n export function orientationFromPlacement(\n plc: TabPanel.TabPlacement\n ): TabBar.Orientation {\n return placementToOrientationMap[plc];\n }\n\n /**\n * Convert a tab placement to a box layout direction.\n */\n export function directionFromPlacement(\n plc: TabPanel.TabPlacement\n ): BoxLayout.Direction {\n return placementToDirectionMap[plc];\n }\n\n /**\n * A mapping of tab placement to tab bar orientation.\n */\n const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n top: 'horizontal',\n left: 'vertical',\n right: 'vertical',\n bottom: 'horizontal'\n };\n\n /**\n * A mapping of tab placement to box layout direction.\n */\n const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n top: 'top-to-bottom',\n left: 'left-to-right',\n right: 'right-to-left',\n bottom: 'bottom-to-top'\n };\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this._widget) {\n let widget = this._widget;\n this._widget = null;\n widget.dispose();\n }\n super.dispose();\n }\n\n /**\n * Get the child widget for the layout.\n */\n get widget(): Widget | null {\n return this._widget;\n }\n\n /**\n * Set the child widget for the layout.\n *\n * #### Notes\n * Setting the child widget will cause the old child widget to be\n * automatically disposed. If that is not desired, set the parent\n * of the old child to `null` before assigning a new child.\n */\n set widget(widget: Widget | null) {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n if (widget) {\n widget.parent = this.parent;\n }\n\n // Bail early if the widget does not change.\n if (this._widget === widget) {\n return;\n }\n\n // Dispose of the old child widget.\n if (this._widget) {\n this._widget.dispose();\n }\n\n // Update the internal widget.\n this._widget = widget;\n\n // Attach the new child widget if needed.\n if (this.parent && widget) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n if (this._widget) {\n yield this._widget;\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Bail early if the widget does not exist in the layout.\n if (this._widget !== widget) {\n return;\n }\n\n // Clear the internal widget.\n this._widget = null;\n\n // If the layout is parented, detach the widget from the DOM.\n if (this.parent) {\n this.detachWidget(widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n constructor(options: StackedLayout.IOptions = {}) {\n super(options);\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n if (this.widgets.length > 1) {\n this.widgets.forEach(w => {\n w.hiddenMode = this._hiddenMode;\n });\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n this._items.length > 0\n ) {\n if (this._items.length === 1) {\n this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n }\n widget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n widget.hiddenMode = Widget.HiddenMode.Display;\n }\n\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Reset the z-index for the widget.\n item!.widget.node.style.zIndex = '';\n\n // Reset the hidden mode for the widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n widget.hiddenMode = Widget.HiddenMode.Display;\n\n // Reset the hidden mode for the first widget if necessary.\n if (this._items.length === 1) {\n this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n }\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the computed minimum size.\n minW = Math.max(minW, item.minWidth);\n minH = Math.max(minH, item.minHeight);\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the widget stacking order and layout geometry.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Set the z-index for the widget.\n item.widget.node.style.zIndex = `${i}`;\n\n // Update the item geometry.\n item.update(left, top, width, height);\n }\n }\n\n private _dirty = false;\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n /**\n * An options object for initializing a stacked layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker implements IDisposable {\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose(): void {\n // Do nothing if the tracker is already disposed.\n if (this._counter < 0) {\n return;\n }\n\n // Mark the tracker as disposed.\n this._counter = -1;\n\n // Clear the connections for the tracker.\n Signal.clearData(this);\n\n // Remove all event listeners.\n for (const widget of this._widgets) {\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n }\n\n // Clear the internal data structures.\n this._activeWidget = null;\n this._currentWidget = null;\n this._nodes.clear();\n this._numbers.clear();\n this._widgets.length = 0;\n }\n\n /**\n * A signal emitted when the current widget has changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when the active widget has changed.\n */\n get activeChanged(): ISignal> {\n return this._activeChanged;\n }\n\n /**\n * A flag indicating whether the tracker is disposed.\n */\n get isDisposed(): boolean {\n return this._counter < 0;\n }\n\n /**\n * The current widget in the tracker.\n *\n * #### Notes\n * The current widget is the widget among the tracked widgets which\n * has the *descendant node* which has most recently been focused.\n *\n * The current widget will not be updated if the node loses focus. It\n * will only be updated when a different tracked widget gains focus.\n *\n * If the current widget is removed from the tracker, the previous\n * current widget will be restored.\n *\n * This behavior is intended to follow a user's conceptual model of\n * a semantically \"current\" widget, where the \"last thing of type X\"\n * to be interacted with is the \"current instance of X\", regardless\n * of whether that instance still has focus.\n */\n get currentWidget(): T | null {\n return this._currentWidget;\n }\n\n /**\n * The active widget in the tracker.\n *\n * #### Notes\n * The active widget is the widget among the tracked widgets which\n * has the *descendant node* which is currently focused.\n */\n get activeWidget(): T | null {\n return this._activeWidget;\n }\n\n /**\n * A read only array of the widgets being tracked.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Get the focus number for a particular widget in the tracker.\n *\n * @param widget - The widget of interest.\n *\n * @returns The focus number for the given widget, or `-1` if the\n * widget has not had focus since being added to the tracker, or\n * is not contained by the tracker.\n *\n * #### Notes\n * The focus number indicates the relative order in which the widgets\n * have gained focus. A widget with a larger number has gained focus\n * more recently than a widget with a smaller number.\n *\n * The `currentWidget` will always have the largest focus number.\n *\n * All widgets start with a focus number of `-1`, which indicates that\n * the widget has not been focused since being added to the tracker.\n */\n focusNumber(widget: T): number {\n let n = this._numbers.get(widget);\n return n === undefined ? -1 : n;\n }\n\n /**\n * Test whether the focus tracker contains a given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns `true` if the widget is tracked, `false` otherwise.\n */\n has(widget: T): boolean {\n return this._numbers.has(widget);\n }\n\n /**\n * Add a widget to the focus tracker.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is already tracked, this is a no-op.\n */\n add(widget: T): void {\n // Do nothing if the widget is already tracked.\n if (this._numbers.has(widget)) {\n return;\n }\n\n // Test whether the widget has focus.\n let focused = widget.node.contains(document.activeElement);\n\n // Set up the initial focus number.\n let n = focused ? this._counter++ : -1;\n\n // Add the widget to the internal data structures.\n this._widgets.push(widget);\n this._numbers.set(widget, n);\n this._nodes.set(widget.node, widget);\n\n // Set up the event listeners. The capturing phase must be used\n // since the 'focus' and 'blur' events don't bubble and Firefox\n // doesn't support the 'focusin' or 'focusout' events.\n widget.node.addEventListener('focus', this, true);\n widget.node.addEventListener('blur', this, true);\n\n // Connect the disposed signal handler.\n widget.disposed.connect(this._onWidgetDisposed, this);\n\n // Set the current and active widgets if needed.\n if (focused) {\n this._setWidgets(widget, widget);\n }\n }\n\n /**\n * Remove a widget from the focus tracker.\n *\n * #### Notes\n * If the widget is the `currentWidget`, the previous current widget\n * will become the new `currentWidget`.\n *\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is not tracked, this is a no-op.\n */\n remove(widget: T): void {\n // Bail early if the widget is not tracked.\n if (!this._numbers.has(widget)) {\n return;\n }\n\n // Disconnect the disposed signal handler.\n widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n // Remove the event listeners.\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n\n // Remove the widget from the internal data structures.\n ArrayExt.removeFirstOf(this._widgets, widget);\n this._nodes.delete(widget.node);\n this._numbers.delete(widget);\n\n // Bail early if the widget is not the current widget.\n if (this._currentWidget !== widget) {\n return;\n }\n\n // Filter the widgets for those which have had focus.\n let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n // Get the valid widget with the max focus number.\n let previous =\n max(valid, (first, second) => {\n let a = this._numbers.get(first)!;\n let b = this._numbers.get(second)!;\n return a - b;\n }) || null;\n\n // Set the current and active widgets.\n this._setWidgets(previous, null);\n }\n\n /**\n * Handle the DOM events for the focus tracker.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tracked nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n }\n }\n\n /**\n * Set the current and active widgets for the tracker.\n */\n private _setWidgets(current: T | null, active: T | null): void {\n // Swap the current widget.\n let oldCurrent = this._currentWidget;\n this._currentWidget = current;\n\n // Swap the active widget.\n let oldActive = this._activeWidget;\n this._activeWidget = active;\n\n // Emit the `currentChanged` signal if needed.\n if (oldCurrent !== current) {\n this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n }\n\n // Emit the `activeChanged` signal if needed.\n if (oldActive !== active) {\n this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n }\n }\n\n /**\n * Handle the `'focus'` event for a tracked widget.\n */\n private _evtFocus(event: FocusEvent): void {\n // Find the widget which gained focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Update the focus number if necessary.\n if (widget !== this._currentWidget) {\n this._numbers.set(widget, this._counter++);\n }\n\n // Set the current and active widgets.\n this._setWidgets(widget, widget);\n }\n\n /**\n * Handle the `'blur'` event for a tracked widget.\n */\n private _evtBlur(event: FocusEvent): void {\n // Find the widget which lost focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Get the node which being focused after this blur.\n let focusTarget = event.relatedTarget as HTMLElement;\n\n // If no other node is being focused, clear the active widget.\n if (!focusTarget) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n\n // Bail if the focus widget is not changing.\n if (widget.node.contains(focusTarget)) {\n return;\n }\n\n // If no tracked widget is being focused, clear the active widget.\n if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n }\n\n /**\n * Handle the `disposed` signal for a tracked widget.\n */\n private _onWidgetDisposed(sender: T): void {\n this.remove(sender);\n }\n\n private _counter = 0;\n private _widgets: T[] = [];\n private _activeWidget: T | null = null;\n private _currentWidget: T | null = null;\n private _numbers = new Map();\n private _nodes = new Map();\n private _activeChanged = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n /**\n * An arguments object for the changed signals.\n */\n export interface IChangedArgs {\n /**\n * The old value for the widget.\n */\n oldValue: T | null;\n\n /**\n * The new value for the widget.\n */\n newValue: T | null;\n }\n}\n"],"mappings":"2/BAoBaA,EAAbC,cAcEC,KAAQC,SAAG,EAeXD,KAAOE,QAAG,EAeVF,KAAOG,QAAGC,IAkBVJ,KAAOK,QAAG,EAcVL,KAAIM,KAAG,EAUPN,KAAIO,MAAG,C,EAMT,IAAiBC,ECo/BPC,EC/RAA,ECh0BOC,EH2GAF,gDA0XhB,KA3TiBG,KAAhB,SAAqBC,EAA6BC,GAEhD,IAAIC,EAAQF,EAAOG,OACnB,GAAc,IAAVD,EACF,OAAOD,EAIT,IAAIG,EAAW,EACXC,EAAW,EACXC,EAAY,EACZC,EAAe,EACfC,EAAe,EAGnB,IAAK,IAAIC,EAAI,EAAGA,EAAIP,IAASO,EAAG,CAC9B,IAAIC,EAAQV,EAAOS,GACfE,EAAMD,EAAMpB,QACZsB,EAAMF,EAAMnB,QACZsB,EAAOH,EAAMrB,SACjBqB,EAAMf,MAAO,EACbe,EAAMhB,KAAOoB,KAAKF,IAAID,EAAKG,KAAKH,IAAIE,EAAMD,IAC1CN,GAAaI,EAAMhB,KACnBU,GAAYO,EACZN,GAAYO,EACRF,EAAMjB,QAAU,IAClBc,GAAgBG,EAAMjB,QACtBe,IAEH,CAGD,GAAIP,IAAUK,EACZ,OAAO,EAIT,GAAIL,GAASG,EAAU,CACrB,IAAK,IAAIK,EAAI,EAAGA,EAAIP,IAASO,EAAG,CAC9B,IAAIC,EAAQV,EAAOS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AEAA,EAAK9Y,MAAMlC,MAAM6E,U,CAMXsyB,qBACNviB,EACAoG,GAEAA,EAAK9Y,MAAMlC,MAAM+E,O,CAMXkyB,YACNriB,EACAoG,GAEA1e,KAAK2lC,aAAax2B,aAAauP,EAAK3O,QAAS2O,EAAK9Y,MAAMlC,M,CAMlDkiC,iBAAiBttB,EAAsB9Q,GAC7CA,EAAOrC,KAAK0F,gBAAgB,QAC5BrD,EAAOrC,KAAK0F,gBAAgB,mBAC5B7K,KAAKq0B,OAAOjH,UAAU5lB,EAAO5B,M"} +\ No newline at end of file ++{"version":3,"names":["BoxSizer","constructor","this","sizeHint","minSize","maxSize","Infinity","stretch","size","done","BoxEngine","Private","Utils","calc","sizers","space","count","length","totalMin","totalMax","totalSize","totalStretch","stretchCount","i","sizer","min","max","hint","Math","nearZero","notDoneCount","freeSpace","distSpace","distStretch","amt","adjust","index","delta","growLimit","shrinkLimit","n","grow","limit","shrink","growSizer","shrinkSizer","Title","options","_label","_caption","_mnemonic","_icon","undefined","_iconClass","_iconLabel","_className","_closable","_changed","Signal","_isDisposed","owner","label","mnemonic","icon","iconClass","iconLabel","caption","className","closable","_dataset","dataset","changed","value","emit","isDisposed","dispose","clearData","Widget","_flags","_layout","_parent","_disposed","_hiddenMode","HiddenMode","Display","node","createNode","addClass","setFlag","Flag","IsDisposed","parent","isAttached","detach","title","MessageLoop","AttachedProperty","disposed","testFlag","IsAttached","isHidden","IsHidden","isVisible","IsVisible","titleProperty","get","id","hiddenMode","_toggleHidden","Scale","style","willChange","contains","Error","msg","ChildMessage","sendMessage","Msg","ParentChanged","layout","DisallowLayout","children","widget","hasClass","name","classList","add","removeClass","remove","toggleClass","force","toggle","update","postMessage","UpdateRequest","fit","FitRequest","activate","ActivateRequest","close","CloseRequest","show","BeforeShow","clearFlag","AfterShow","hide","BeforeHide","AfterHide","setHidden","hidden","flag","processMessage","type","notifyLayout","onResize","onUpdateRequest","onFitRequest","onBeforeShow","onAfterShow","onBeforeHide","onAfterHide","onBeforeAttach","onAfterAttach","onBeforeDetach","onAfterDetach","onActivateRequest","onCloseRequest","onChildAdded","onChildRemoved","processParentMessage","transform","setAttribute","ContentVisibility","contentVisibility","zIndex","removeAttribute","Message","BeforeAttach","AfterAttach","BeforeDetach","AfterDetach","ConflatableMessage","child","super","ResizeMessage","width","height","UnknownSize","attach","host","ref","isConnected","insertBefore","parentNode","removeChild","create","document","createElement","tag","Layout","_fitPolicy","fitPolicy","init","minWidth","minHeight","maxWidth","maxHeight","onChildShown","onChildHidden","removeWidget","getHorizontalAlignment","horizontalAlignmentProperty","setHorizontalAlignment","set","getVerticalAlignment","verticalAlignmentProperty","setVerticalAlignment","LayoutItem","_top","NaN","_left","_width","_height","_minWidth","_minHeight","_maxWidth","_maxHeight","position","contain","top","left","limits","ElementExt","sizeLimits","clampW","clampH","resized","onAlignmentChanged","PanelLayout","_widgets","pop","widgets","Symbol","iterator","addWidget","insertWidget","indexOf","j","ArrayExt","insert","attachWidget","move","moveWidget","removeWidgetAt","removeAt","detachWidget","fromIndex","toIndex","clampDimension","floor","Utils$1","SplitLayout","widgetOffset","_fixed","_spacing","_dirty","_hasNormedSizes","_sizers","_items","_handles","_box","_alignment","_orientation","renderer","orientation","alignment","spacing","item","handles","absoluteSizes","map","relativeSizes","normalize","setRelativeSizes","sizes","temp","slice","push","normed","moveHandle","handle","offsetLeft","offsetTop","createHandle","average","averageSize","createSizer","appendChild","_update","_fit","updateItemPosition","isHorizontal","handleStyle","nVisible","lastHandleIndex","horz","minW","minH","getStretch","box","boxSizing","horizontalSum","verticalSum","offsetWidth","offsetHeight","paddingTop","paddingLeft","extra","offset","fullOffset","stretchProperty","setStretch","coerce","reduce","v","s","values","sum","a","b","abs","AccordionLayout","_titles","titleSpace","titles","updateTitle","oldTitle","expanded","newTitle","createTitle","replaceChild","UUID","uuid4","titleStyle","data","createSectionTitle","Panel","createLayout","SplitPanel","_handleMoved","_pressData","_releaseMouse","handleMoved","handleEvent","event","_evtPointerDown","_evtPointerMove","_evtPointerUp","_evtKeyDown","preventDefault","stopPropagation","addEventListener","removeEventListener","keyCode","button","findFirstIndex","target","rect","getBoundingClientRect","clientX","clientY","window","getComputedStyle","override","Drag","overrideCursor","cursor","pos","Renderer","defaultRenderer","AccordionPanel","_widgetSizesCache","WeakMap","_expansionToggled","expansionToggled","connect","_onTitleChanged","collapse","_toggleExpansion","expand","_evtClick","_eventKeyDown","sender","_computeWidgetSize","widgetSizes","prev","curr","newSize","previousSize","widgetToCollapse","sz","lastIndexOf","forEach","_","idx","currentSize","defaultPrevented","handled","toString","key","match","click","direction","newIndex","focus","titleClassName","_titleID","_titleKeys","_uuid","_nInstance","createCollapseIcon","createTitleKey","aData","textContent","BoxLayout","_direction","getSizeBasis","sizeBasisProperty","setSizeBasis","onChildSizingChanged","dir","clampSpacing","BoxPanel","CommandPalette","_activeIndex","_results","commands","commandChanged","_onGenericChange","keyBindingChanged","searchNode","getElementsByClassName","inputNode","contentNode","items","addItem","createItem","refresh","addItems","newItems","removeItem","removeItemAt","clearItems","display","_toggleFocused","input","select","query","results","search","canActivate","VirtualDOM","render","content","renderEmptyMessage","activeIndex","Array","result","indices","category","renderHeader","active","renderItem","scrollTop","element","scrollIntoViewIfNeeded","_execute","altKey","ctrlKey","metaKey","shiftKey","_activatePreviousItem","_activateNextItem","ai","start","stop","findLastIndex","part","toLowerCase","isEnabled","execute","command","args","focused","activeElement","formatHeader","h","li","createItemClass","createItemDataset","isToggleable","role","isToggled","renderItemIcon","renderItemContent","renderItemShortcut","formatEmptyMessage","createIconClass","div","renderItemLabel","renderItemCaption","formatItemLabel","formatItemCaption","formatItemShortcut","StringExt","highlight","mark","kb","keyBinding","CommandRegistry","formatKeystroke","keys","fuzzySearch","source","score","rgx","rgxMatch","exec","matchSumOfDeltas","pivot","lowerBound","categoryIndices","labelIndices","matchType","scoreCmp","m1","d1","i1","i2","d2","localeCompare","r1","rank","r2","wrapper","clear","spellcheck","CommandItem","scores","text","replace","matchItems","sort","createResults","_commands","trim","JSONExt","emptyObject","findLastValue","keyBindings","deepEqual","Menu","_childIndex","_openTimerID","_closeTimerID","_childMenu","_parentMenu","_aboutToClose","_menuRequested","aboutToClose","menuRequested","parentMenu","childMenu","rootMenu","menu","leafMenu","activeItem","childNodes","activateNextItem","activatePreviousItem","triggerActiveItem","_cancelOpenTimer","_cancelCloseTimer","_openChildMenu","console","log","insertItem","open","x","y","forceX","forceY","_a","_b","openRootMenu","_evtMouseUp","_evtMouseMove","_evtMouseEnter","_evtMouseLeave","_evtMouseDown","ownerDocument","collapsedFlags","computeCollapsed","collapsed","onfocus","kc","getKeyboardLayout","keyForKeydownEvent","findMnemonic","multiple","auto","hitTest","_startCloseTimer","submenu","_startOpenTimer","hitTestMenus","activateFirst","_closeChildMenu","saveWindowData","itemNode","openSubmenu","setTimeout","TIMER_DELAY","clearTimeout","static","aria","createItemARIA","tabindex","renderIcon","renderLabel","renderShortcut","renderSubmenu","formatLabel","formatShortcut","prefix","suffix","char","span","SUBMENU_OVERLAP","transientWindowDataCache","transientCacheCounter","getWindowData","_getWindowData","pageXOffset","pageYOffset","clientWidth","documentElement","clientHeight","tabIndex","MenuItem","fill","k1","k2","windowData","px","py","cw","ch","opacity","body","itemRect","right","borderTop","bottom","borderBottom","paddingBottom","upperKey","toUpperCase","k","mn","itemCmpRank","itemCmp","s1","Selector","calculateSpecificity","selector","s2","isValid","validateSelector","groupByTarget","sortBySelector","currentTarget","elementFromPoint","availableItems","matches","parentElement","ARROW_KEYS","TabBar","_currentIndex","_titlesEditable","_previousTitle","_dragData","_addButtonEnabled","_tabMoved","_currentChanged","_addRequested","_tabCloseRequested","_tabDetachRequested","_tabActivateRequested","_document","tabsMovable","titlesEditable","allowDeselect","addButtonEnabled","insertBehavior","removeBehavior","currentChanged","tabMoved","tabActivateRequested","addRequested","tabCloseRequested","tabDetachRequested","currentTitle","currentIndex","pi","pt","ci","ct","previousIndex","previousTitle","_name","addButtonNode","addTab","insertTab","asTitle","_adjustCurrentForInsert","_adjustCurrentForMove","removeTab","removeTabAt","disconnect","_adjustCurrentForRemove","clearTabs","releaseMouse","_evtDblClick","eventPhase","Event","CAPTURING_PHASE","_evtKeyDownCapturing","tabHandlingTabindex","_getCurrentTabindex","current","renderTab","elemTabindex","querySelector","getAttribute","tabs","tab","oldValue","innerHTML","onblur","focusedElement","includes","focusable","nextFocused","focusedIndex","_c","addButtonClicked","pressX","pressY","tabPos","tabSize","tabPressPos","targetIndex","tabLayout","contentRect","dragActive","dragAborted","detachRequested","closeIconSelector","dragExceeded","tabRect","tabPressOffset","snapTabLayout","detachExceeded","layoutTabs","finalizeTabPosition","duration","parseTransitionDuration","resetTabPositions","bh","_tabID","_tabKeys","createTabKey","createTabStyle","createTabClass","createTabDataset","createTabARIA","renderCloseIcon","addButtonSelector","DRAG_THRESHOLD","DETACH_THRESHOLD","parseFloat","transitionDuration","margin","marginLeft","marginTop","dx","dy","pressPos","localPos","clientPos","clientSize","targetPos","targetEnd","pxPos","threshold","ideal","tgt","final","DockLayout","_root","Map","bar","tabBars","isEmpty","iterAllWidgets","empty","iterUserWidgets","selectedWidgets","iterSelectedWidgets","iterTabBars","iterHandles","offsetX","offsetY","findSplitNode","holdSizes","saveLayout","holdAllSizes","main","createConfig","restoreLayout","config","mainConfig","widgetSet","Set","normalizeAreaConfig","oldWidgets","oldTabBars","oldHandles","has","tabBar","realizeAreaConfig","createTabBar","_createTabBar","_createHandle","mode","refNode","findTabNode","_insertTab","_insertSplit","_removeWidget","hitTestTabAreas","borderLeft","tabNode","hitTestTabNodes","borderWidth","borderRight","borderHeight","delete","removeAria","splitNode","removeFirstOf","syncHandles","maybeParent","childNode","childHandle","TabLayoutNode","splitHandle","gChild","gHandle","gSizer","_createTabNode","addAria","after","findFirstTabNode","merge","root","_splitRoot","normalizeSizes","GOLDEN_RATIO","sibling","SplitLayoutNode","normalized","oldRoot","newRoot","normalizeTabAreaConfig","normalizeSplitAreaConfig","realizeTabAreaConfig","realizeSplitAreaConfig","tabSizer","widgetSizer","tabBarItem","widgetItem","tabBarSizer","createNormalizedSizes","horizontal","fixed","tabId","DockPanel","_drag","_tabsMovable","_tabsConstrained","_layoutModified","_mode","_renderer","_edges","edges","DEFAULT_EDGES","tabsConstrained","overlay","Overlay","layoutModified","createSingleDocumentConfig","LayoutModified","selectWidget","find","activateWidget","Platform","IS_EDGE","IS_IE","flush","_evtDragEnter","_evtDragLeave","_evtDragOver","_evtDrop","isGeneratedTabBarProperty","mimeData","hasData","_showOverlay","dropAction","proposedAction","zone","findDropTarget","factory","getData","getDropRef","deltaX","deltaY","xPos","yPos","paddingRight","tabHeight","_onTabMoved","_onCurrentChanged","_onTabCloseRequested","_onTabDetachRequested","_onTabActivateRequested","_onTabAddRequested","MimeData","setData","dragImage","cloneNode","supportedActions","then","_timer","_hidden","geo","delay","panel","from","selected","next","panelRect","pl","pr","pb","al","at","ar","ab","rx","round","ry","GridLayout","_rowSpacing","_columnSpacing","_rowStarts","_columnStarts","_rowSizers","_columnSizers","rowCount","reallocSizers","columnCount","rowSpacing","clampValue","columnSpacing","rowStretch","setRowStretch","columnStretch","setColumnStretch","it","filter","maxRow","maxCol","rowSpanCmp","getCellConfig","row","rowSpan","distributeMin","columnSpanCmp","c1","column","c2","columnSpan","fixedRowSpace","fixedColSpace","w","cellConfigProperty","setCellConfig","normalizeConfig","portion","MenuBar","_tabFocusIndex","_menus","_overflowMenu","_menuItemSizes","_overflowIndex","_forceItemsPosition","forceItemsPosition","_overflowMenuOptions","overflowMenuOptions","overflowIndex","overflowMenu","activeMenu","menus","openActiveMenu","addMenu","insertMenu","_onMenuAboutToClose","_onMenuMenuRequested","removeMenu","removeMenuAt","clearMenus","_evtFocusOut","_focusItemAt","tabFocusIndex","totalMenuSize","tabbable","disabled","overflowMenuTitle","overflowMenuItems","screenSize","_updateOverflowIndex","itemMenus","stopImmediatePropagation","_positionForMenu","relatedTarget","newMenu","oldMenu","decrement","increment","track","thumb","findPart","scrollBar","thumbNode","trackNode","decrementNode","incrementNode","SingletonLayout","_widget","StackedLayout","StackedPanel","_widgetRemoved","widgetRemoved","orientationFromPlacement","plc","placementToOrientationMap","directionFromPlacement","placementToDirectionMap","_groupByTarget","_idTick","_sortBySelector","others","DisposableDelegate","_counter","_activeWidget","_currentWidget","_numbers","_nodes","_activeChanged","activeChanged","currentWidget","activeWidget","focusNumber","_onWidgetDisposed","_setWidgets","valid","previous","first","second","_evtFocus","_evtBlur","oldCurrent","oldActive","newValue","focusTarget","_onRepeat","_repeatTimer","mouseX","mouseY","thumbRect","_pageRequested","_stepRequested","_value","_page","_maximum","_thumbMoved","maximum","page","thumbMoved","stepRequested","pageRequested","thumbStyle","_moveThumb","trackPos","trackSpan","trackRect","stackedPanel","_onWidgetRemoved","_tabPlacement","tabPlacement","previousWidget"],"sources":["../src/boxengine.ts","../src/widget.ts","../src/layout.ts","../src/utils.ts","../src/title.ts","../src/panellayout.ts","../src/splitlayout.ts","../src/accordionlayout.ts","../src/panel.ts","../src/splitpanel.ts","../src/accordionpanel.ts","../src/boxlayout.ts","../src/boxpanel.ts","../src/commandpalette.ts","../src/menu.ts","../src/contextmenu.ts","../src/tabbar.ts","../src/docklayout.ts","../src/dockpanel.ts","../src/gridlayout.ts","../src/menubar.ts","../src/scrollbar.ts","../src/stackedpanel.ts","../src/tabpanel.ts","../src/singletonlayout.ts","../src/stackedlayout.ts","../src/focustracker.ts"],"sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nexport class BoxSizer {\n /**\n * The preferred size for the sizer.\n *\n * #### Notes\n * The sizer will be given this initial size subject to its size\n * bounds. The sizer will not deviate from this size unless such\n * deviation is required to fit into the available layout space.\n *\n * There is no limit to this value, but it will be clamped to the\n * bounds defined by {@link minSize} and {@link maxSize}.\n *\n * The default value is `0`.\n */\n sizeHint = 0;\n\n /**\n * The minimum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized less than this value, even if\n * it means the sizer will overflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity)`\n * and that it is `<=` to {@link maxSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `0`.\n */\n minSize = 0;\n\n /**\n * The maximum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized greater than this value, even if\n * it means the sizer will underflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity]`\n * and that it is `>=` to {@link minSize}. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `Infinity`.\n */\n maxSize = Infinity;\n\n /**\n * The stretch factor for the sizer.\n *\n * #### Notes\n * This controls how much the sizer stretches relative to its sibling\n * sizers when layout space is distributed. A stretch factor of zero\n * is special and will cause the sizer to only be resized after all\n * other sizers with a stretch factor greater than zero have been\n * resized to their limits.\n *\n * It is assumed that this value is an integer that lies in the range\n * `[0, Infinity)`. Failure to adhere to this constraint will yield\n * undefined results.\n *\n * The default value is `1`.\n */\n stretch = 1;\n\n /**\n * The computed size of the sizer.\n *\n * #### Notes\n * This value is the output of a call to {@link BoxEngine.calc}. It represents\n * the computed size for the object along the layout orientation,\n * and will always lie in the range `[minSize, maxSize]`.\n *\n * This value is output only.\n *\n * Changing this value will have no effect.\n */\n size = 0;\n\n /**\n * An internal storage property for the layout algorithm.\n *\n * #### Notes\n * This value is used as temporary storage by the layout algorithm.\n *\n * Changing this value will have no effect.\n */\n done = false;\n}\n\n/**\n * The namespace for the box engine layout functions.\n */\nexport namespace BoxEngine {\n /**\n * Calculate the optimal layout sizes for a sequence of box sizers.\n *\n * This distributes the available layout space among the box sizers\n * according to the following algorithm:\n *\n * 1. Initialize the sizers's size to its size hint and compute the\n * sums for each of size hint, min size, and max size.\n *\n * 2. If the total size hint equals the available space, return.\n *\n * 3. If the available space is less than the total min size, set all\n * sizers to their min size and return.\n *\n * 4. If the available space is greater than the total max size, set\n * all sizers to their max size and return.\n *\n * 5. If the layout space is less than the total size hint, distribute\n * the negative delta as follows:\n *\n * a. Shrink each sizer with a stretch factor greater than zero by\n * an amount proportional to the negative space and the sum of\n * stretch factors. If the sizer reaches its min size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains negative\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its min size,\n * remove it from the computation.\n *\n * 6. If the layout space is greater than the total size hint,\n * distribute the positive delta as follows:\n *\n * a. Expand each sizer with a stretch factor greater than zero by\n * an amount proportional to the postive space and the sum of\n * stretch factors. If the sizer reaches its max size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains positive\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its max size,\n * remove it from the computation.\n *\n * 7. return\n *\n * @param sizers - The sizers for a particular layout line.\n *\n * @param space - The available layout space for the sizers.\n *\n * @returns The delta between the provided available space and the\n * actual consumed space. This value will be zero if the sizers\n * can be adjusted to fit, negative if the available space is too\n * small, and positive if the available space is too large.\n *\n * #### Notes\n * The {@link BoxSizer.size} of each sizer is updated with the computed size.\n *\n * This function can be called at any time to recompute the layout for\n * an existing sequence of sizers. The previously computed results will\n * have no effect on the new output. It is therefore not necessary to\n * create new sizer objects on each resize event.\n */\n export function calc(sizers: ArrayLike, space: number): number {\n // Bail early if there is nothing to do.\n let count = sizers.length;\n if (count === 0) {\n return space;\n }\n\n // Setup the size and stretch counters.\n let totalMin = 0;\n let totalMax = 0;\n let totalSize = 0;\n let totalStretch = 0;\n let stretchCount = 0;\n\n // Setup the sizers and compute the totals.\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n let min = sizer.minSize;\n let max = sizer.maxSize;\n let hint = sizer.sizeHint;\n sizer.done = false;\n sizer.size = Math.max(min, Math.min(hint, max));\n totalSize += sizer.size;\n totalMin += min;\n totalMax += max;\n if (sizer.stretch > 0) {\n totalStretch += sizer.stretch;\n stretchCount++;\n }\n }\n\n // If the space is equal to the total size, return early.\n if (space === totalSize) {\n return 0;\n }\n\n // If the space is less than the total min, minimize each sizer.\n if (space <= totalMin) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.minSize;\n }\n return space - totalMin;\n }\n\n // If the space is greater than the total max, maximize each sizer.\n if (space >= totalMax) {\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n sizer.size = sizer.maxSize;\n }\n return space - totalMax;\n }\n\n // The loops below perform sub-pixel precision sizing. A near zero\n // value is used for compares instead of zero to ensure that the\n // loop terminates when the subdivided space is reasonably small.\n let nearZero = 0.01;\n\n // A counter which is decremented each time a sizer is resized to\n // its limit. This ensures the loops terminate even if there is\n // space remaining to distribute.\n let notDoneCount = count;\n\n // Distribute negative delta space.\n if (space < totalSize) {\n // Shrink each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its min size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = totalSize - space;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n }\n // Distribute positive delta space.\n else {\n // Expand each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its max size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n let freeSpace = space - totalSize;\n while (stretchCount > 0 && freeSpace > nearZero) {\n let distSpace = freeSpace;\n let distStretch = totalStretch;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n let amt = (sizer.stretch * distSpace) / distStretch;\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n let amt = freeSpace / notDoneCount;\n for (let i = 0; i < count; ++i) {\n let sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n } else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n }\n\n // Indicate that the consumed space equals the available space.\n return 0;\n }\n\n /**\n * Adjust a sizer by a delta and update its neighbors accordingly.\n *\n * @param sizers - The sizers which should be adjusted.\n *\n * @param index - The index of the sizer to grow.\n *\n * @param delta - The amount to adjust the sizer, positive or negative.\n *\n * #### Notes\n * This will adjust the indicated sizer by the specified amount, along\n * with the sizes of the appropriate neighbors, subject to the limits\n * specified by each of the sizers.\n *\n * This is useful when implementing box layouts where the boundaries\n * between the sizers are interactively adjustable by the user.\n */\n export function adjust(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Bail early when there is nothing to do.\n if (sizers.length === 0 || delta === 0) {\n return;\n }\n\n // Dispatch to the proper implementation.\n if (delta > 0) {\n growSizer(sizers, index, delta);\n } else {\n shrinkSizer(sizers, index, -delta);\n }\n }\n\n /**\n * Grow a sizer by a positive delta and adjust neighbors.\n */\n function growSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the left can expand.\n let growLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the right can shrink.\n let shrinkLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the left by the delta.\n let grow = delta;\n for (let i = index; i >= 0 && grow > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the right by the delta.\n let shrink = delta;\n for (let i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n\n /**\n * Shrink a sizer by a positive delta and adjust neighbors.\n */\n function shrinkSizer(\n sizers: ArrayLike,\n index: number,\n delta: number\n ): void {\n // Compute how much the items to the right can expand.\n let growLimit = 0;\n for (let i = index + 1, n = sizers.length; i < n; ++i) {\n let sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n\n // Compute how much the items to the left can shrink.\n let shrinkLimit = 0;\n for (let i = 0; i <= index; ++i) {\n let sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n\n // Grow the sizers to the right by the delta.\n let grow = delta;\n for (let i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n let sizer = sizers[i];\n let limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n } else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n\n // Shrink the sizers to the left by the delta.\n let shrink = delta;\n for (let i = index; i >= 0 && shrink > 0; --i) {\n let sizer = sizers[i];\n let limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n } else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IObservableDisposable } from '@lumino/disposable';\n\nimport {\n ConflatableMessage,\n IMessageHandler,\n Message,\n MessageLoop\n} from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Layout } from './layout';\n\nimport { Title } from './title';\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nexport class Widget implements IMessageHandler, IObservableDisposable {\n /**\n * Construct a new widget.\n *\n * @param options - The options for initializing the widget.\n */\n constructor(options: Widget.IOptions = {}) {\n this.node = Private.createNode(options);\n this.addClass('lm-Widget');\n }\n\n /**\n * Dispose of the widget and its descendant widgets.\n *\n * #### Notes\n * It is unsafe to use the widget after it has been disposed.\n *\n * All calls made to this method after the first are a no-op.\n */\n dispose(): void {\n // Do nothing if the widget is already disposed.\n if (this.isDisposed) {\n return;\n }\n\n // Set the disposed flag and emit the disposed signal.\n this.setFlag(Widget.Flag.IsDisposed);\n this._disposed.emit(undefined);\n\n // Remove or detach the widget if necessary.\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n\n // Dispose of the widget layout.\n if (this._layout) {\n this._layout.dispose();\n this._layout = null;\n }\n\n // Dispose the title\n this.title.dispose();\n\n // Clear the extra data associated with the widget.\n Signal.clearData(this);\n MessageLoop.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * A signal emitted when the widget is disposed.\n */\n get disposed(): ISignal {\n return this._disposed;\n }\n\n /**\n * Get the DOM node owned by the widget.\n */\n readonly node: HTMLElement;\n\n /**\n * Test whether the widget has been disposed.\n */\n get isDisposed(): boolean {\n return this.testFlag(Widget.Flag.IsDisposed);\n }\n\n /**\n * Test whether the widget's node is attached to the DOM.\n */\n get isAttached(): boolean {\n return this.testFlag(Widget.Flag.IsAttached);\n }\n\n /**\n * Test whether the widget is explicitly hidden.\n */\n get isHidden(): boolean {\n return this.testFlag(Widget.Flag.IsHidden);\n }\n\n /**\n * Test whether the widget is visible.\n *\n * #### Notes\n * A widget is visible when it is attached to the DOM, is not\n * explicitly hidden, and has no explicitly hidden ancestors.\n */\n get isVisible(): boolean {\n return this.testFlag(Widget.Flag.IsVisible);\n }\n\n /**\n * The title object for the widget.\n *\n * #### Notes\n * The title object is used by some container widgets when displaying\n * the widget alongside some title, such as a tab panel or side bar.\n *\n * Since not all widgets will use the title, it is created on demand.\n *\n * The `owner` property of the title is set to this widget.\n */\n get title(): Title {\n return Private.titleProperty.get(this);\n }\n\n /**\n * Get the id of the widget's DOM node.\n */\n get id(): string {\n return this.node.id;\n }\n\n /**\n * Set the id of the widget's DOM node.\n */\n set id(value: string) {\n this.node.id = value;\n }\n\n /**\n * The dataset for the widget's DOM node.\n */\n get dataset(): DOMStringMap {\n return this.node.dataset;\n }\n\n /**\n * Get the method for hiding the widget.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding the widget.\n */\n set hiddenMode(value: Widget.HiddenMode) {\n if (this._hiddenMode === value) {\n return;\n }\n\n if (this.isHidden) {\n // Reset styles set by previous mode.\n this._toggleHidden(false);\n }\n\n if (value == Widget.HiddenMode.Scale) {\n this.node.style.willChange = 'transform';\n } else {\n this.node.style.willChange = 'auto';\n }\n\n this._hiddenMode = value;\n\n if (this.isHidden) {\n // Set styles for new mode.\n this._toggleHidden(true);\n }\n }\n\n /**\n * Get the parent of the widget.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent of the widget.\n *\n * #### Notes\n * Children are typically added to a widget by using a layout, which\n * means user code will not normally set the parent widget directly.\n *\n * The widget will be automatically removed from its old parent.\n *\n * This is a no-op if there is no effective parent change.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (value && this.contains(value)) {\n throw new Error('Invalid parent widget.');\n }\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-removed', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n this._parent = value;\n if (this._parent && !this._parent.isDisposed) {\n let msg = new Widget.ChildMessage('child-added', this);\n MessageLoop.sendMessage(this._parent, msg);\n }\n if (!this.isDisposed) {\n MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n }\n }\n\n /**\n * Get the layout for the widget.\n */\n get layout(): Layout | null {\n return this._layout;\n }\n\n /**\n * Set the layout for the widget.\n *\n * #### Notes\n * The layout is single-use only. It cannot be changed after the\n * first assignment.\n *\n * The layout is disposed automatically when the widget is disposed.\n */\n set layout(value: Layout | null) {\n if (this._layout === value) {\n return;\n }\n if (this.testFlag(Widget.Flag.DisallowLayout)) {\n throw new Error('Cannot set widget layout.');\n }\n if (this._layout) {\n throw new Error('Cannot change widget layout.');\n }\n if (value!.parent) {\n throw new Error('Cannot change layout parent.');\n }\n this._layout = value;\n value!.parent = this;\n }\n\n /**\n * Create an iterator over the widget's children.\n *\n * @returns A new iterator over the children of the widget.\n *\n * #### Notes\n * The widget must have a populated layout in order to have children.\n *\n * If a layout is not installed, the returned iterator will be empty.\n */\n *children(): IterableIterator {\n if (this._layout) {\n yield* this._layout;\n }\n }\n\n /**\n * Test whether a widget is a descendant of this widget.\n *\n * @param widget - The descendant widget of interest.\n *\n * @returns `true` if the widget is a descendant, `false` otherwise.\n */\n contains(widget: Widget): boolean {\n for (let value: Widget | null = widget; value; value = value._parent) {\n if (value === this) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Test whether the widget's DOM node has the given class name.\n *\n * @param name - The class name of interest.\n *\n * @returns `true` if the node has the class, `false` otherwise.\n */\n hasClass(name: string): boolean {\n return this.node.classList.contains(name);\n }\n\n /**\n * Add a class name to the widget's DOM node.\n *\n * @param name - The class name to add to the node.\n *\n * #### Notes\n * If the class name is already added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n addClass(name: string): void {\n this.node.classList.add(name);\n }\n\n /**\n * Remove a class name from the widget's DOM node.\n *\n * @param name - The class name to remove from the node.\n *\n * #### Notes\n * If the class name is not yet added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n removeClass(name: string): void {\n this.node.classList.remove(name);\n }\n\n /**\n * Toggle a class name on the widget's DOM node.\n *\n * @param name - The class name to toggle on the node.\n *\n * @param force - Whether to force add the class (`true`) or force\n * remove the class (`false`). If not provided, the presence of\n * the class will be toggled from its current state.\n *\n * @returns `true` if the class is now present, `false` otherwise.\n *\n * #### Notes\n * The class name must not contain whitespace.\n */\n toggleClass(name: string, force?: boolean): boolean {\n if (force === true) {\n this.node.classList.add(name);\n return true;\n }\n if (force === false) {\n this.node.classList.remove(name);\n return false;\n }\n return this.node.classList.toggle(name);\n }\n\n /**\n * Post an `'update-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n update(): void {\n MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n }\n\n /**\n * Post a `'fit-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n fit(): void {\n MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n }\n\n /**\n * Post an `'activate-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n activate(): void {\n MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n }\n\n /**\n * Send a `'close-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for sending the message.\n */\n close(): void {\n MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n }\n\n /**\n * Show the widget and make it visible to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `false`.\n *\n * If the widget is not explicitly hidden, this is a no-op.\n */\n show(): void {\n if (!this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n }\n this.clearFlag(Widget.Flag.IsHidden);\n this._toggleHidden(false);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-shown', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Hide the widget and make it hidden to its parent widget.\n *\n * #### Notes\n * This causes the {@link isHidden} property to be `true`.\n *\n * If the widget is explicitly hidden, this is a no-op.\n */\n hide(): void {\n if (this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n }\n this.setFlag(Widget.Flag.IsHidden);\n this._toggleHidden(true);\n\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n }\n if (this.parent) {\n let msg = new Widget.ChildMessage('child-hidden', this);\n MessageLoop.sendMessage(this.parent, msg);\n }\n }\n\n /**\n * Show or hide the widget according to a boolean value.\n *\n * @param hidden - `true` to hide the widget, or `false` to show it.\n *\n * #### Notes\n * This is a convenience method for `hide()` and `show()`.\n */\n setHidden(hidden: boolean): void {\n if (hidden) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Test whether the given widget flag is set.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n testFlag(flag: Widget.Flag): boolean {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * Set the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n setFlag(flag: Widget.Flag): void {\n this._flags |= flag;\n }\n\n /**\n * Clear the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n clearFlag(flag: Widget.Flag): void {\n this._flags &= ~flag;\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n *\n * #### Notes\n * Subclasses may reimplement this method as needed.\n */\n processMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.notifyLayout(msg);\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.notifyLayout(msg);\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.notifyLayout(msg);\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.notifyLayout(msg);\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.setFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.notifyLayout(msg);\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.clearFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.notifyLayout(msg);\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n this.setFlag(Widget.Flag.IsVisible);\n }\n this.setFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.notifyLayout(msg);\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.clearFlag(Widget.Flag.IsVisible);\n this.clearFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterDetach(msg);\n break;\n case 'activate-request':\n this.notifyLayout(msg);\n this.onActivateRequest(msg);\n break;\n case 'close-request':\n this.notifyLayout(msg);\n this.onCloseRequest(msg);\n break;\n case 'child-added':\n this.notifyLayout(msg);\n this.onChildAdded(msg as Widget.ChildMessage);\n break;\n case 'child-removed':\n this.notifyLayout(msg);\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n default:\n this.notifyLayout(msg);\n break;\n }\n }\n\n /**\n * Invoke the message processing routine of the widget's layout.\n *\n * @param msg - The message to dispatch to the layout.\n *\n * #### Notes\n * This is a no-op if the widget does not have a layout.\n *\n * This will not typically be called directly by user code.\n */\n protected notifyLayout(msg: Message): void {\n if (this._layout) {\n this._layout.processParentMessage(msg);\n }\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n *\n * #### Notes\n * The default implementation unparents or detaches the widget.\n */\n protected onCloseRequest(msg: Message): void {\n if (this.parent) {\n this.parent = null;\n } else if (this.isAttached) {\n Widget.detach(this);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onResize(msg: Widget.ResizeMessage): void {}\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onUpdateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onActivateRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeShow(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterShow(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeHide(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterHide(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterAttach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onBeforeDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onAfterDetach(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-added'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {}\n\n private _toggleHidden(hidden: boolean) {\n if (hidden) {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.addClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = 'scale(0)';\n this.node.setAttribute('aria-hidden', 'true');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = 'hidden';\n this.node.style.zIndex = '-1';\n break;\n }\n } else {\n switch (this._hiddenMode) {\n case Widget.HiddenMode.Display:\n this.removeClass('lm-mod-hidden');\n break;\n case Widget.HiddenMode.Scale:\n this.node.style.transform = '';\n this.node.removeAttribute('aria-hidden');\n break;\n case Widget.HiddenMode.ContentVisibility:\n // @ts-expect-error content-visibility unknown by DOM lib types\n this.node.style.contentVisibility = '';\n this.node.style.zIndex = '';\n break;\n }\n }\n }\n\n private _flags = 0;\n private _layout: Layout | null = null;\n private _parent: Widget | null = null;\n private _disposed = new Signal(this);\n private _hiddenMode: Widget.HiddenMode = Widget.HiddenMode.Display;\n}\n\n/**\n * The namespace for the `Widget` class statics.\n */\nexport namespace Widget {\n /**\n * An options object for initializing a widget.\n */\n export interface IOptions {\n /**\n * The optional node to use for the widget.\n *\n * If a node is provided, the widget will assume full ownership\n * and control of the node, as if it had created the node itself.\n *\n * The default is a new `
`.\n */\n node?: HTMLElement;\n\n /**\n * The optional element tag, used for constructing the widget's node.\n *\n * If a pre-constructed node is provided via the `node` arg, this\n * value is ignored.\n */\n tag?: keyof HTMLElementTagNameMap;\n }\n\n /**\n * The method for hiding the widget.\n *\n * The default is Display.\n *\n * Using `Scale` will often increase performance as most browsers will not\n * trigger style computation for the `transform` action. This should be used\n * sparingly and tested, since increasing the number of composition layers\n * may slow things down.\n *\n * To ensure the transformation does not trigger style recomputation, you\n * may need to set the widget CSS style `will-change: transform`. This\n * should be used only when needed as it may overwhelm the browser with a\n * high number of layers. See\n * https://developer.mozilla.org/en-US/docs/Web/CSS/will-change\n */\n export enum HiddenMode {\n /**\n * Set a `lm-mod-hidden` CSS class to hide the widget using `display:none`\n * CSS from the standard Lumino CSS.\n */\n Display = 0,\n\n /**\n * Hide the widget by setting the `transform` to `'scale(0)'`.\n */\n Scale,\n\n /**\n *Hide the widget by setting the `content-visibility` to `'hidden'`.\n */\n ContentVisibility\n }\n\n /**\n * An enum of widget bit flags.\n */\n export enum Flag {\n /**\n * The widget has been disposed.\n */\n IsDisposed = 0x1,\n\n /**\n * The widget is attached to the DOM.\n */\n IsAttached = 0x2,\n\n /**\n * The widget is hidden.\n */\n IsHidden = 0x4,\n\n /**\n * The widget is visible.\n */\n IsVisible = 0x8,\n\n /**\n * A layout cannot be set on the widget.\n */\n DisallowLayout = 0x10\n }\n\n /**\n * A collection of stateless messages related to widgets.\n */\n export namespace Msg {\n /**\n * A singleton `'before-show'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const BeforeShow = new Message('before-show');\n\n /**\n * A singleton `'after-show'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n export const AfterShow = new Message('after-show');\n\n /**\n * A singleton `'before-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const BeforeHide = new Message('before-hide');\n\n /**\n * A singleton `'after-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n export const AfterHide = new Message('after-hide');\n\n /**\n * A singleton `'before-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is attached.\n */\n export const BeforeAttach = new Message('before-attach');\n\n /**\n * A singleton `'after-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is attached.\n */\n export const AfterAttach = new Message('after-attach');\n\n /**\n * A singleton `'before-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is detached.\n */\n export const BeforeDetach = new Message('before-detach');\n\n /**\n * A singleton `'after-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is detached.\n */\n export const AfterDetach = new Message('after-detach');\n\n /**\n * A singleton `'parent-changed'` message.\n *\n * #### Notes\n * This message is sent to a widget when its parent has changed.\n */\n export const ParentChanged = new Message('parent-changed');\n\n /**\n * A singleton conflatable `'update-request'` message.\n *\n * #### Notes\n * This message can be dispatched to supporting widgets in order to\n * update their content based on the current widget state. Not all\n * widgets will respond to messages of this type.\n *\n * For widgets with a layout, this message will inform the layout to\n * update the position and size of its child widgets.\n */\n export const UpdateRequest = new ConflatableMessage('update-request');\n\n /**\n * A singleton conflatable `'fit-request'` message.\n *\n * #### Notes\n * For widgets with a layout, this message will inform the layout to\n * recalculate its size constraints to fit the space requirements of\n * its child widgets, and to update their position and size. Not all\n * layouts will respond to messages of this type.\n */\n export const FitRequest = new ConflatableMessage('fit-request');\n\n /**\n * A singleton conflatable `'activate-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should\n * perform the actions necessary to activate the widget, which\n * may include focusing its node or descendant node.\n */\n export const ActivateRequest = new ConflatableMessage('activate-request');\n\n /**\n * A singleton conflatable `'close-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should close\n * and remove itself from the widget hierarchy.\n */\n export const CloseRequest = new ConflatableMessage('close-request');\n }\n\n /**\n * A message class for child related messages.\n */\n export class ChildMessage extends Message {\n /**\n * Construct a new child message.\n *\n * @param type - The message type.\n *\n * @param child - The child widget for the message.\n */\n constructor(type: string, child: Widget) {\n super(type);\n this.child = child;\n }\n\n /**\n * The child widget for the message.\n */\n readonly child: Widget;\n }\n\n /**\n * A message class for `'resize'` messages.\n */\n export class ResizeMessage extends Message {\n /**\n * Construct a new resize message.\n *\n * @param width - The **offset width** of the widget, or `-1` if\n * the width is not known.\n *\n * @param height - The **offset height** of the widget, or `-1` if\n * the height is not known.\n */\n constructor(width: number, height: number) {\n super('resize');\n this.width = width;\n this.height = height;\n }\n\n /**\n * The offset width of the widget.\n *\n * #### Notes\n * This will be `-1` if the width is unknown.\n */\n readonly width: number;\n\n /**\n * The offset height of the widget.\n *\n * #### Notes\n * This will be `-1` if the height is unknown.\n */\n readonly height: number;\n }\n\n /**\n * The namespace for the `ResizeMessage` class statics.\n */\n export namespace ResizeMessage {\n /**\n * A singleton `'resize'` message with an unknown size.\n */\n export const UnknownSize = new ResizeMessage(-1, -1);\n }\n\n /**\n * Attach a widget to a host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * @param host - The DOM node to use as the widget's host.\n *\n * @param ref - The child of `host` to use as the reference element.\n * If this is provided, the widget will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * widget to be added as the last child of the host.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget, if\n * the widget is already attached, or if the host is not attached\n * to the DOM.\n */\n export function attach(\n widget: Widget,\n host: HTMLElement,\n ref: HTMLElement | null = null\n ): void {\n if (widget.parent) {\n throw new Error('Cannot attach a child widget.');\n }\n if (widget.isAttached || widget.node.isConnected) {\n throw new Error('Widget is already attached.');\n }\n if (!host.isConnected) {\n throw new Error('Host is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n host.insertBefore(widget.node, ref);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n /**\n * Detach the widget from its host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget,\n * or if the widget is not attached to the DOM.\n */\n export function detach(widget: Widget): void {\n if (widget.parent) {\n throw new Error('Cannot detach a child widget.');\n }\n if (!widget.isAttached || !widget.node.isConnected) {\n throw new Error('Widget is not attached.');\n }\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n widget.node.parentNode!.removeChild(widget.node);\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An attached property for the widget title object.\n */\n export const titleProperty = new AttachedProperty>({\n name: 'title',\n create: owner => new Title({ owner })\n });\n\n /**\n * Create a DOM node for the given widget options.\n */\n export function createNode(options: Widget.IOptions): HTMLElement {\n return options.node || document.createElement(options.tag || 'div');\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nexport abstract class Layout implements Iterable, IDisposable {\n /**\n * Construct a new layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: Layout.IOptions = {}) {\n this._fitPolicy = options.fitPolicy || 'set-min-size';\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This should be reimplemented to clear and dispose of the widgets.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n this._parent = null;\n this._disposed = true;\n Signal.clearData(this);\n AttachedProperty.clearData(this);\n }\n\n /**\n * Test whether the layout is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Get the parent widget of the layout.\n */\n get parent(): Widget | null {\n return this._parent;\n }\n\n /**\n * Set the parent widget of the layout.\n *\n * #### Notes\n * This is set automatically when installing the layout on the parent\n * widget. The parent widget should not be set directly by user code.\n */\n set parent(value: Widget | null) {\n if (this._parent === value) {\n return;\n }\n if (this._parent) {\n throw new Error('Cannot change parent widget.');\n }\n if (value!.layout !== this) {\n throw new Error('Invalid parent widget.');\n }\n this._parent = value;\n this.init();\n }\n\n /**\n * Get the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n get fitPolicy(): Layout.FitPolicy {\n return this._fitPolicy;\n }\n\n /**\n * Set the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n *\n * Changing the fit policy will clear the current size constraint\n * for the parent widget and then re-fit the parent.\n */\n set fitPolicy(value: Layout.FitPolicy) {\n // Bail if the policy does not change\n if (this._fitPolicy === value) {\n return;\n }\n\n // Update the internal policy.\n this._fitPolicy = value;\n\n // Clear the size constraints and schedule a fit of the parent.\n if (this._parent) {\n let style = this._parent.node.style;\n style.minWidth = '';\n style.minHeight = '';\n style.maxWidth = '';\n style.maxHeight = '';\n this._parent.fit();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This abstract method must be implemented by a subclass.\n */\n abstract [Symbol.iterator](): IterableIterator;\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method should *not* modify the widget's `parent`.\n */\n abstract removeWidget(widget: Widget): void;\n\n /**\n * Process a message sent to the parent widget.\n *\n * @param msg - The message sent to the parent widget.\n *\n * #### Notes\n * This method is called by the parent widget to process a message.\n *\n * Subclasses may reimplement this method as needed.\n */\n processParentMessage(msg: Message): void {\n switch (msg.type) {\n case 'resize':\n this.onResize(msg as Widget.ResizeMessage);\n break;\n case 'update-request':\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.onAfterDetach(msg);\n break;\n case 'child-removed':\n this.onChildRemoved(msg as Widget.ChildMessage);\n break;\n case 'child-shown':\n this.onChildShown(msg as Widget.ChildMessage);\n break;\n case 'child-hidden':\n this.onChildHidden(msg as Widget.ChildMessage);\n break;\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n *\n * #### Notes\n * This method is invoked immediately after the layout is installed\n * on the parent widget.\n *\n * The default implementation reparents all of the widgets to the\n * layout parent widget.\n *\n * Subclasses should reimplement this method and attach the child\n * widget nodes to the parent widget's node.\n */\n protected init(): void {\n for (const widget of this) {\n widget.parent = this.parent;\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the specified layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the available layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onUpdateRequest(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterAttach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterDetach(msg: Message): void {\n for (const widget of this) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterShow(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onBeforeHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n protected onAfterHide(msg: Message): void {\n for (const widget of this) {\n if (!widget.isHidden) {\n MessageLoop.sendMessage(widget, msg);\n }\n }\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * This will remove the child widget from the layout.\n *\n * Subclasses should **not** typically reimplement this method.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n this.removeWidget(msg.child);\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onFitRequest(msg: Message): void {}\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {}\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {}\n\n private _disposed = false;\n private _fitPolicy: Layout.FitPolicy;\n private _parent: Widget | null = null;\n}\n\n/**\n * The namespace for the `Layout` class statics.\n */\nexport namespace Layout {\n /**\n * A type alias for the layout fit policy.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n export type FitPolicy =\n | /**\n * No size constraint will be applied to the parent widget.\n */\n 'set-no-constraint'\n\n /**\n * The computed min size will be applied to the parent widget.\n */\n | 'set-min-size';\n\n /**\n * An options object for initializing a layout.\n */\n export interface IOptions {\n /**\n * The fit policy for the layout.\n *\n * The default is `'set-min-size'`.\n */\n fitPolicy?: FitPolicy;\n }\n\n /**\n * A type alias for the horizontal alignment of a widget.\n */\n export type HorizontalAlignment = 'left' | 'center' | 'right';\n\n /**\n * A type alias for the vertical alignment of a widget.\n */\n export type VerticalAlignment = 'top' | 'center' | 'bottom';\n\n /**\n * Get the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The horizontal alignment for the widget.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n */\n export function getHorizontalAlignment(widget: Widget): HorizontalAlignment {\n return Private.horizontalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the horizontal alignment.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setHorizontalAlignment(\n widget: Widget,\n value: HorizontalAlignment\n ): void {\n Private.horizontalAlignmentProperty.set(widget, value);\n }\n\n /**\n * Get the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The vertical alignment for the widget.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n */\n export function getVerticalAlignment(widget: Widget): VerticalAlignment {\n return Private.verticalAlignmentProperty.get(widget);\n }\n\n /**\n * Set the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the vertical alignment.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n export function setVerticalAlignment(\n widget: Widget,\n value: VerticalAlignment\n ): void {\n Private.verticalAlignmentProperty.set(widget, value);\n }\n}\n\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nexport class LayoutItem implements IDisposable {\n /**\n * Construct a new layout item.\n *\n * @param widget - The widget to be managed by the item.\n *\n * #### Notes\n * The widget will be set to absolute positioning.\n * The widget will use strict CSS containment.\n */\n constructor(widget: Widget) {\n this.widget = widget;\n this.widget.node.style.position = 'absolute';\n this.widget.node.style.contain = 'strict';\n }\n\n /**\n * Dispose of the the layout item.\n *\n * #### Notes\n * This will reset the positioning of the widget.\n */\n dispose(): void {\n // Do nothing if the item is already disposed.\n if (this._disposed) {\n return;\n }\n\n // Mark the item as disposed.\n this._disposed = true;\n\n // Reset the widget style.\n let style = this.widget.node.style;\n style.position = '';\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n style.contain = '';\n }\n\n /**\n * The widget managed by the layout item.\n */\n readonly widget: Widget;\n\n /**\n * The computed minimum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minWidth(): number {\n return this._minWidth;\n }\n\n /**\n * The computed minimum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get minHeight(): number {\n return this._minHeight;\n }\n\n /**\n * The computed maximum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxWidth(): number {\n return this._maxWidth;\n }\n\n /**\n * The computed maximum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get maxHeight(): number {\n return this._maxHeight;\n }\n\n /**\n * Whether the layout item is disposed.\n */\n get isDisposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Whether the managed widget is hidden.\n */\n get isHidden(): boolean {\n return this.widget.isHidden;\n }\n\n /**\n * Whether the managed widget is visible.\n */\n get isVisible(): boolean {\n return this.widget.isVisible;\n }\n\n /**\n * Whether the managed widget is attached.\n */\n get isAttached(): boolean {\n return this.widget.isAttached;\n }\n\n /**\n * Update the computed size limits of the managed widget.\n */\n fit(): void {\n let limits = ElementExt.sizeLimits(this.widget.node);\n this._minWidth = limits.minWidth;\n this._minHeight = limits.minHeight;\n this._maxWidth = limits.maxWidth;\n this._maxHeight = limits.maxHeight;\n }\n\n /**\n * Update the position and size of the managed widget.\n *\n * @param left - The left edge position of the layout box.\n *\n * @param top - The top edge position of the layout box.\n *\n * @param width - The width of the layout box.\n *\n * @param height - The height of the layout box.\n */\n update(left: number, top: number, width: number, height: number): void {\n // Clamp the size to the computed size limits.\n let clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n let clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n\n // Adjust the left edge for the horizontal alignment, if needed.\n if (clampW < width) {\n switch (Layout.getHorizontalAlignment(this.widget)) {\n case 'left':\n break;\n case 'center':\n left += (width - clampW) / 2;\n break;\n case 'right':\n left += width - clampW;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Adjust the top edge for the vertical alignment, if needed.\n if (clampH < height) {\n switch (Layout.getVerticalAlignment(this.widget)) {\n case 'top':\n break;\n case 'center':\n top += (height - clampH) / 2;\n break;\n case 'bottom':\n top += height - clampH;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Set up the resize variables.\n let resized = false;\n let style = this.widget.node.style;\n\n // Update the top edge of the widget if needed.\n if (this._top !== top) {\n this._top = top;\n style.top = `${top}px`;\n }\n\n // Update the left edge of the widget if needed.\n if (this._left !== left) {\n this._left = left;\n style.left = `${left}px`;\n }\n\n // Update the width of the widget if needed.\n if (this._width !== clampW) {\n resized = true;\n this._width = clampW;\n style.width = `${clampW}px`;\n }\n\n // Update the height of the widget if needed.\n if (this._height !== clampH) {\n resized = true;\n this._height = clampH;\n style.height = `${clampH}px`;\n }\n\n // Send a resize message to the widget if needed.\n if (resized) {\n let msg = new Widget.ResizeMessage(clampW, clampH);\n MessageLoop.sendMessage(this.widget, msg);\n }\n }\n\n private _top = NaN;\n private _left = NaN;\n private _width = NaN;\n private _height = NaN;\n private _minWidth = 0;\n private _minHeight = 0;\n private _maxWidth = Infinity;\n private _maxHeight = Infinity;\n private _disposed = false;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The attached property for a widget horizontal alignment.\n */\n export const horizontalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.HorizontalAlignment\n >({\n name: 'horizontalAlignment',\n create: () => 'center',\n changed: onAlignmentChanged\n });\n\n /**\n * The attached property for a widget vertical alignment.\n */\n export const verticalAlignmentProperty = new AttachedProperty<\n Widget,\n Layout.VerticalAlignment\n >({\n name: 'verticalAlignment',\n create: () => 'top',\n changed: onAlignmentChanged\n });\n\n /**\n * The change handler for the attached alignment properties.\n */\n function onAlignmentChanged(child: Widget): void {\n if (child.parent && child.parent.layout) {\n child.parent.update();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nexport namespace Utils {\n /**\n * Clamp a dimension value to an integer >= 0.\n */\n export function clampDimension(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n}\n\nexport default Utils;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { VirtualElement } from '@lumino/virtualdom';\n\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n *\n * It is the responsibility of the owner to call the title disposal.\n */\nexport class Title implements IDisposable {\n /**\n * Construct a new title.\n *\n * @param options - The options for initializing the title.\n */\n constructor(options: Title.IOptions) {\n this.owner = options.owner;\n if (options.label !== undefined) {\n this._label = options.label;\n }\n if (options.mnemonic !== undefined) {\n this._mnemonic = options.mnemonic;\n }\n if (options.icon !== undefined) {\n this._icon = options.icon;\n }\n\n if (options.iconClass !== undefined) {\n this._iconClass = options.iconClass;\n }\n if (options.iconLabel !== undefined) {\n this._iconLabel = options.iconLabel;\n }\n if (options.caption !== undefined) {\n this._caption = options.caption;\n }\n if (options.className !== undefined) {\n this._className = options.className;\n }\n if (options.closable !== undefined) {\n this._closable = options.closable;\n }\n this._dataset = options.dataset || {};\n }\n\n /**\n * A signal emitted when the state of the title changes.\n */\n get changed(): ISignal {\n return this._changed;\n }\n\n /**\n * The object which owns the title.\n */\n readonly owner: T;\n\n /**\n * Get the label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get label(): string {\n return this._label;\n }\n\n /**\n * Set the label for the title.\n */\n set label(value: string) {\n if (this._label === value) {\n return;\n }\n this._label = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the mnemonic index for the title.\n *\n * #### Notes\n * The default value is `-1`.\n */\n get mnemonic(): number {\n return this._mnemonic;\n }\n\n /**\n * Set the mnemonic index for the title.\n */\n set mnemonic(value: number) {\n if (this._mnemonic === value) {\n return;\n }\n this._mnemonic = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon renderer for the title.\n *\n * #### Notes\n * The default value is undefined.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._icon;\n }\n\n /**\n * Set the icon renderer for the title.\n *\n * #### Notes\n * A renderer is an object that supplies a render and unrender function.\n */\n set icon(value: VirtualElement.IRenderer | undefined) {\n if (this._icon === value) {\n return;\n }\n this._icon = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconClass(): string {\n return this._iconClass;\n }\n\n /**\n * Set the icon class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconClass(value: string) {\n if (this._iconClass === value) {\n return;\n }\n this._iconClass = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the icon label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get iconLabel(): string {\n return this._iconLabel;\n }\n\n /**\n * Set the icon label for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set iconLabel(value: string) {\n if (this._iconLabel === value) {\n return;\n }\n this._iconLabel = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the caption for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get caption(): string {\n return this._caption;\n }\n\n /**\n * Set the caption for the title.\n */\n set caption(value: string) {\n if (this._caption === value) {\n return;\n }\n this._caption = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the extra class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get className(): string {\n return this._className;\n }\n\n /**\n * Set the extra class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set className(value: string) {\n if (this._className === value) {\n return;\n }\n this._className = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the closable state for the title.\n *\n * #### Notes\n * The default value is `false`.\n */\n get closable(): boolean {\n return this._closable;\n }\n\n /**\n * Set the closable state for the title.\n *\n * #### Notes\n * This controls the presence of a close icon when applicable.\n */\n set closable(value: boolean) {\n if (this._closable === value) {\n return;\n }\n this._closable = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Get the dataset for the title.\n *\n * #### Notes\n * The default value is an empty dataset.\n */\n get dataset(): Title.Dataset {\n return this._dataset;\n }\n\n /**\n * Set the dataset for the title.\n *\n * #### Notes\n * This controls the data attributes when applicable.\n */\n set dataset(value: Title.Dataset) {\n if (this._dataset === value) {\n return;\n }\n this._dataset = value;\n this._changed.emit(undefined);\n }\n\n /**\n * Test whether the title has been disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the title.\n *\n * #### Notes\n * It is the responsibility of the owner to call the title disposal.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n\n Signal.clearData(this);\n }\n\n private _label = '';\n private _caption = '';\n private _mnemonic = -1;\n private _icon: VirtualElement.IRenderer | undefined = undefined;\n private _iconClass = '';\n private _iconLabel = '';\n private _className = '';\n private _closable = false;\n private _dataset: Title.Dataset;\n private _changed = new Signal(this);\n private _isDisposed = false;\n}\n\n/**\n * The namespace for the `Title` class statics.\n */\nexport namespace Title {\n /**\n * A type alias for a simple immutable string dataset.\n */\n export type Dataset = { readonly [key: string]: string };\n\n /**\n * An options object for initializing a title.\n */\n export interface IOptions {\n /**\n * The object which owns the title.\n */\n owner: T;\n\n /**\n * The label for the title.\n */\n label?: string;\n\n /**\n * The mnemonic index for the title.\n */\n mnemonic?: number;\n\n /**\n * The icon renderer for the title.\n */\n icon?: VirtualElement.IRenderer;\n\n /**\n * The icon class name for the title.\n */\n iconClass?: string;\n\n /**\n * The icon label for the title.\n */\n iconLabel?: string;\n\n /**\n * The caption for the title.\n */\n caption?: string;\n\n /**\n * The extra class name for the title.\n */\n className?: string;\n\n /**\n * The closable state for the title.\n */\n closable?: boolean;\n\n /**\n * The dataset for the title.\n */\n dataset?: Dataset;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nexport class PanelLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n dispose(): void {\n while (this._widgets.length > 0) {\n this._widgets.pop()!.dispose();\n }\n super.dispose();\n }\n\n /**\n * A read-only array of the widgets in the layout.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n yield* this._widgets;\n }\n\n /**\n * Add a widget to the end of the layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, it will be moved.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this._widgets.length, widget);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n widget.parent = this.parent;\n\n // Look up the current index of the widget.\n let i = this._widgets.indexOf(widget);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._widgets.length));\n\n // If the widget is not in the array, insert it.\n if (i === -1) {\n // Insert the widget into the array.\n ArrayExt.insert(this._widgets, j, widget);\n\n // If the layout is parented, attach the widget to the DOM.\n if (this.parent) {\n this.attachWidget(j, widget);\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the widget exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._widgets.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the widget to the new location.\n ArrayExt.move(this._widgets, i, j);\n\n // If the layout is parented, move the widget in the DOM.\n if (this.parent) {\n this.moveWidget(i, j, widget);\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n this.removeWidgetAt(this._widgets.indexOf(widget));\n }\n\n /**\n * Remove the widget at a given index from the layout.\n *\n * @param index - The index of the widget to remove.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n removeWidgetAt(index: number): void {\n // Remove the widget from the array.\n let widget = ArrayExt.removeAt(this._widgets, index);\n\n // If the layout is parented, detach the widget from the DOM.\n if (widget && this.parent) {\n this.detachWidget(index, widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n let index = 0;\n for (const widget of this) {\n this.attachWidget(index++, widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[index];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation moves the widget's node to the proper\n * location in the parent's node and sends the appropriate attach and\n * detach messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is moved in the parent's node.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` and message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Look up the next sibling reference node.\n let ref = this.parent!.node.children[toIndex];\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Insert the widget's node before the sibling.\n this.parent!.node.insertBefore(widget.node, ref);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widgets: Widget[] = [];\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Utils } from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nexport class SplitLayout extends PanelLayout {\n /**\n * Construct a new split layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: SplitLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.orientation !== undefined) {\n this._orientation = options.orientation;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n this._handles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the split layout.\n */\n readonly renderer: SplitLayout.IRenderer;\n\n /**\n * Get the layout orientation for the split layout.\n */\n get orientation(): SplitLayout.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the layout orientation for the split layout.\n */\n set orientation(value: SplitLayout.Orientation) {\n if (this._orientation === value) {\n return;\n }\n this._orientation = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['orientation'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n get alignment(): SplitLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n set alignment(value: SplitLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the split layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the split layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the split handles in the layout.\n */\n get handles(): ReadonlyArray {\n return this._handles;\n }\n\n /**\n * Get the absolute sizes of the widgets in the layout.\n *\n * @returns A new array of the absolute sizes of the widgets.\n *\n * This method **does not** measure the DOM nodes.\n */\n absoluteSizes(): number[] {\n return this._sizers.map(sizer => sizer.size);\n }\n\n /**\n * Get the relative sizes of the widgets in the layout.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return Private.normalize(this._sizers.map(sizer => sizer.size));\n }\n\n /**\n * Set the relative sizes for the widgets in the layout.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n // Copy the sizes and pad with zeros as needed.\n let n = this._sizers.length;\n let temp = sizes.slice(0, n);\n while (temp.length < n) {\n temp.push(0);\n }\n\n // Normalize the padded sizes.\n let normed = Private.normalize(temp);\n\n // Apply the normalized sizes to the sizers.\n for (let i = 0; i < n; ++i) {\n let sizer = this._sizers[i];\n sizer.sizeHint = normed[i];\n sizer.size = normed[i];\n }\n\n // Set the flag indicating the sizes are normalized.\n this._hasNormedSizes = true;\n\n // Trigger an update of the parent widget.\n if (update && this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Move the offset position of a split handle.\n *\n * @param index - The index of the handle of the interest.\n *\n * @param position - The desired offset position of the handle.\n *\n * #### Notes\n * The position is relative to the offset parent.\n *\n * This will move the handle as close as possible to the desired\n * position. The sibling widgets will be adjusted as necessary.\n */\n moveHandle(index: number, position: number): void {\n // Bail if the index is invalid or the handle is hidden.\n let handle = this._handles[index];\n if (!handle || handle.classList.contains('lm-mod-hidden')) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (this._orientation === 'horizontal') {\n delta = position - handle.offsetLeft;\n } else {\n delta = position - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent widget resizing unless needed.\n for (let sizer of this._sizers) {\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(this._sizers, index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['orientation'] = this.orientation;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create the item, handle, and sizer for the new widget.\n let item = new LayoutItem(widget);\n let handle = Private.createHandle(this.renderer);\n let average = Private.averageSize(this._sizers);\n let sizer = Private.createSizer(average);\n\n // Insert the item, handle, and sizer into the internal arrays.\n ArrayExt.insert(this._items, index, item);\n ArrayExt.insert(this._sizers, index, sizer);\n ArrayExt.insert(this._handles, index, handle);\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget and handle nodes to the parent.\n this.parent!.node.appendChild(widget.node);\n this.parent!.node.appendChild(handle);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the item, sizer, and handle for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n ArrayExt.move(this._handles, fromIndex, toIndex);\n\n // Post a fit request to the parent to show/hide last handle.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the item, handle, and sizer for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n let handle = ArrayExt.removeAt(this._handles, index);\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget and handle nodes from the parent.\n this.parent!.node.removeChild(widget.node);\n this.parent!.node.removeChild(handle!);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const item = this._items[i];\n if (item.isHidden) {\n return;\n }\n\n // Fetch the style for the handle.\n let handleStyle = this._handles[i].style;\n\n // Update the widget and handle, and advance the relevant edge.\n if (isHorizontal) {\n left += this.widgetOffset;\n item.update(left, top, size, height);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${this._spacing}px`;\n handleStyle.height = `${height}px`;\n } else {\n top += this.widgetOffset;\n item.update(left, top, width, size);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${this._spacing}px`;\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Update the handles and track the visible widget count.\n let nVisible = 0;\n let lastHandleIndex = -1;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n if (this._items[i].isHidden) {\n this._handles[i].classList.add('lm-mod-hidden');\n } else {\n this._handles[i].classList.remove('lm-mod-hidden');\n lastHandleIndex = i;\n nVisible++;\n }\n }\n\n // Hide the handle for the last visible widget.\n if (lastHandleIndex !== -1) {\n this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n }\n\n // Update the fixed space for the visible items.\n this._fixed =\n this._spacing * Math.max(0, nVisible - 1) +\n this.widgetOffset * this._items.length;\n\n // Setup the computed minimum size.\n let horz = this._orientation === 'horizontal';\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed size limits.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // Prevent resizing unless necessary.\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the stretch factor.\n sizer.stretch = SplitLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0 && this.widgetOffset === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Set up the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n let horz = this._orientation === 'horizontal';\n\n if (nVisible > 0) {\n // Compute the adjusted layout space.\n let space: number;\n if (horz) {\n // left += this.widgetOffset;\n space = Math.max(0, width - this._fixed);\n } else {\n // top += this.widgetOffset;\n space = Math.max(0, height - this._fixed);\n }\n\n // Scale the size hints if they are normalized.\n if (this._hasNormedSizes) {\n for (let sizer of this._sizers) {\n sizer.sizeHint *= space;\n }\n this._hasNormedSizes = false;\n }\n\n // Distribute the layout space to the box sizers.\n let delta = BoxEngine.calc(this._sizers, space);\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n const item = this._items[i];\n\n // Fetch the computed size for the widget.\n const size = item.isHidden ? 0 : this._sizers[i].size + extra;\n\n this.updateItemPosition(\n i,\n horz,\n horz ? left + offset : left,\n horz ? top : top + offset,\n height,\n width,\n size\n );\n\n const fullOffset =\n this.widgetOffset +\n (this._handles[i].classList.contains('lm-mod-hidden')\n ? 0\n : this._spacing);\n\n if (horz) {\n left += size + fullOffset;\n } else {\n top += size + fullOffset;\n }\n }\n }\n\n protected widgetOffset = 0;\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _hasNormedSizes = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _handles: HTMLDivElement[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: SplitLayout.Alignment = 'start';\n private _orientation: SplitLayout.Orientation = 'horizontal';\n}\n\n/**\n * The namespace for the `SplitLayout` class statics.\n */\nexport namespace SplitLayout {\n /**\n * A type alias for a split layout orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a split layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a split layout.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split layout.\n */\n renderer: IRenderer;\n\n /**\n * The orientation of the layout.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a split layout.\n */\n export interface IRenderer {\n /**\n * Create a new handle for use with a split layout.\n *\n * @returns A new handle element.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * Get the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Create a new box sizer with the given size hint.\n */\n export function createSizer(size: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = Math.floor(size);\n return sizer;\n }\n\n /**\n * Create a new split handle node using the given renderer.\n */\n export function createHandle(\n renderer: SplitLayout.IRenderer\n ): HTMLDivElement {\n let handle = renderer.createHandle();\n handle.style.position = 'absolute';\n // Do not use size containment to allow the handle to fill the available space\n handle.style.contain = 'style';\n return handle;\n }\n\n /**\n * Compute the average size of an array of box sizers.\n */\n export function averageSize(sizers: BoxSizer[]): number {\n return sizers.reduce((v, s) => v + s.size, 0) / sizers.length || 0;\n }\n\n /**\n * Normalize an array of values.\n */\n export function normalize(values: number[]): number[] {\n let n = values.length;\n if (n === 0) {\n return [];\n }\n let sum = values.reduce((a, b) => a + Math.abs(b), 0);\n return sum === 0 ? values.map(v => 1 / n) : values.map(v => v / sum);\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof SplitLayout) {\n child.parent.fit();\n }\n }\n}\n","/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { UUID } from '@lumino/coreutils';\nimport { SplitLayout } from './splitlayout';\nimport { Title } from './title';\nimport Utils from './utils';\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets into collapsible resizable sections.\n */\nexport class AccordionLayout extends SplitLayout {\n /**\n * Construct a new accordion layout.\n *\n * @param options - The options for initializing the layout.\n *\n * #### Notes\n * The default orientation will be vertical.\n *\n * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n */\n constructor(options: AccordionLayout.IOptions) {\n super({ ...options, orientation: options.orientation || 'vertical' });\n this.titleSpace = options.titleSpace || 22;\n }\n\n /**\n * The section title height or width depending on the orientation.\n */\n get titleSpace(): number {\n return this.widgetOffset;\n }\n set titleSpace(value: number) {\n value = Utils.clampDimension(value);\n if (this.widgetOffset === value) {\n return;\n }\n this.widgetOffset = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return this._titles;\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n\n // Clear the layout state.\n this._titles.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * The renderer used by the accordion layout.\n */\n readonly renderer: AccordionLayout.IRenderer;\n\n public updateTitle(index: number, widget: Widget): void {\n const oldTitle = this._titles[index];\n const expanded = oldTitle.classList.contains('lm-mod-expanded');\n const newTitle = Private.createTitle(this.renderer, widget.title, expanded);\n this._titles[index] = newTitle;\n\n // Add the title node to the parent before the widget.\n this.parent!.node.replaceChild(newTitle, oldTitle);\n }\n\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insertWidget(index: number, widget: Widget): void {\n if (!widget.id) {\n widget.id = `id-${UUID.uuid4()}`;\n }\n super.insertWidget(index, widget);\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(index: number, widget: Widget): void {\n const title = Private.createTitle(this.renderer, widget.title);\n\n ArrayExt.insert(this._titles, index, title);\n\n // Add the title node to the parent before the widget.\n this.parent!.node.appendChild(title);\n\n widget.node.setAttribute('role', 'region');\n widget.node.setAttribute('aria-labelledby', title.id);\n\n super.attachWidget(index, widget);\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n ArrayExt.move(this._titles, fromIndex, toIndex);\n super.moveWidget(fromIndex, toIndex, widget);\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n const title = ArrayExt.removeAt(this._titles, index);\n\n this.parent!.node.removeChild(title!);\n\n super.detachWidget(index, widget);\n }\n\n /**\n * Update the item position.\n *\n * @param i Item index\n * @param isHorizontal Whether the layout is horizontal or not\n * @param left Left position in pixels\n * @param top Top position in pixels\n * @param height Item height\n * @param width Item width\n * @param size Item size\n */\n protected updateItemPosition(\n i: number,\n isHorizontal: boolean,\n left: number,\n top: number,\n height: number,\n width: number,\n size: number\n ): void {\n const titleStyle = this._titles[i].style;\n\n // Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css\n titleStyle.top = `${top}px`;\n titleStyle.left = `${left}px`;\n titleStyle.height = `${this.widgetOffset}px`;\n if (isHorizontal) {\n titleStyle.width = `${height}px`;\n } else {\n titleStyle.width = `${width}px`;\n }\n\n super.updateItemPosition(i, isHorizontal, left, top, height, width, size);\n }\n\n private _titles: HTMLElement[] = [];\n}\n\nexport namespace AccordionLayout {\n /**\n * A type alias for a accordion layout orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion layout alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * An options object for initializing a accordion layout.\n */\n export interface IOptions extends SplitLayout.IOptions {\n /**\n * The renderer to use for the accordion layout.\n */\n renderer: IRenderer;\n\n /**\n * The section title height or width depending on the orientation.\n *\n * The default is `22`.\n */\n titleSpace?: number;\n }\n\n /**\n * A renderer for use with an accordion layout.\n */\n export interface IRenderer extends SplitLayout.IRenderer {\n /**\n * Common class name for all accordion titles.\n */\n readonly titleClassName: string;\n\n /**\n * Render the element for a section title.\n *\n * @param title - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(title: Title): HTMLElement;\n }\n}\n\nnamespace Private {\n /**\n * Create the title HTML element.\n *\n * @param renderer Accordion renderer\n * @param data Widget title\n * @returns Title HTML element\n */\n export function createTitle(\n renderer: AccordionLayout.IRenderer,\n data: Title,\n expanded: boolean = true\n ): HTMLElement {\n const title = renderer.createSectionTitle(data);\n title.style.position = 'absolute';\n title.style.contain = 'strict';\n title.setAttribute('aria-label', `${data.label} Section`);\n title.setAttribute('aria-expanded', expanded ? 'true' : 'false');\n title.setAttribute('aria-controls', data.owner.id);\n if (expanded) {\n title.classList.add('lm-mod-expanded');\n }\n return title;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a {@link PanelLayout}.\n */\nexport class Panel extends Widget {\n /**\n * Construct a new panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: Panel.IOptions = {}) {\n super();\n this.addClass('lm-Panel');\n this.layout = Private.createLayout(options);\n }\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return (this.layout as PanelLayout).widgets;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n (this.layout as PanelLayout).addWidget(widget);\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n (this.layout as PanelLayout).insertWidget(index, widget);\n }\n}\n\n/**\n * The namespace for the `Panel` class statics.\n */\nexport namespace Panel {\n /**\n * An options object for creating a panel.\n */\n export interface IOptions {\n /**\n * The panel layout to use for the panel.\n *\n * The default is a new `PanelLayout`.\n */\n layout?: PanelLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a panel layout for the given panel options.\n */\n export function createLayout(options: Panel.IOptions): PanelLayout {\n return options.layout || new PanelLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { SplitLayout } from './splitlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link SplitLayout}.\n */\nexport class SplitPanel extends Panel {\n /**\n * Construct a new split panel.\n *\n * @param options - The options for initializing the split panel.\n */\n constructor(options: SplitPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-SplitPanel');\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n this._releaseMouse();\n super.dispose();\n }\n\n /**\n * Get the layout orientation for the split panel.\n */\n get orientation(): SplitPanel.Orientation {\n return (this.layout as SplitLayout).orientation;\n }\n\n /**\n * Set the layout orientation for the split panel.\n */\n set orientation(value: SplitPanel.Orientation) {\n (this.layout as SplitLayout).orientation = value;\n }\n\n /**\n * Get the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n get alignment(): SplitPanel.Alignment {\n return (this.layout as SplitLayout).alignment;\n }\n\n /**\n * Set the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n set alignment(value: SplitPanel.Alignment) {\n (this.layout as SplitLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the split panel.\n */\n get spacing(): number {\n return (this.layout as SplitLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the split panel.\n */\n set spacing(value: number) {\n (this.layout as SplitLayout).spacing = value;\n }\n\n /**\n * The renderer used by the split panel.\n */\n get renderer(): SplitPanel.IRenderer {\n return (this.layout as SplitLayout).renderer;\n }\n\n /**\n * A signal emitted when a split handle has moved.\n */\n get handleMoved(): ISignal {\n return this._handleMoved;\n }\n\n /**\n * A read-only array of the split handles in the panel.\n */\n get handles(): ReadonlyArray {\n return (this.layout as SplitLayout).handles;\n }\n\n /**\n * Get the relative sizes of the widgets in the panel.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n relativeSizes(): number[] {\n return (this.layout as SplitLayout).relativeSizes();\n }\n\n /**\n * Set the relative sizes for the widgets in the panel.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n * @param update - Update the layout after setting relative sizes.\n * Default is True.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n setRelativeSizes(sizes: number[], update = true): void {\n (this.layout as SplitLayout).setRelativeSizes(sizes, update);\n }\n\n /**\n * Handle the DOM events for the split panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-SplitPanel-child');\n this._releaseMouse();\n }\n\n /**\n * Handle the `'keydown'` event for the split panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n if (this._pressData) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the split panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the primary button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the target, if any.\n let layout = this.layout as SplitLayout;\n let index = ArrayExt.findFirstIndex(layout.handles, handle => {\n return handle.contains(event.target as HTMLElement);\n });\n\n // Bail early if the mouse press was not on a handle.\n if (index === -1) {\n return;\n }\n\n // Stop the event when a split handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n document.addEventListener('pointerup', this, true);\n document.addEventListener('pointermove', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Compute the offset delta for the handle press.\n let delta: number;\n let handle = layout.handles[index];\n let rect = handle.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n delta = event.clientX - rect.left;\n } else {\n delta = event.clientY - rect.top;\n }\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!);\n this._pressData = { index, delta, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the split panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Stop the event when dragging a split handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let pos: number;\n let layout = this.layout as SplitLayout;\n let rect = this.node.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n pos = event.clientX - rect.left - this._pressData!.delta;\n } else {\n pos = event.clientY - rect.top - this._pressData!.delta;\n }\n\n // Move the handle as close to the desired position as possible.\n layout.moveHandle(this._pressData!.index, pos);\n }\n\n /**\n * Handle the `'pointerup'` event for the split panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the primary button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse grab for the split panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Emit the handle moved signal.\n this._handleMoved.emit();\n\n // Remove the extra document listeners.\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('pointerup', this, true);\n document.removeEventListener('pointermove', this, true);\n document.removeEventListener('contextmenu', this, true);\n }\n\n private _handleMoved = new Signal(this);\n private _pressData: Private.IPressData | null = null;\n}\n\n/**\n * The namespace for the `SplitPanel` class statics.\n */\nexport namespace SplitPanel {\n /**\n * A type alias for a split panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a split panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a split panel renderer.\n */\n export type IRenderer = SplitLayout.IRenderer;\n\n /**\n * An options object for initializing a split panel.\n */\n export interface IOptions {\n /**\n * The renderer to use for the split panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The layout orientation of the panel.\n *\n * The default is `'horizontal'`.\n */\n orientation?: Orientation;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The split layout to use for the split panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `SplitLayout`.\n */\n layout?: SplitLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new handle for use with a split panel.\n *\n * @returns A new handle element for a split panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-SplitPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * Get the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return SplitLayout.getStretch(widget);\n }\n\n /**\n * Set the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n SplitLayout.setStretch(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The index of the pressed handle.\n */\n index: number;\n\n /**\n * The offset of the press in handle coordinates.\n */\n delta: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * Create a split layout for the given panel options.\n */\n export function createLayout(options: SplitPanel.IOptions): SplitLayout {\n return (\n options.layout ||\n new SplitLayout({\n renderer: options.renderer || SplitPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Message } from '@lumino/messaging';\nimport { ISignal, Signal } from '@lumino/signaling';\nimport { AccordionLayout } from './accordionlayout';\nimport { SplitLayout } from './splitlayout';\nimport { SplitPanel } from './splitpanel';\nimport { Title } from './title';\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets into resizable sections separated by a title widget.\n *\n * #### Notes\n * This class provides a convenience wrapper around {@link AccordionLayout}.\n */\nexport class AccordionPanel extends SplitPanel {\n /**\n * Construct a new accordion panel.\n *\n * @param options - The options for initializing the accordion panel.\n */\n constructor(options: AccordionPanel.IOptions = {}) {\n super({ ...options, layout: Private.createLayout(options) });\n this.addClass('lm-AccordionPanel');\n }\n\n /**\n * The renderer used by the accordion panel.\n */\n get renderer(): AccordionPanel.IRenderer {\n return (this.layout as AccordionLayout).renderer;\n }\n\n /**\n * The section title space.\n *\n * This is the height if the panel is vertical and the width if it is\n * horizontal.\n */\n get titleSpace(): number {\n return (this.layout as AccordionLayout).titleSpace;\n }\n set titleSpace(value: number) {\n (this.layout as AccordionLayout).titleSpace = value;\n }\n\n /**\n * A read-only array of the section titles in the panel.\n */\n get titles(): ReadonlyArray {\n return (this.layout as AccordionLayout).titles;\n }\n\n /**\n * A signal emitted when a widget of the AccordionPanel is collapsed or expanded.\n */\n get expansionToggled(): ISignal {\n return this._expansionToggled;\n }\n\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n addWidget(widget: Widget): void {\n super.addWidget(widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Collapse the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n collapse(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && !widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Expand the widget at position `index`.\n *\n * #### Notes\n * If no widget is found for `index`, this will bail.\n *\n * @param index Widget index\n */\n expand(index: number): void {\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n if (widget && widget.isHidden) {\n this._toggleExpansion(index);\n }\n }\n\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n insertWidget(index: number, widget: Widget): void {\n super.insertWidget(index, widget);\n widget.title.changed.connect(this._onTitleChanged, this);\n }\n\n /**\n * Handle the DOM events for the accordion panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n super.handleEvent(event);\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._eventKeyDown(event as KeyboardEvent);\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n super.onBeforeAttach(msg);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n super.onAfterDetach(msg);\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n const index = ArrayExt.findFirstIndex(this.widgets, widget => {\n return widget.contains(sender.owner);\n });\n\n if (index >= 0) {\n (this.layout as AccordionLayout).updateTitle(index, sender.owner);\n this.update();\n }\n }\n\n /**\n * Compute the size of widgets in this panel on the title click event.\n * On closing, the size of the widget is cached and we will try to expand\n * the last opened widget.\n * On opening, we will use the cached size if it is available to restore the\n * widget.\n * In both cases, if we can not compute the size of widgets, we will let\n * `SplitLayout` decide.\n *\n * @param index - The index of widget to be opened of closed\n *\n * @returns Relative size of widgets in this panel, if this size can\n * not be computed, return `undefined`\n */\n private _computeWidgetSize(index: number): number[] | undefined {\n const layout = this.layout as AccordionLayout;\n\n const widget = layout.widgets[index];\n if (!widget) {\n return undefined;\n }\n const isHidden = widget.isHidden;\n const widgetSizes = layout.absoluteSizes();\n const delta = (isHidden ? -1 : 1) * this.spacing;\n const totalSize = widgetSizes.reduce(\n (prev: number, curr: number) => prev + curr\n );\n\n let newSize = [...widgetSizes];\n\n if (!isHidden) {\n // Hide the widget\n const currentSize = widgetSizes[index];\n\n this._widgetSizesCache.set(widget, currentSize);\n newSize[index] = 0;\n\n const widgetToCollapse = newSize.map(sz => sz > 0).lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // All widget are closed, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n\n newSize[widgetToCollapse] =\n widgetSizes[widgetToCollapse] + currentSize + delta;\n } else {\n // Show the widget\n const previousSize = this._widgetSizesCache.get(widget);\n if (!previousSize) {\n // Previous size is unavailable, let the `SplitLayout` compute widget sizes.\n return undefined;\n }\n newSize[index] += previousSize;\n\n const widgetToCollapse = newSize\n .map(sz => sz - previousSize > 0)\n .lastIndexOf(true);\n if (widgetToCollapse === -1) {\n // Can not reduce the size of one widget, reduce all opened widgets\n // proportionally with its size.\n newSize.forEach((_, idx) => {\n if (idx !== index) {\n newSize[idx] -=\n (widgetSizes[idx] / totalSize) * (previousSize - delta);\n }\n });\n } else {\n newSize[widgetToCollapse] -= previousSize - delta;\n }\n }\n return newSize.map(sz => sz / (totalSize + delta));\n }\n /**\n * Handle the `'click'` event for the accordion panel\n */\n private _evtClick(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this._toggleExpansion(index);\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the accordion panel.\n */\n private _eventKeyDown(event: KeyboardEvent): void {\n if (event.defaultPrevented) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n let handled = false;\n if (target) {\n const index = ArrayExt.findFirstIndex(this.titles, title => {\n return title.contains(target);\n });\n\n if (index >= 0) {\n const keyCode = event.keyCode.toString();\n\n // If Space or Enter is pressed on title, emulate click event\n if (event.key.match(/Space|Enter/) || keyCode.match(/13|32/)) {\n target.click();\n handled = true;\n } else if (\n this.orientation === 'horizontal'\n ? event.key.match(/ArrowLeft|ArrowRight/) || keyCode.match(/37|39/)\n : event.key.match(/ArrowUp|ArrowDown/) || keyCode.match(/38|40/)\n ) {\n // If Up or Down (for vertical) / Left or Right (for horizontal) is pressed on title, loop on titles\n const direction =\n event.key.match(/ArrowLeft|ArrowUp/) || keyCode.match(/37|38/)\n ? -1\n : 1;\n const length = this.titles.length;\n const newIndex = (index + length + direction) % length;\n\n this.titles[newIndex].focus();\n handled = true;\n } else if (event.key === 'End' || keyCode === '35') {\n // If End is pressed on title, focus on the last title\n this.titles[this.titles.length - 1].focus();\n handled = true;\n } else if (event.key === 'Home' || keyCode === '36') {\n // If Home is pressed on title, focus on the first title\n this.titles[0].focus();\n handled = true;\n }\n }\n\n if (handled) {\n event.preventDefault();\n }\n }\n }\n\n private _toggleExpansion(index: number) {\n const title = this.titles[index];\n const widget = (this.layout as AccordionLayout).widgets[index];\n\n const newSize = this._computeWidgetSize(index);\n if (newSize) {\n this.setRelativeSizes(newSize, false);\n }\n\n if (widget.isHidden) {\n title.classList.add('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'true');\n widget.show();\n } else {\n title.classList.remove('lm-mod-expanded');\n title.setAttribute('aria-expanded', 'false');\n widget.hide();\n }\n\n // Emit the expansion state signal.\n this._expansionToggled.emit(index);\n }\n\n private _widgetSizesCache: WeakMap = new WeakMap();\n private _expansionToggled = new Signal(this);\n}\n\n/**\n * The namespace for the `AccordionPanel` class statics.\n */\nexport namespace AccordionPanel {\n /**\n * A type alias for a accordion panel orientation.\n */\n export type Orientation = SplitLayout.Orientation;\n\n /**\n * A type alias for a accordion panel alignment.\n */\n export type Alignment = SplitLayout.Alignment;\n\n /**\n * A type alias for a accordion panel renderer.\n */\n export type IRenderer = AccordionLayout.IRenderer;\n\n /**\n * An options object for initializing a accordion panel.\n */\n export interface IOptions extends Partial {\n /**\n * The accordion layout to use for the accordion panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `AccordionLayout`.\n */\n layout?: AccordionLayout;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer extends SplitPanel.Renderer implements IRenderer {\n constructor() {\n super();\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches any title node in the accordion.\n */\n readonly titleClassName = 'lm-AccordionPanel-title';\n\n /**\n * Render the collapse indicator for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the collapse indicator.\n */\n createCollapseIcon(data: Title): HTMLElement {\n return document.createElement('span');\n }\n\n /**\n * Render the element for a section title.\n *\n * @param data - The data to use for rendering the section title.\n *\n * @returns A element representing the section title.\n */\n createSectionTitle(data: Title): HTMLElement {\n const handle = document.createElement('h3');\n handle.setAttribute('tabindex', '0');\n handle.id = this.createTitleKey(data);\n handle.className = this.titleClassName;\n for (const aData in data.dataset) {\n handle.dataset[aData] = data.dataset[aData];\n }\n\n const collapser = handle.appendChild(this.createCollapseIcon(data));\n collapser.className = 'lm-AccordionPanel-titleCollapser';\n\n const label = handle.appendChild(document.createElement('span'));\n label.className = 'lm-AccordionPanel-titleLabel';\n label.textContent = data.label;\n label.title = data.caption || data.label;\n\n return handle;\n }\n\n /**\n * Create a unique render key for the title.\n *\n * @param data - The data to use for the title.\n *\n * @returns The unique render key for the title.\n *\n * #### Notes\n * This method caches the key against the section title the first time\n * the key is generated.\n */\n createTitleKey(data: Title): string {\n let key = this._titleKeys.get(data);\n if (key === undefined) {\n key = `title-key-${this._uuid}-${this._titleID++}`;\n this._titleKeys.set(data, key);\n }\n return key;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _titleID = 0;\n private _titleKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\nnamespace Private {\n /**\n * Create an accordion layout for the given panel options.\n *\n * @param options Panel options\n * @returns Panel layout\n */\n export function createLayout(\n options: AccordionPanel.IOptions\n ): AccordionLayout {\n return (\n options.layout ||\n new AccordionLayout({\n renderer: options.renderer || AccordionPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing,\n titleSpace: options.titleSpace\n })\n );\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nexport class BoxLayout extends PanelLayout {\n /**\n * Construct a new box layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: BoxLayout.IOptions = {}) {\n super();\n if (options.direction !== undefined) {\n this._direction = options.direction;\n }\n if (options.alignment !== undefined) {\n this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the layout direction for the box layout.\n */\n get direction(): BoxLayout.Direction {\n return this._direction;\n }\n\n /**\n * Set the layout direction for the box layout.\n */\n set direction(value: BoxLayout.Direction) {\n if (this._direction === value) {\n return;\n }\n this._direction = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['direction'] = value;\n this.parent.fit();\n }\n\n /**\n * Get the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxLayout.Alignment {\n return this._alignment;\n }\n\n /**\n * Set the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxLayout.Alignment) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n }\n\n /**\n * Get the inter-element spacing for the box layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the box layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n this.parent!.dataset['direction'] = this.direction;\n this.parent!.dataset['alignment'] = this.alignment;\n super.init();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Create and add a new sizer for the widget.\n ArrayExt.insert(this._sizers, index, new BoxSizer());\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Move the sizer for the widget.\n ArrayExt.move(this._sizers, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Remove the sizer for the widget.\n ArrayExt.removeAt(this._sizers, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Update the fixed space for the visible items.\n this._fixed = this._spacing * Math.max(0, nVisible - 1);\n\n // Setup the computed minimum size.\n let horz = Private.isHorizontal(this._direction);\n let minW = horz ? this._fixed : 0;\n let minH = horz ? 0 : this._fixed;\n\n // Update the sizers and computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n let item = this._items[i];\n let sizer = this._sizers[i];\n\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the size basis and stretch factor.\n sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n sizer.stretch = BoxLayout.getStretch(item.widget);\n\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n } else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Distribute the layout space and adjust the start position.\n let delta: number;\n switch (this._direction) {\n case 'left-to-right':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n break;\n case 'top-to-bottom':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n break;\n case 'right-to-left':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n left += width;\n break;\n case 'bottom-to-top':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n top += height;\n break;\n default:\n throw 'unreachable';\n }\n\n // Setup the variables for justification and alignment offset.\n let extra = 0;\n let offset = 0;\n\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Layout the items using the computed box sizes.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the computed size for the widget.\n let size = this._sizers[i].size;\n\n // Update the widget geometry and advance the relevant edge.\n switch (this._direction) {\n case 'left-to-right':\n item.update(left + offset, top, size + extra, height);\n left += size + extra + this._spacing;\n break;\n case 'top-to-bottom':\n item.update(left, top + offset, width, size + extra);\n top += size + extra + this._spacing;\n break;\n case 'right-to-left':\n item.update(left - offset - size - extra, top, size + extra, height);\n left -= size + extra + this._spacing;\n break;\n case 'bottom-to-top':\n item.update(left, top - offset - size - extra, width, size + extra);\n top -= size + extra + this._spacing;\n break;\n default:\n throw 'unreachable';\n }\n }\n }\n\n private _fixed = 0;\n private _spacing = 4;\n private _dirty = false;\n private _sizers: BoxSizer[] = [];\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _alignment: BoxLayout.Alignment = 'start';\n private _direction: BoxLayout.Direction = 'top-to-bottom';\n}\n\n/**\n * The namespace for the `BoxLayout` class statics.\n */\nexport namespace BoxLayout {\n /**\n * A type alias for a box layout direction.\n */\n export type Direction =\n | 'left-to-right'\n | 'right-to-left'\n | 'top-to-bottom'\n | 'bottom-to-top';\n\n /**\n * A type alias for a box layout alignment.\n */\n export type Alignment = 'start' | 'center' | 'end' | 'justify';\n\n /**\n * An options object for initializing a box layout.\n */\n export interface IOptions {\n /**\n * The direction of the layout.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the layout.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * Get the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return Private.stretchProperty.get(widget);\n }\n\n /**\n * Set the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n Private.stretchProperty.set(widget, value);\n }\n\n /**\n * Get the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return Private.sizeBasisProperty.get(widget);\n }\n\n /**\n * Set the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n Private.sizeBasisProperty.set(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for a widget stretch factor.\n */\n export const stretchProperty = new AttachedProperty({\n name: 'stretch',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * The property descriptor for a widget size basis.\n */\n export const sizeBasisProperty = new AttachedProperty({\n name: 'sizeBasis',\n create: () => 0,\n coerce: (owner, value) => Math.max(0, Math.floor(value)),\n changed: onChildSizingChanged\n });\n\n /**\n * Test whether a direction has horizontal orientation.\n */\n export function isHorizontal(dir: BoxLayout.Direction): boolean {\n return dir === 'left-to-right' || dir === 'right-to-left';\n }\n\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n export function clampSpacing(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof BoxLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { BoxLayout } from './boxlayout';\n\nimport { Panel } from './panel';\n\nimport { Widget } from './widget';\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link BoxLayout}.\n */\nexport class BoxPanel extends Panel {\n /**\n * Construct a new box panel.\n *\n * @param options - The options for initializing the box panel.\n */\n constructor(options: BoxPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-BoxPanel');\n }\n\n /**\n * Get the layout direction for the box panel.\n */\n get direction(): BoxPanel.Direction {\n return (this.layout as BoxLayout).direction;\n }\n\n /**\n * Set the layout direction for the box panel.\n */\n set direction(value: BoxPanel.Direction) {\n (this.layout as BoxLayout).direction = value;\n }\n\n /**\n * Get the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get alignment(): BoxPanel.Alignment {\n return (this.layout as BoxLayout).alignment;\n }\n\n /**\n * Set the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set alignment(value: BoxPanel.Alignment) {\n (this.layout as BoxLayout).alignment = value;\n }\n\n /**\n * Get the inter-element spacing for the box panel.\n */\n get spacing(): number {\n return (this.layout as BoxLayout).spacing;\n }\n\n /**\n * Set the inter-element spacing for the box panel.\n */\n set spacing(value: number) {\n (this.layout as BoxLayout).spacing = value;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-BoxPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-BoxPanel-child');\n }\n}\n\n/**\n * The namespace for the `BoxPanel` class statics.\n */\nexport namespace BoxPanel {\n /**\n * A type alias for a box panel direction.\n */\n export type Direction = BoxLayout.Direction;\n\n /**\n * A type alias for a box panel alignment.\n */\n export type Alignment = BoxLayout.Alignment;\n\n /**\n * An options object for initializing a box panel.\n */\n export interface IOptions {\n /**\n * The layout direction of the panel.\n *\n * The default is `'top-to-bottom'`.\n */\n direction?: Direction;\n\n /**\n * The content alignment of the panel.\n *\n * The default is `'start'`.\n */\n alignment?: Alignment;\n\n /**\n * The spacing between items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The box layout to use for the box panel.\n *\n * If this is provided, the other options are ignored.\n *\n * The default is a new `BoxLayout`.\n */\n layout?: BoxLayout;\n }\n\n /**\n * Get the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel stretch factor for the widget.\n */\n export function getStretch(widget: Widget): number {\n return BoxLayout.getStretch(widget);\n }\n\n /**\n * Set the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n export function setStretch(widget: Widget, value: number): void {\n BoxLayout.setStretch(widget, value);\n }\n\n /**\n * Get the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel size basis for the widget.\n */\n export function getSizeBasis(widget: Widget): number {\n return BoxLayout.getSizeBasis(widget);\n }\n\n /**\n * Set the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n export function setSizeBasis(widget: Widget, value: number): void {\n BoxLayout.setSizeBasis(widget, value);\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a box layout for the given panel options.\n */\n export function createLayout(options: BoxPanel.IOptions): BoxLayout {\n return options.layout || new BoxLayout(options);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, StringExt } from '@lumino/algorithm';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message } from '@lumino/messaging';\n\nimport {\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nexport class CommandPalette extends Widget {\n /**\n * Construct a new command palette.\n *\n * @param options - The options for initializing the palette.\n */\n constructor(options: CommandPalette.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-CommandPalette');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || CommandPalette.defaultRenderer;\n this.commands.commandChanged.connect(this._onGenericChange, this);\n this.commands.keyBindingChanged.connect(this._onGenericChange, this);\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._items.length = 0;\n this._results = null;\n super.dispose();\n }\n\n /**\n * The command registry used by the command palette.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the command palette.\n */\n readonly renderer: CommandPalette.IRenderer;\n\n /**\n * The command palette search node.\n *\n * #### Notes\n * This is the node which contains the search-related elements.\n */\n get searchNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-search'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The command palette input node.\n *\n * #### Notes\n * This is the actual input node for the search area.\n */\n get inputNode(): HTMLInputElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-input'\n )[0] as HTMLInputElement;\n }\n\n /**\n * The command palette content node.\n *\n * #### Notes\n * This is the node which holds the command item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-CommandPalette-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * A read-only array of the command items in the palette.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Add a command item to the command palette.\n *\n * @param options - The options for creating the command item.\n *\n * @returns The command item added to the palette.\n */\n addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem {\n // Create a new command item for the options.\n let item = Private.createItem(this.commands, options);\n\n // Add the item to the array.\n this._items.push(item);\n\n // Refresh the search results.\n this.refresh();\n\n // Return the item added to the palette.\n return item;\n }\n\n /**\n * Adds command items to the command palette.\n *\n * @param items - An array of options for creating each command item.\n *\n * @returns The command items added to the palette.\n */\n addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[] {\n const newItems = items.map(item => Private.createItem(this.commands, item));\n newItems.forEach(item => this._items.push(item));\n this.refresh();\n return newItems;\n }\n\n /**\n * Remove an item from the command palette.\n *\n * @param item - The item to remove from the palette.\n *\n * #### Notes\n * This is a no-op if the item is not in the palette.\n */\n removeItem(item: CommandPalette.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the command palette.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Remove all items from the command palette.\n */\n clearItems(): void {\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the array of items.\n this._items.length = 0;\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Clear the search results and schedule an update.\n *\n * #### Notes\n * This should be called whenever the search results of the palette\n * should be updated.\n *\n * This is typically called automatically by the palette as needed,\n * but can be called manually if the input text is programatically\n * changed.\n *\n * The rendered results are updated asynchronously.\n */\n refresh(): void {\n this._results = null;\n if (this.inputNode.value !== '') {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'inherit';\n } else {\n let clear = this.node.getElementsByClassName(\n 'lm-close-icon'\n )[0] as HTMLInputElement;\n clear.style.display = 'none';\n }\n this.update();\n }\n\n /**\n * Handle the DOM events for the command palette.\n *\n * @param event - The DOM event sent to the command palette.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the command palette's DOM node.\n * It should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'input':\n this.refresh();\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('input', this);\n this.node.addEventListener('focus', this, true);\n this.node.addEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('input', this);\n this.node.removeEventListener('focus', this, true);\n this.node.removeEventListener('blur', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n */\n protected onAfterShow(msg: Message): void {\n this.update();\n super.onAfterShow(msg);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n let input = this.inputNode;\n input.focus();\n input.select();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.isHidden) {\n return;\n }\n\n // Fetch the current query text and content node.\n let query = this.inputNode.value;\n let contentNode = this.contentNode;\n\n // Ensure the search results are generated.\n let results = this._results;\n if (!results) {\n // Generate and store the new search results.\n results = this._results = Private.search(this._items, query);\n\n // Reset the active index.\n this._activeIndex = query\n ? ArrayExt.findFirstIndex(results, Private.canActivate)\n : -1;\n }\n\n // If there is no query and no results, clear the content.\n if (!query && results.length === 0) {\n VirtualDOM.render(null, contentNode);\n return;\n }\n\n // If the is a query but no results, render the empty message.\n if (query && results.length === 0) {\n let content = this.renderer.renderEmptyMessage({ query });\n VirtualDOM.render(content, contentNode);\n return;\n }\n\n // Create the render content for the search results.\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let content = new Array(results.length);\n for (let i = 0, n = results.length; i < n; ++i) {\n let result = results[i];\n if (result.type === 'header') {\n let indices = result.indices;\n let category = result.category;\n content[i] = renderer.renderHeader({ category, indices });\n } else {\n let item = result.item;\n let indices = result.indices;\n let active = i === activeIndex;\n content[i] = renderer.renderItem({ item, indices, active });\n }\n }\n\n // Render the search result content.\n VirtualDOM.render(content, contentNode);\n\n // Adjust the scroll position as needed.\n if (activeIndex < 0 || activeIndex >= results.length) {\n contentNode.scrollTop = 0;\n } else {\n let element = contentNode.children[activeIndex];\n ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n }\n }\n\n /**\n * Handle the `'click'` event for the command palette.\n */\n private _evtClick(event: MouseEvent): void {\n // Bail if the click is not the left button.\n if (event.button !== 0) {\n return;\n }\n\n // Clear input if the target is clear button\n if ((event.target as HTMLElement).classList.contains('lm-close-icon')) {\n this.inputNode.value = '';\n this.refresh();\n return;\n }\n\n // Find the index of the item which was clicked.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return node.contains(event.target as HTMLElement);\n });\n\n // Bail if the click was not on an item.\n if (index === -1) {\n return;\n }\n\n // Kill the event when a content item is clicked.\n event.preventDefault();\n event.stopPropagation();\n\n // Execute the item if possible.\n this._execute(index);\n }\n\n /**\n * Handle the `'keydown'` event for the command palette.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n return;\n }\n switch (event.keyCode) {\n case 13: // Enter\n event.preventDefault();\n event.stopPropagation();\n this._execute(this._activeIndex);\n break;\n case 38: // Up Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activatePreviousItem();\n break;\n case 40: // Down Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activateNextItem();\n break;\n }\n }\n\n /**\n * Activate the next enabled command item.\n */\n private _activateNextItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the next enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this._activeIndex = ArrayExt.findFirstIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Activate the previous enabled command item.\n */\n private _activatePreviousItem(): void {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n\n // Find the previous enabled item index.\n let ai = this._activeIndex;\n let n = this._results.length;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this._activeIndex = ArrayExt.findLastIndex(\n this._results,\n Private.canActivate,\n start,\n stop\n );\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Execute the command item at the given index, if possible.\n */\n private _execute(index: number): void {\n // Bail if there are no search results.\n if (!this._results) {\n return;\n }\n\n // Bail if the index is out of range.\n let part = this._results[index];\n if (!part) {\n return;\n }\n\n // Update the search text if the item is a header.\n if (part.type === 'header') {\n let input = this.inputNode;\n input.value = `${part.category.toLowerCase()} `;\n input.focus();\n this.refresh();\n return;\n }\n\n // Bail if item is not enabled.\n if (!part.item.isEnabled) {\n return;\n }\n\n // Execute the item.\n this.commands.execute(part.item.command, part.item.args);\n\n // Clear the query text.\n this.inputNode.value = '';\n\n // Refresh the search results.\n this.refresh();\n }\n\n /**\n * Toggle the focused modifier based on the input node focus state.\n */\n private _toggleFocused(): void {\n let focused = document.activeElement === this.inputNode;\n this.toggleClass('lm-mod-focused', focused);\n }\n\n /**\n * A signal handler for generic command changes.\n */\n private _onGenericChange(): void {\n this.refresh();\n }\n\n private _activeIndex = -1;\n private _items: CommandPalette.IItem[] = [];\n private _results: Private.SearchResult[] | null = null;\n}\n\n/**\n * The namespace for the `CommandPalette` class statics.\n */\nexport namespace CommandPalette {\n /**\n * An options object for creating a command palette.\n */\n export interface IOptions {\n /**\n * The command registry for use with the command palette.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the command palette.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for creating a command item.\n */\n export interface IItemOptions {\n /**\n * The category for the item.\n */\n category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n command: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n *\n * The rank is used as a tie-breaker when ordering command items\n * for display. Items are sorted in the following order:\n * 1. Text match (lower is better)\n * 2. Category (locale order)\n * 3. Rank (lower is better)\n * 4. Label (locale order)\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n\n /**\n * An object which represents an item in a command palette.\n *\n * #### Notes\n * Item objects are created automatically by a command palette.\n */\n export interface IItem {\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n readonly label: string;\n\n /**\n * The display caption for the command item.\n */\n readonly caption: string;\n\n /**\n * The icon renderer for the command item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the command item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the command item.\n */\n readonly iconLabel: string;\n\n /**\n * The extra class name for the command item.\n */\n readonly className: string;\n\n /**\n * The dataset for the command item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the command item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the command item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the command item is toggleable.\n */\n readonly isToggleable: boolean;\n\n /**\n * Whether the command item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the command item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * The render data for a command palette header.\n */\n export interface IHeaderRenderData {\n /**\n * The category of the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched characters in the category.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * The render data for a command palette item.\n */\n export interface IItemRenderData {\n /**\n * The command palette item to render.\n */\n readonly item: IItem;\n\n /**\n * The indices of the matched characters in the label.\n */\n readonly indices: ReadonlyArray | null;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n }\n\n /**\n * The render data for a command palette empty message.\n */\n export interface IEmptyMessageRenderData {\n /**\n * The query which failed to match any commands.\n */\n query: string;\n }\n\n /**\n * A renderer for use with a command palette.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement;\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n *\n * #### Notes\n * The command palette will not render invisible items.\n */\n renderItem(data: IItemRenderData): VirtualElement;\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n renderHeader(data: IHeaderRenderData): VirtualElement {\n let content = this.formatHeader(data);\n return h.li({ className: 'lm-CommandPalette-header' }, content);\n }\n\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IItemRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n if (data.item.isToggleable) {\n return h.li(\n {\n className,\n dataset,\n role: 'menuitemcheckbox',\n 'aria-checked': `${data.item.isToggled}`\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n return h.li(\n {\n className,\n dataset,\n role: 'menuitem'\n },\n this.renderItemIcon(data),\n this.renderItemContent(data),\n this.renderItemShortcut(data)\n );\n }\n\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n renderEmptyMessage(data: IEmptyMessageRenderData): VirtualElement {\n let content = this.formatEmptyMessage(data);\n return h.li({ className: 'lm-CommandPalette-emptyMessage' }, content);\n }\n\n /**\n * Render the icon for a command palette item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the icon.\n */\n renderItemIcon(data: IItemRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the content for a command palette item.\n *\n * @param data - The data to use for rendering the content.\n *\n * @returns A virtual element representing the content.\n */\n renderItemContent(data: IItemRenderData): VirtualElement {\n return h.div(\n { className: 'lm-CommandPalette-itemContent' },\n this.renderItemLabel(data),\n this.renderItemCaption(data)\n );\n }\n\n /**\n * Render the label for a command palette item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the label.\n */\n renderItemLabel(data: IItemRenderData): VirtualElement {\n let content = this.formatItemLabel(data);\n return h.div({ className: 'lm-CommandPalette-itemLabel' }, content);\n }\n\n /**\n * Render the caption for a command palette item.\n *\n * @param data - The data to use for rendering the caption.\n *\n * @returns A virtual element representing the caption.\n */\n renderItemCaption(data: IItemRenderData): VirtualElement {\n let content = this.formatItemCaption(data);\n return h.div({ className: 'lm-CommandPalette-itemCaption' }, content);\n }\n\n /**\n * Render the shortcut for a command palette item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the shortcut.\n */\n renderItemShortcut(data: IItemRenderData): VirtualElement {\n let content = this.formatItemShortcut(data);\n return h.div({ className: 'lm-CommandPalette-itemShortcut' }, content);\n }\n\n /**\n * Create the class name for the command palette item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the command palette item.\n */\n createItemClass(data: IItemRenderData): string {\n // Set up the initial class name.\n let name = 'lm-CommandPalette-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the command palette item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the command palette item.\n */\n createItemDataset(data: IItemRenderData): ElementDataset {\n return { ...data.item.dataset, command: data.item.command };\n }\n\n /**\n * Create the class name for the command item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IItemRenderData): string {\n let name = 'lm-CommandPalette-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the header node.\n *\n * @param data - The data to use for the header content.\n *\n * @returns The content to add to the header node.\n */\n formatHeader(data: IHeaderRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.category;\n }\n return StringExt.highlight(data.category, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the empty message node.\n *\n * @param data - The data to use for the empty message content.\n *\n * @returns The content to add to the empty message node.\n */\n formatEmptyMessage(data: IEmptyMessageRenderData): h.Child {\n return `No commands found that match '${data.query}'`;\n }\n\n /**\n * Create the render content for the item shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatItemShortcut(data: IItemRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n\n /**\n * Create the render content for the item label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatItemLabel(data: IItemRenderData): h.Child {\n if (!data.indices || data.indices.length === 0) {\n return data.item.label;\n }\n return StringExt.highlight(data.item.label, data.indices, h.mark);\n }\n\n /**\n * Create the render content for the item caption node.\n *\n * @param data - The data to use for the caption content.\n *\n * @returns The content to add to the caption node.\n */\n formatItemCaption(data: IItemRenderData): h.Child {\n return data.item.caption;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a command palette.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let search = document.createElement('div');\n let wrapper = document.createElement('div');\n let input = document.createElement('input');\n let content = document.createElement('ul');\n let clear = document.createElement('button');\n search.className = 'lm-CommandPalette-search';\n wrapper.className = 'lm-CommandPalette-wrapper';\n input.className = 'lm-CommandPalette-input';\n clear.className = 'lm-close-icon';\n\n content.className = 'lm-CommandPalette-content';\n content.setAttribute('role', 'menu');\n input.spellcheck = false;\n wrapper.appendChild(input);\n wrapper.appendChild(clear);\n search.appendChild(wrapper);\n node.appendChild(search);\n node.appendChild(content);\n return node;\n }\n\n /**\n * Create a new command item from a command registry and options.\n */\n export function createItem(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ): CommandPalette.IItem {\n return new CommandItem(commands, options);\n }\n\n /**\n * A search result object for a header label.\n */\n export interface IHeaderResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'header';\n\n /**\n * The category for the header.\n */\n readonly category: string;\n\n /**\n * The indices of the matched category characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A search result object for a command item.\n */\n export interface IItemResult {\n /**\n * The discriminated type of the object.\n */\n readonly type: 'item';\n\n /**\n * The command item which was matched.\n */\n readonly item: CommandPalette.IItem;\n\n /**\n * The indices of the matched label characters.\n */\n readonly indices: ReadonlyArray | null;\n }\n\n /**\n * A type alias for a search result item.\n */\n export type SearchResult = IHeaderResult | IItemResult;\n\n /**\n * Search an array of command items for fuzzy matches.\n */\n export function search(\n items: CommandPalette.IItem[],\n query: string\n ): SearchResult[] {\n // Fuzzy match the items for the query.\n let scores = matchItems(items, query);\n\n // Sort the items based on their score.\n scores.sort(scoreCmp);\n\n // Create the results for the search.\n return createResults(scores);\n }\n\n /**\n * Test whether a result item can be activated.\n */\n export function canActivate(result: SearchResult): boolean {\n return result.type === 'item' && result.item.isEnabled;\n }\n\n /**\n * Normalize a category for a command item.\n */\n function normalizeCategory(category: string): string {\n return category.trim().replace(/\\s+/g, ' ');\n }\n\n /**\n * Normalize the query text for a fuzzy search.\n */\n function normalizeQuery(text: string): string {\n return text.replace(/\\s+/g, '').toLowerCase();\n }\n\n /**\n * An enum of the supported match types.\n */\n const enum MatchType {\n Label,\n Category,\n Split,\n Default\n }\n\n /**\n * A text match score with associated command item.\n */\n interface IScore {\n /**\n * The numerical type for the text match.\n */\n matchType: MatchType;\n\n /**\n * The numerical score for the text match.\n */\n score: number;\n\n /**\n * The indices of the matched category characters.\n */\n categoryIndices: number[] | null;\n\n /**\n * The indices of the matched label characters.\n */\n labelIndices: number[] | null;\n\n /**\n * The command item associated with the match.\n */\n item: CommandPalette.IItem;\n }\n\n /**\n * Perform a fuzzy match on an array of command items.\n */\n function matchItems(items: CommandPalette.IItem[], query: string): IScore[] {\n // Normalize the query text to lower case with no whitespace.\n query = normalizeQuery(query);\n\n // Create the array to hold the scores.\n let scores: IScore[] = [];\n\n // Iterate over the items and match against the query.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Ignore items which are not visible.\n let item = items[i];\n if (!item.isVisible) {\n continue;\n }\n\n // If the query is empty, all items are matched by default.\n if (!query) {\n scores.push({\n matchType: MatchType.Default,\n categoryIndices: null,\n labelIndices: null,\n score: 0,\n item\n });\n continue;\n }\n\n // Run the fuzzy search for the item and query.\n let score = fuzzySearch(item, query);\n\n // Ignore the item if it is not a match.\n if (!score) {\n continue;\n }\n\n // Penalize disabled items.\n // TODO - push disabled items all the way down in sort cmp?\n if (!item.isEnabled) {\n score.score += 1000;\n }\n\n // Add the score to the results.\n scores.push(score);\n }\n\n // Return the final array of scores.\n return scores;\n }\n\n /**\n * Perform a fuzzy search on a single command item.\n */\n function fuzzySearch(\n item: CommandPalette.IItem,\n query: string\n ): IScore | null {\n // Create the source text to be searched.\n let category = item.category.toLowerCase();\n let label = item.label.toLowerCase();\n let source = `${category} ${label}`;\n\n // Set up the match score and indices array.\n let score = Infinity;\n let indices: number[] | null = null;\n\n // The regex for search word boundaries\n let rgx = /\\b\\w/g;\n\n // Search the source by word boundary.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Find the next word boundary in the source.\n let rgxMatch = rgx.exec(source);\n\n // Break if there is no more source context.\n if (!rgxMatch) {\n break;\n }\n\n // Run the string match on the relevant substring.\n let match = StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n\n // Break if there is no match.\n if (!match) {\n break;\n }\n\n // Update the match if the score is better.\n if (match.score <= score) {\n score = match.score;\n indices = match.indices;\n }\n }\n\n // Bail if there was no match.\n if (!indices || score === Infinity) {\n return null;\n }\n\n // Compute the pivot index between category and label text.\n let pivot = category.length + 1;\n\n // Find the slice index to separate matched indices.\n let j = ArrayExt.lowerBound(indices, pivot, (a, b) => a - b);\n\n // Extract the matched category and label indices.\n let categoryIndices = indices.slice(0, j);\n let labelIndices = indices.slice(j);\n\n // Adjust the label indices for the pivot offset.\n for (let i = 0, n = labelIndices.length; i < n; ++i) {\n labelIndices[i] -= pivot;\n }\n\n // Handle a pure label match.\n if (categoryIndices.length === 0) {\n return {\n matchType: MatchType.Label,\n categoryIndices: null,\n labelIndices,\n score,\n item\n };\n }\n\n // Handle a pure category match.\n if (labelIndices.length === 0) {\n return {\n matchType: MatchType.Category,\n categoryIndices,\n labelIndices: null,\n score,\n item\n };\n }\n\n // Handle a split match.\n return {\n matchType: MatchType.Split,\n categoryIndices,\n labelIndices,\n score,\n item\n };\n }\n\n /**\n * A sort comparison function for a match score.\n */\n function scoreCmp(a: IScore, b: IScore): number {\n // First compare based on the match type\n let m1 = a.matchType - b.matchType;\n if (m1 !== 0) {\n return m1;\n }\n\n // Otherwise, compare based on the match score.\n let d1 = a.score - b.score;\n if (d1 !== 0) {\n return d1;\n }\n\n // Find the match index based on the match type.\n let i1 = 0;\n let i2 = 0;\n switch (a.matchType) {\n case MatchType.Label:\n i1 = a.labelIndices![0];\n i2 = b.labelIndices![0];\n break;\n case MatchType.Category:\n case MatchType.Split:\n i1 = a.categoryIndices![0];\n i2 = b.categoryIndices![0];\n break;\n }\n\n // Compare based on the match index.\n if (i1 !== i2) {\n return i1 - i2;\n }\n\n // Otherwise, compare by category.\n let d2 = a.item.category.localeCompare(b.item.category);\n if (d2 !== 0) {\n return d2;\n }\n\n // Otherwise, compare by rank.\n let r1 = a.item.rank;\n let r2 = b.item.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity safe\n }\n\n // Finally, compare by label.\n return a.item.label.localeCompare(b.item.label);\n }\n\n /**\n * Create the results from an array of sorted scores.\n */\n function createResults(scores: IScore[]): SearchResult[] {\n // Set up the search results array.\n let results: SearchResult[] = [];\n\n // Iterate over each score in the array.\n for (let i = 0, n = scores.length; i < n; ++i) {\n // Extract the current item and indices.\n let { item, categoryIndices, labelIndices } = scores[i];\n\n // Extract the category for the current item.\n let category = item.category;\n\n // Is this the same category as the preceding result?\n if (i === 0 || category !== scores[i - 1].item.category) {\n // Add the header result for the category.\n results.push({ type: 'header', category, indices: categoryIndices });\n }\n\n // Create the item result for the score.\n results.push({ type: 'item', item, indices: labelIndices });\n }\n\n // Return the final results.\n return results;\n }\n\n /**\n * A concrete implementation of `CommandPalette.IItem`.\n */\n class CommandItem implements CommandPalette.IItem {\n /**\n * Construct a new command item.\n */\n constructor(\n commands: CommandRegistry,\n options: CommandPalette.IItemOptions\n ) {\n this._commands = commands;\n this.category = normalizeCategory(options.category);\n this.command = options.command;\n this.args = options.args || JSONExt.emptyObject;\n this.rank = options.rank !== undefined ? options.rank : Infinity;\n }\n\n /**\n * The category for the command item.\n */\n readonly category: string;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The rank for the command item.\n */\n readonly rank: number;\n\n /**\n * The display label for the command item.\n */\n get label(): string {\n return this._commands.label(this.command, this.args);\n }\n\n /**\n * The icon renderer for the command item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n return this._commands.icon(this.command, this.args);\n }\n\n /**\n * The icon class for the command item.\n */\n get iconClass(): string {\n return this._commands.iconClass(this.command, this.args);\n }\n\n /**\n * The icon label for the command item.\n */\n get iconLabel(): string {\n return this._commands.iconLabel(this.command, this.args);\n }\n\n /**\n * The display caption for the command item.\n */\n get caption(): string {\n return this._commands.caption(this.command, this.args);\n }\n\n /**\n * The extra class name for the command item.\n */\n get className(): string {\n return this._commands.className(this.command, this.args);\n }\n\n /**\n * The dataset for the command item.\n */\n get dataset(): CommandRegistry.Dataset {\n return this._commands.dataset(this.command, this.args);\n }\n\n /**\n * Whether the command item is enabled.\n */\n get isEnabled(): boolean {\n return this._commands.isEnabled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggled.\n */\n get isToggled(): boolean {\n return this._commands.isToggled(this.command, this.args);\n }\n\n /**\n * Whether the command item is toggleable.\n */\n get isToggleable(): boolean {\n return this._commands.isToggleable(this.command, this.args);\n }\n\n /**\n * Whether the command item is visible.\n */\n get isVisible(): boolean {\n return this._commands.isVisible(this.command, this.args);\n }\n\n /**\n * The key binding for the command item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { JSONExt, ReadonlyJSONObject } from '@lumino/coreutils';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ARIAAttrNames,\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Widget } from './widget';\n\ninterface IWindowData {\n pageXOffset: number;\n pageYOffset: number;\n clientWidth: number;\n clientHeight: number;\n}\n\n/**\n * A widget which displays items as a canonical menu.\n */\nexport class Menu extends Widget {\n /**\n * Construct a new menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: Menu.IOptions) {\n super({ node: Private.createNode() });\n this.addClass('lm-Menu');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.commands = options.commands;\n this.renderer = options.renderer || Menu.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the menu.\n */\n dispose(): void {\n this.close();\n this._items.length = 0;\n super.dispose();\n }\n\n /**\n * A signal emitted just before the menu is closed.\n *\n * #### Notes\n * This signal is emitted when the menu receives a `'close-request'`\n * message, just before it removes itself from the DOM.\n *\n * This signal is not emitted if the menu is already detached from\n * the DOM when it receives the `'close-request'` message.\n */\n get aboutToClose(): ISignal {\n return this._aboutToClose;\n }\n\n /**\n * A signal emitted when a new menu is requested by the user.\n *\n * #### Notes\n * This signal is emitted whenever the user presses the right or left\n * arrow keys, and a submenu cannot be opened or closed in response.\n *\n * This signal is useful when implementing menu bars in order to open\n * the next or previous menu in response to a user key press.\n *\n * This signal is only emitted for the root menu in a hierarchy.\n */\n get menuRequested(): ISignal {\n return this._menuRequested;\n }\n\n /**\n * The command registry used by the menu.\n */\n readonly commands: CommandRegistry;\n\n /**\n * The renderer used by the menu.\n */\n readonly renderer: Menu.IRenderer;\n\n /**\n * The parent menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu is an open submenu.\n */\n get parentMenu(): Menu | null {\n return this._parentMenu;\n }\n\n /**\n * The child menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu has an open submenu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The root menu of the menu hierarchy.\n */\n get rootMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._parentMenu) {\n menu = menu._parentMenu;\n }\n return menu;\n }\n\n /**\n * The leaf menu of the menu hierarchy.\n */\n get leafMenu(): Menu {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let menu: Menu = this;\n while (menu._childMenu) {\n menu = menu._childMenu;\n }\n return menu;\n }\n\n /**\n * The menu content node.\n *\n * #### Notes\n * This is the node which holds the menu item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-Menu-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu item.\n */\n get activeItem(): Menu.IItem | null {\n return this._items[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the item will be set to `null`.\n */\n set activeItem(value: Menu.IItem | null) {\n this.activeIndex = value ? this._items.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu item.\n *\n * #### Notes\n * This will be `-1` if no menu item is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._items.length) {\n value = -1;\n }\n\n // Ensure the item can be activated.\n if (value !== -1 && !Private.canActivate(this._items[value])) {\n value = -1;\n }\n\n // Bail if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Make active element in focus\n if (\n this._activeIndex >= 0 &&\n this.contentNode.childNodes[this._activeIndex]\n ) {\n (this.contentNode.childNodes[this._activeIndex] as HTMLElement).focus();\n }\n\n // schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menu items in the menu.\n */\n get items(): ReadonlyArray {\n return this._items;\n }\n\n /**\n * Activate the next selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activateNextItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai < n - 1 ? ai + 1 : 0;\n let stop = start === 0 ? n - 1 : start - 1;\n this.activeIndex = ArrayExt.findFirstIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Activate the previous selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n activatePreviousItem(): void {\n let n = this._items.length;\n let ai = this._activeIndex;\n let start = ai <= 0 ? n - 1 : ai - 1;\n let stop = start === n - 1 ? 0 : start + 1;\n this.activeIndex = ArrayExt.findLastIndex(\n this._items,\n Private.canActivate,\n start,\n stop\n );\n }\n\n /**\n * Trigger the active menu item.\n *\n * #### Notes\n * If the active item is a submenu, it will be opened and the first\n * item will be activated.\n *\n * If the active item is a command, the command will be executed.\n *\n * If the menu is not attached, this is a no-op.\n *\n * If there is no active item, this is a no-op.\n */\n triggerActiveItem(): void {\n // Bail if the menu is not attached.\n if (!this.isAttached) {\n return;\n }\n\n // Bail if there is no active item.\n let item = this.activeItem;\n if (!item) {\n return;\n }\n\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // If the item is a submenu, open it.\n if (item.type === 'submenu') {\n this._openChildMenu(true);\n return;\n }\n\n // Close the root menu before executing the command.\n this.rootMenu.close();\n\n // Execute the command for the item.\n let { command, args } = item;\n if (this.commands.isEnabled(command, args)) {\n this.commands.execute(command, args);\n } else {\n console.log(`Command '${command}' is disabled.`);\n }\n }\n\n /**\n * Add a menu item to the end of the menu.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n */\n addItem(options: Menu.IItemOptions): Menu.IItem {\n return this.insertItem(this._items.length, options);\n }\n\n /**\n * Insert a menu item into the menu at the specified index.\n *\n * @param index - The index at which to insert the item.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n *\n * #### Notes\n * The index will be clamped to the bounds of the items.\n */\n insertItem(index: number, options: Menu.IItemOptions): Menu.IItem {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Clamp the insert index to the array bounds.\n let i = Math.max(0, Math.min(index, this._items.length));\n\n // Create the item for the options.\n let item = Private.createItem(this, options);\n\n // Insert the item into the array.\n ArrayExt.insert(this._items, i, item);\n\n // Schedule an update of the items.\n this.update();\n\n // Return the item added to the menu.\n return item;\n }\n\n /**\n * Remove an item from the menu.\n *\n * @param item - The item to remove from the menu.\n *\n * #### Notes\n * This is a no-op if the item is not in the menu.\n */\n removeItem(item: Menu.IItem): void {\n this.removeItemAt(this._items.indexOf(item));\n }\n\n /**\n * Remove the item at a given index from the menu.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeItemAt(index: number): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Remove the item from the array.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Remove all menu items from the menu.\n */\n clearItems(): void {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n\n // Clear the items.\n this._items.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Open the menu at the specified location.\n *\n * @param x - The client X coordinate of the menu location.\n *\n * @param y - The client Y coordinate of the menu location.\n *\n * @param options - The additional options for opening the menu.\n *\n * #### Notes\n * The menu will be opened at the given location unless it will not\n * fully fit on the screen. If it will not fit, it will be adjusted\n * to fit naturally on the screen.\n *\n * The menu will be attached under the `host` element in the DOM\n * (or `document.body` if `host` is `null`) and before the `ref`\n * element (or as the last child of `host` if `ref` is `null`).\n * The menu may be displayed outside of the `host` element\n * following the rules of CSS absolute positioning.\n *\n * This is a no-op if the menu is already attached to the DOM.\n */\n open(x: number, y: number, options: Menu.IOpenOptions = {}): void {\n // Bail early if the menu is already attached.\n if (this.isAttached) {\n return;\n }\n\n // Extract the menu options.\n let forceX = options.forceX || false;\n let forceY = options.forceY || false;\n const host = options.host ?? null;\n const ref = options.ref ?? null;\n\n // Open the menu as a root menu.\n Private.openRootMenu(this, x, y, forceX, forceY, host, ref);\n\n // Activate the menu to accept keyboard input.\n this.activate();\n }\n\n /**\n * Handle the DOM events for the menu.\n *\n * @param event - The DOM event sent to the menu.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu's DOM nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseenter':\n this._evtMouseEnter(event as MouseEvent);\n break;\n case 'mouseleave':\n this._evtMouseLeave(event as MouseEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mouseup', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseenter', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('contextmenu', this);\n this.node.ownerDocument.addEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mouseup', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseenter', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('contextmenu', this);\n this.node.ownerDocument.removeEventListener('mousedown', this, true);\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this.node.focus();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let items = this._items;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let collapsedFlags = Private.computeCollapsed(items);\n let content = new Array(items.length);\n for (let i = 0, n = items.length; i < n; ++i) {\n let item = items[i];\n let active = i === activeIndex;\n let collapsed = collapsedFlags[i];\n content[i] = renderer.renderItem({\n item,\n active,\n collapsed,\n onfocus: () => {\n this.activeIndex = i;\n }\n });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n */\n protected onCloseRequest(msg: Message): void {\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n\n // Reset the active index.\n this.activeIndex = -1;\n\n // Close any open child menu.\n let childMenu = this._childMenu;\n if (childMenu) {\n this._childIndex = -1;\n this._childMenu = null;\n childMenu._parentMenu = null;\n childMenu.close();\n }\n\n // Remove this menu from its parent and activate the parent.\n let parentMenu = this._parentMenu;\n if (parentMenu) {\n this._parentMenu = null;\n parentMenu._childIndex = -1;\n parentMenu._childMenu = null;\n parentMenu.activate();\n }\n\n // Emit the `aboutToClose` signal if the menu is attached.\n if (this.isAttached) {\n this._aboutToClose.emit(undefined);\n }\n\n // Finish closing the menu.\n super.onCloseRequest(msg);\n }\n\n /**\n * Handle the `'keydown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // A menu handles all keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Enter\n if (kc === 13) {\n this.triggerActiveItem();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this.close();\n return;\n }\n\n // Left Arrow\n if (kc === 37) {\n if (this._parentMenu) {\n this.close();\n } else {\n this._menuRequested.emit('previous');\n }\n return;\n }\n\n // Up Arrow\n if (kc === 38) {\n this.activatePreviousItem();\n return;\n }\n\n // Right Arrow\n if (kc === 39) {\n let item = this.activeItem;\n if (item && item.type === 'submenu') {\n this.triggerActiveItem();\n } else {\n this.rootMenu._menuRequested.emit('next');\n }\n return;\n }\n\n // Down Arrow\n if (kc === 40) {\n this.activateNextItem();\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._items, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that item is triggered.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.triggerActiveItem();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n }\n }\n\n /**\n * Handle the `'mouseup'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseUp(event: MouseEvent): void {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.triggerActiveItem();\n }\n\n /**\n * Handle the `'mousemove'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Hit test the item nodes for the item under the mouse.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the mouse is already over the active index.\n if (index === this._activeIndex) {\n return;\n }\n\n // Update and coerce the active index.\n this.activeIndex = index;\n index = this.activeIndex;\n\n // If the index is the current child index, cancel the timers.\n if (index === this._childIndex) {\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n return;\n }\n\n // If a child menu is currently open, start the close timer.\n if (this._childIndex !== -1) {\n this._startCloseTimer();\n }\n\n // Cancel the open timer to give a full delay for opening.\n this._cancelOpenTimer();\n\n // Bail if the active item is not a valid submenu item.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n return;\n }\n\n // Start the open timer to open the active item submenu.\n this._startOpenTimer();\n }\n\n /**\n * Handle the `'mouseenter'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseEnter(event: MouseEvent): void {\n // Synchronize the active ancestor items.\n for (let menu = this._parentMenu; menu; menu = menu._parentMenu) {\n menu._cancelOpenTimer();\n menu._cancelCloseTimer();\n menu.activeIndex = menu._childIndex;\n }\n }\n\n /**\n * Handle the `'mouseleave'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n private _evtMouseLeave(event: MouseEvent): void {\n // Cancel any pending submenu opening.\n this._cancelOpenTimer();\n\n // If there is no open child menu, just reset the active index.\n if (!this._childMenu) {\n this.activeIndex = -1;\n return;\n }\n\n // If the mouse is over the child menu, cancel the close timer.\n let { clientX, clientY } = event;\n if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n this._cancelCloseTimer();\n return;\n }\n\n // Otherwise, reset the active index and start the close timer.\n this.activeIndex = -1;\n this._startCloseTimer();\n }\n\n /**\n * Handle the `'mousedown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the document node.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the menu is not a root menu.\n if (this._parentMenu) {\n return;\n }\n\n // The mouse button which is pressed is irrelevant. If the press\n // is not on a menu, the entire hierarchy is closed and the event\n // is allowed to propagate. This allows other code to act on the\n // event, such as focusing the clicked element.\n if (Private.hitTestMenus(this, event.clientX, event.clientY)) {\n event.preventDefault();\n event.stopPropagation();\n } else {\n this.close();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if the active item is not a valid submenu.\n */\n private _openChildMenu(activateFirst = false): void {\n // If the item is not a valid submenu, close the child menu.\n let item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n this._closeChildMenu();\n return;\n }\n\n // Do nothing if the child menu will not change.\n let submenu = item.submenu;\n if (submenu === this._childMenu) {\n return;\n }\n\n // Prior to any DOM modifications save window data\n Menu.saveWindowData();\n\n // Ensure the current child menu is closed.\n this._closeChildMenu();\n\n // Update the private child state.\n this._childMenu = submenu;\n this._childIndex = this._activeIndex;\n\n // Set the parent menu reference for the child.\n submenu._parentMenu = this;\n\n // Ensure the menu is updated and lookup the item node.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n let itemNode = this.contentNode.children[this._activeIndex];\n\n // Open the submenu at the active node.\n Private.openSubmenu(submenu, itemNode as HTMLElement);\n\n // Activate the first item if desired.\n if (activateFirst) {\n submenu.activeIndex = -1;\n submenu.activateNextItem();\n }\n\n // Activate the child menu.\n submenu.activate();\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n if (this._childMenu) {\n this._childMenu.close();\n }\n }\n\n /**\n * Start the open timer, unless it is already pending.\n */\n private _startOpenTimer(): void {\n if (this._openTimerID === 0) {\n this._openTimerID = window.setTimeout(() => {\n this._openTimerID = 0;\n this._openChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Start the close timer, unless it is already pending.\n */\n private _startCloseTimer(): void {\n if (this._closeTimerID === 0) {\n this._closeTimerID = window.setTimeout(() => {\n this._closeTimerID = 0;\n this._closeChildMenu();\n }, Private.TIMER_DELAY);\n }\n }\n\n /**\n * Cancel the open timer, if the timer is pending.\n */\n private _cancelOpenTimer(): void {\n if (this._openTimerID !== 0) {\n clearTimeout(this._openTimerID);\n this._openTimerID = 0;\n }\n }\n\n /**\n * Cancel the close timer, if the timer is pending.\n */\n private _cancelCloseTimer(): void {\n if (this._closeTimerID !== 0) {\n clearTimeout(this._closeTimerID);\n this._closeTimerID = 0;\n }\n }\n\n /**\n * Save window data used for menu positioning in transient cache.\n *\n * In order to avoid layout trashing it is recommended to invoke this\n * method immediately prior to opening the menu and any DOM modifications\n * (like closing previously visible menu, or adding a class to menu widget).\n *\n * The transient cache will be released upon `open()` call.\n */\n static saveWindowData(): void {\n Private.saveWindowData();\n }\n\n private _childIndex = -1;\n private _activeIndex = -1;\n private _openTimerID = 0;\n private _closeTimerID = 0;\n private _items: Menu.IItem[] = [];\n private _childMenu: Menu | null = null;\n private _parentMenu: Menu | null = null;\n private _aboutToClose = new Signal(this);\n private _menuRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `Menu` class statics.\n */\nexport namespace Menu {\n /**\n * An options object for creating a menu.\n */\n export interface IOptions {\n /**\n * The command registry for use with the menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the menu.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * An options object for the `open` method on a menu.\n */\n export interface IOpenOptions {\n /**\n * Whether to force the X position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * X coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceX?: boolean;\n\n /**\n * Whether to force the Y position of the menu.\n *\n * Setting to `true` will disable the logic which repositions the\n * Y coordinate of the menu if it will not fit entirely on screen.\n *\n * The default is `false`.\n */\n forceY?: boolean;\n\n /**\n * The DOM node to use as the menu's host.\n *\n * If not specified then uses `document.body`.\n */\n host?: HTMLElement;\n\n /**\n * The child of `host` to use as the reference element.\n * If this is provided, the menu will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * menu to be added as the last child of the host.\n */\n ref?: HTMLElement;\n }\n\n /**\n * A type alias for a menu item type.\n */\n export type ItemType = 'command' | 'submenu' | 'separator';\n\n /**\n * An options object for creating a menu item.\n */\n export interface IItemOptions {\n /**\n * The type of the menu item.\n *\n * The default value is `'command'`.\n */\n type?: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n *\n * The default value is an empty string.\n */\n command?: string;\n\n /**\n * The arguments for the command.\n *\n * The default value is an empty object.\n */\n args?: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n *\n * The default value is `null`.\n */\n submenu?: Menu | null;\n }\n\n /**\n * An object which represents a menu item.\n *\n * #### Notes\n * Item objects are created automatically by a menu.\n */\n export interface IItem {\n /**\n * The type of the menu item.\n */\n readonly type: ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n readonly label: string;\n\n /**\n * The mnemonic index for the menu item.\n */\n readonly mnemonic: number;\n\n /**\n * The icon renderer for the menu item.\n */\n readonly icon: VirtualElement.IRenderer | undefined;\n\n /**\n * The icon class for the menu item.\n */\n readonly iconClass: string;\n\n /**\n * The icon label for the menu item.\n */\n readonly iconLabel: string;\n\n /**\n * The display caption for the menu item.\n */\n readonly caption: string;\n\n /**\n * The extra class name for the menu item.\n */\n readonly className: string;\n\n /**\n * The dataset for the menu item.\n */\n readonly dataset: CommandRegistry.Dataset;\n\n /**\n * Whether the menu item is enabled.\n */\n readonly isEnabled: boolean;\n\n /**\n * Whether the menu item is toggled.\n */\n readonly isToggled: boolean;\n\n /**\n * Whether the menu item is visible.\n */\n readonly isVisible: boolean;\n\n /**\n * The key binding for the menu item.\n */\n readonly keyBinding: CommandRegistry.IKeyBinding | null;\n }\n\n /**\n * An object which holds the data to render a menu item.\n */\n export interface IRenderData {\n /**\n * The item to be rendered.\n */\n readonly item: IItem;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the item should be collapsed.\n */\n readonly collapsed: boolean;\n\n /**\n * Handler for when element is in focus.\n */\n readonly onfocus?: () => void;\n }\n\n /**\n * A renderer for use with a menu.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n tabindex: '0',\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderShortcut(data),\n this.renderSubmenu(data)\n );\n }\n\n /**\n * Render the icon element for a menu item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.item.icon is undefined, it will be ignored.\n return h.div({ className }, data.item.icon!, data.item.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-Menu-itemLabel' }, content);\n }\n\n /**\n * Render the shortcut element for a menu item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the item shortcut.\n */\n renderShortcut(data: IRenderData): VirtualElement {\n let content = this.formatShortcut(data);\n return h.div({ className: 'lm-Menu-itemShortcut' }, content);\n }\n\n /**\n * Render the submenu icon element for a menu item.\n *\n * @param data - The data to use for rendering the submenu icon.\n *\n * @returns A virtual element representing the submenu icon.\n */\n renderSubmenu(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-Menu-itemSubmenuIcon' });\n }\n\n /**\n * Create the class name for the menu item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n // Setup the initial class name.\n let name = 'lm-Menu-item';\n\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n }\n if (!data.item.isVisible) {\n name += ' lm-mod-hidden';\n }\n if (data.active) {\n name += ' lm-mod-active';\n }\n if (data.collapsed) {\n name += ' lm-mod-collapsed';\n }\n\n // Add the extra class.\n let extra = data.item.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Create the dataset for the menu item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the menu item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n let result: ElementDataset;\n let { type, command, dataset } = data.item;\n if (type === 'command') {\n result = { ...dataset, type, command };\n } else {\n result = { ...dataset, type };\n }\n return result;\n }\n\n /**\n * Create the class name for the menu item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-Menu-itemIcon';\n let extra = data.item.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the aria attributes for menu item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n let aria: { [T in ARIAAttrNames]?: string } = {};\n switch (data.item.type) {\n case 'separator':\n aria.role = 'presentation';\n break;\n case 'submenu':\n aria['aria-haspopup'] = 'true';\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n break;\n default:\n if (!data.item.isEnabled) {\n aria['aria-disabled'] = 'true';\n }\n aria.role = 'menuitem';\n }\n return aria;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.item;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-Menu-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n\n /**\n * Create the render content for the shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n formatShortcut(data: IRenderData): h.Child {\n let kb = data.item.keyBinding;\n return kb ? CommandRegistry.formatKeystroke(kb.keys) : null;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The ms delay for opening and closing a submenu.\n */\n export const TIMER_DELAY = 300;\n\n /**\n * The horizontal pixel overlap for an open submenu.\n */\n export const SUBMENU_OVERLAP = 3;\n\n let transientWindowDataCache: IWindowData | null = null;\n let transientCacheCounter: number = 0;\n\n function getWindowData(): IWindowData {\n // if transient cache is in use, take one from it\n if (transientCacheCounter > 0) {\n transientCacheCounter--;\n return transientWindowDataCache!;\n }\n return _getWindowData();\n }\n\n /**\n * Store window data in transient cache.\n *\n * The transient cache will be released upon `getWindowData()` call.\n * If this function is called multiple times, the cache will be\n * retained until as many calls to `getWindowData()` were made.\n *\n * Note: should be called before any DOM modifications.\n */\n export function saveWindowData(): void {\n transientWindowDataCache = _getWindowData();\n transientCacheCounter++;\n }\n\n /**\n * Create the DOM node for a menu.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-Menu-content';\n node.appendChild(content);\n content.setAttribute('role', 'menu');\n node.tabIndex = 0;\n return node;\n }\n\n /**\n * Test whether a menu item can be activated.\n */\n export function canActivate(item: Menu.IItem): boolean {\n return item.type !== 'separator' && item.isEnabled && item.isVisible;\n }\n\n /**\n * Create a new menu item for an owner menu.\n */\n export function createItem(\n owner: Menu,\n options: Menu.IItemOptions\n ): Menu.IItem {\n return new MenuItem(owner.commands, options);\n }\n\n /**\n * Hit test a menu hierarchy starting at the given root.\n */\n export function hitTestMenus(menu: Menu, x: number, y: number): boolean {\n for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {\n if (ElementExt.hitTest(temp.node, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Compute which extra separator items should be collapsed.\n */\n export function computeCollapsed(\n items: ReadonlyArray\n ): boolean[] {\n // Allocate the return array and fill it with `false`.\n let result = new Array(items.length);\n ArrayExt.fill(result, false);\n\n // Collapse the leading separators.\n let k1 = 0;\n let n = items.length;\n for (; k1 < n; ++k1) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k1] = true;\n }\n\n // Hide the trailing separators.\n let k2 = n - 1;\n for (; k2 >= 0; --k2) {\n let item = items[k2];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k2] = true;\n }\n\n // Hide the remaining consecutive separators.\n let hide = false;\n while (++k1 < k2) {\n let item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n hide = false;\n } else if (hide) {\n result[k1] = true;\n } else {\n hide = true;\n }\n }\n\n // Return the resulting flags.\n return result;\n }\n\n function _getWindowData(): IWindowData {\n return {\n pageXOffset: window.pageXOffset,\n pageYOffset: window.pageYOffset,\n clientWidth: document.documentElement.clientWidth,\n clientHeight: document.documentElement.clientHeight\n };\n }\n\n /**\n * Open a menu as a root menu at the target location.\n */\n export function openRootMenu(\n menu: Menu,\n x: number,\n y: number,\n forceX: boolean,\n forceY: boolean,\n host: HTMLElement | null,\n ref: HTMLElement | null\n ): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before attaching and measuring.\n MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch - (forceY ? y : 0);\n\n // Fetch common variables.\n let node = menu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(menu, host || document.body, ref);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Adjust the X position of the menu to fit on-screen.\n if (!forceX && x + width > px + cw) {\n x = px + cw - width;\n }\n\n // Adjust the Y position of the menu to fit on-screen.\n if (!forceY && y + height > py + ch) {\n if (y > py + ch) {\n y = py + ch - height;\n } else {\n y = y - height;\n }\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * Open a menu as a submenu using an item node for positioning.\n */\n export function openSubmenu(submenu: Menu, itemNode: HTMLElement): void {\n // Get the current position and size of the main viewport.\n const windowData = getWindowData();\n let px = windowData.pageXOffset;\n let py = windowData.pageYOffset;\n let cw = windowData.clientWidth;\n let ch = windowData.clientHeight;\n\n // Ensure the menu is updated before opening.\n MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n\n // Compute the maximum allowed height for the menu.\n let maxHeight = ch;\n\n // Fetch common variables.\n let node = submenu.node;\n let style = node.style;\n\n // Clear the menu geometry and prepare it for measuring.\n style.opacity = '0';\n style.maxHeight = `${maxHeight}px`;\n\n // Attach the menu to the document.\n Widget.attach(submenu, itemNode.ownerDocument.body);\n\n // Measure the size of the menu.\n let { width, height } = node.getBoundingClientRect();\n\n // Compute the box sizing for the menu.\n let box = ElementExt.boxSizing(submenu.node);\n\n // Get the bounding rect for the target item node.\n let itemRect = itemNode.getBoundingClientRect();\n\n // Compute the target X position.\n let x = itemRect.right - SUBMENU_OVERLAP;\n\n // Adjust the X position to fit on the screen.\n if (x + width > px + cw) {\n x = itemRect.left + SUBMENU_OVERLAP - width;\n }\n\n // Compute the target Y position.\n let y = itemRect.top - box.borderTop - box.paddingTop;\n\n // Adjust the Y position to fit on the screen.\n if (y + height > py + ch) {\n y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n }\n\n // Update the position of the menu to the computed position.\n style.transform = `translate(${Math.max(0, x)}px, ${Math.max(0, y)}px`;\n\n // Finally, make the menu visible on the screen.\n style.opacity = '1';\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n items: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Lookup the item\n let item = items[k];\n\n // Ignore items which cannot be activated.\n if (!canActivate(item)) {\n continue;\n }\n\n // Ignore items with an empty label.\n let label = item.label;\n if (label.length === 0) {\n continue;\n }\n\n // Lookup the mnemonic index for the label.\n let mn = item.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < label.length) {\n if (label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n\n /**\n * A concrete implementation of `Menu.IItem`.\n */\n class MenuItem implements Menu.IItem {\n /**\n * Construct a new menu item.\n */\n constructor(commands: CommandRegistry, options: Menu.IItemOptions) {\n this._commands = commands;\n this.type = options.type || 'command';\n this.command = options.command || '';\n this.args = options.args || JSONExt.emptyObject;\n this.submenu = options.submenu || null;\n }\n\n /**\n * The type of the menu item.\n */\n readonly type: Menu.ItemType;\n\n /**\n * The command to execute when the item is triggered.\n */\n readonly command: string;\n\n /**\n * The arguments for the command.\n */\n readonly args: ReadonlyJSONObject;\n\n /**\n * The submenu for a `'submenu'` type item.\n */\n readonly submenu: Menu | null;\n\n /**\n * The display label for the menu item.\n */\n get label(): string {\n if (this.type === 'command') {\n return this._commands.label(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.label;\n }\n return '';\n }\n\n /**\n * The mnemonic index for the menu item.\n */\n get mnemonic(): number {\n if (this.type === 'command') {\n return this._commands.mnemonic(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.mnemonic;\n }\n return -1;\n }\n\n /**\n * The icon renderer for the menu item.\n */\n get icon(): VirtualElement.IRenderer | undefined {\n if (this.type === 'command') {\n return this._commands.icon(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.icon;\n }\n return undefined;\n }\n\n /**\n * The icon class for the menu item.\n */\n get iconClass(): string {\n if (this.type === 'command') {\n return this._commands.iconClass(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconClass;\n }\n return '';\n }\n\n /**\n * The icon label for the menu item.\n */\n get iconLabel(): string {\n if (this.type === 'command') {\n return this._commands.iconLabel(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconLabel;\n }\n return '';\n }\n\n /**\n * The display caption for the menu item.\n */\n get caption(): string {\n if (this.type === 'command') {\n return this._commands.caption(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.caption;\n }\n return '';\n }\n\n /**\n * The extra class name for the menu item.\n */\n get className(): string {\n if (this.type === 'command') {\n return this._commands.className(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.className;\n }\n return '';\n }\n\n /**\n * The dataset for the menu item.\n */\n get dataset(): CommandRegistry.Dataset {\n if (this.type === 'command') {\n return this._commands.dataset(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.dataset;\n }\n return {};\n }\n\n /**\n * Whether the menu item is enabled.\n */\n get isEnabled(): boolean {\n if (this.type === 'command') {\n return this._commands.isEnabled(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * Whether the menu item is toggled.\n */\n get isToggled(): boolean {\n if (this.type === 'command') {\n return this._commands.isToggled(this.command, this.args);\n }\n return false;\n }\n\n /**\n * Whether the menu item is visible.\n */\n get isVisible(): boolean {\n if (this.type === 'command') {\n return this._commands.isVisible(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n }\n\n /**\n * The key binding for the menu item.\n */\n get keyBinding(): CommandRegistry.IKeyBinding | null {\n if (this.type === 'command') {\n let { command, args } = this;\n return (\n ArrayExt.findLastValue(this._commands.keyBindings, kb => {\n return kb.command === command && JSONExt.deepEqual(kb.args, args);\n }) || null\n );\n }\n return null;\n }\n\n private _commands: CommandRegistry;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport { DisposableDelegate, IDisposable } from '@lumino/disposable';\n\nimport { Selector } from '@lumino/domutils';\n\nimport { Menu } from './menu';\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nexport class ContextMenu {\n /**\n * Construct a new context menu.\n *\n * @param options - The options for initializing the menu.\n */\n constructor(options: ContextMenu.IOptions) {\n const { groupByTarget, sortBySelector, ...others } = options;\n this.menu = new Menu(others);\n this._groupByTarget = groupByTarget !== false;\n this._sortBySelector = sortBySelector !== false;\n }\n\n /**\n * The menu widget which displays the matched context items.\n */\n readonly menu: Menu;\n\n /**\n * Add an item to the context menu.\n *\n * @param options - The options for creating the item.\n *\n * @returns A disposable which will remove the item from the menu.\n */\n addItem(options: ContextMenu.IItemOptions): IDisposable {\n // Create an item from the given options.\n let item = Private.createItem(options, this._idTick++);\n\n // Add the item to the internal array.\n this._items.push(item);\n\n // Return a disposable which will remove the item.\n return new DisposableDelegate(() => {\n ArrayExt.removeFirstOf(this._items, item);\n });\n }\n\n /**\n * Open the context menu in response to a `'contextmenu'` event.\n *\n * @param event - The `'contextmenu'` event of interest.\n *\n * @returns `true` if the menu was opened, or `false` if no items\n * matched the event and the menu was not opened.\n *\n * #### Notes\n * This method will populate the context menu with items which match\n * the propagation path of the event, then open the menu at the mouse\n * position indicated by the event.\n */\n open(event: MouseEvent): boolean {\n // Prior to any DOM modifications update the window data.\n Menu.saveWindowData();\n\n // Clear the current contents of the context menu.\n this.menu.clearItems();\n\n // Bail early if there are no items to match.\n if (this._items.length === 0) {\n return false;\n }\n\n // Find the matching items for the event.\n let items = Private.matchItems(\n this._items,\n event,\n this._groupByTarget,\n this._sortBySelector\n );\n\n // Bail if there are no matching items.\n if (!items || items.length === 0) {\n return false;\n }\n\n // Add the filtered items to the menu.\n for (const item of items) {\n this.menu.addItem(item);\n }\n\n // Open the context menu at the current mouse position.\n this.menu.open(event.clientX, event.clientY);\n\n // Indicate success.\n return true;\n }\n\n private _groupByTarget: boolean = true;\n private _idTick = 0;\n private _items: Private.IItem[] = [];\n private _sortBySelector: boolean = true;\n}\n\n/**\n * The namespace for the `ContextMenu` class statics.\n */\nexport namespace ContextMenu {\n /**\n * An options object for initializing a context menu.\n */\n export interface IOptions {\n /**\n * The command registry to use with the context menu.\n */\n commands: CommandRegistry;\n\n /**\n * A custom renderer for use with the context menu.\n */\n renderer?: Menu.IRenderer;\n\n /**\n * Whether to sort by selector and rank or only rank.\n *\n * Default true.\n */\n sortBySelector?: boolean;\n\n /**\n * Whether to group items following the DOM hierarchy.\n *\n * Default true.\n *\n * #### Note\n * If true, when the mouse event occurs on element `span` within `div.top`,\n * the items matching `div.top` will be shown before the ones matching `body`.\n */\n groupByTarget?: boolean;\n }\n\n /**\n * An options object for creating a context menu item.\n */\n export interface IItemOptions extends Menu.IItemOptions {\n /**\n * The CSS selector for the context menu item.\n *\n * The context menu item will only be displayed in the context menu\n * when the selector matches a node on the propagation path of the\n * contextmenu event. This allows the menu item to be restricted to\n * user-defined contexts.\n *\n * The selector must not contain commas.\n */\n selector: string;\n\n /**\n * The rank for the item.\n *\n * The rank is used as a tie-breaker when ordering context menu\n * items for display. Items are sorted in the following order:\n * 1. Depth in the DOM tree (deeper is better)\n * 2. Selector specificity (higher is better)\n * 3. Rank (lower is better)\n * 4. Insertion order\n *\n * The default rank is `Infinity`.\n */\n rank?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A normalized item for a context menu.\n */\n export interface IItem extends Menu.IItemOptions {\n /**\n * The selector for the item.\n */\n selector: string;\n\n /**\n * The rank for the item.\n */\n rank: number;\n\n /**\n * The tie-breaking id for the item.\n */\n id: number;\n }\n\n /**\n * Create a normalized context menu item from an options object.\n */\n export function createItem(\n options: ContextMenu.IItemOptions,\n id: number\n ): IItem {\n let selector = validateSelector(options.selector);\n let rank = options.rank !== undefined ? options.rank : Infinity;\n return { ...options, selector, rank, id };\n }\n\n /**\n * Find the items which match a context menu event.\n *\n * The results are sorted by DOM level, specificity, and rank.\n */\n export function matchItems(\n items: IItem[],\n event: MouseEvent,\n groupByTarget: boolean,\n sortBySelector: boolean\n ): IItem[] | null {\n // Look up the target of the event.\n let target = event.target as Element | null;\n\n // Bail if there is no target.\n if (!target) {\n return null;\n }\n\n // Look up the current target of the event.\n let currentTarget = event.currentTarget as Element | null;\n\n // Bail if there is no current target.\n if (!currentTarget) {\n return null;\n }\n\n // There are some third party libraries that cause the `target` to\n // be detached from the DOM before lumino can process the event.\n // If that happens, search for a new target node by point. If that\n // node is still dangling, bail.\n if (!currentTarget.contains(target)) {\n target = document.elementFromPoint(event.clientX, event.clientY);\n if (!target || !currentTarget.contains(target)) {\n return null;\n }\n }\n\n // Set up the result array.\n let result: IItem[] = [];\n\n // Copy the items array to allow in-place modification.\n let availableItems: Array = items.slice();\n\n // Walk up the DOM hierarchy searching for matches.\n while (target !== null) {\n // Set up the match array for this DOM level.\n let matches: IItem[] = [];\n\n // Search the remaining items for matches.\n for (let i = 0, n = availableItems.length; i < n; ++i) {\n // Fetch the item.\n let item = availableItems[i];\n\n // Skip items which are already consumed.\n if (!item) {\n continue;\n }\n\n // Skip items which do not match the element.\n if (!Selector.matches(target, item.selector)) {\n continue;\n }\n\n // Add the matched item to the result for this DOM level.\n matches.push(item);\n\n // Mark the item as consumed.\n availableItems[i] = null;\n }\n\n // Sort the matches for this level and add them to the results.\n if (matches.length !== 0) {\n if (groupByTarget) {\n matches.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n result.push(...matches);\n }\n\n // Stop searching at the limits of the DOM range.\n if (target === currentTarget) {\n break;\n }\n\n // Step to the parent DOM level.\n target = target.parentElement;\n }\n\n if (!groupByTarget) {\n result.sort(sortBySelector ? itemCmp : itemCmpRank);\n }\n\n // Return the matched and sorted results.\n return result;\n }\n\n /**\n * Validate the selector for a menu item.\n *\n * This returns the validated selector, or throws if the selector is\n * invalid or contains commas.\n */\n function validateSelector(selector: string): string {\n if (selector.indexOf(',') !== -1) {\n throw new Error(`Selector cannot contain commas: ${selector}`);\n }\n if (!Selector.isValid(selector)) {\n throw new Error(`Invalid selector: ${selector}`);\n }\n return selector;\n }\n\n /**\n * A sort comparison function for a context menu item by ranks.\n */\n function itemCmpRank(a: IItem, b: IItem): number {\n // Sort based on rank.\n let r1 = a.rank;\n let r2 = b.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity-safe\n }\n\n // When all else fails, sort by item id.\n return a.id - b.id;\n }\n\n /**\n * A sort comparison function for a context menu item by selectors and ranks.\n */\n function itemCmp(a: IItem, b: IItem): number {\n // Sort first based on selector specificity.\n let s1 = Selector.calculateSpecificity(a.selector);\n let s2 = Selector.calculateSpecificity(b.selector);\n if (s1 !== s2) {\n return s2 - s1;\n }\n\n // If specificities are equal\n return itemCmpRank(a, b);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport {\n ElementARIAAttrs,\n ElementBaseAttrs,\n ElementDataset,\n ElementInlineStyle,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\nconst ARROW_KEYS = [\n 'ArrowLeft',\n 'ArrowUp',\n 'ArrowRight',\n 'ArrowDown',\n 'Home',\n 'End'\n];\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nexport class TabBar extends Widget {\n /**\n * Construct a new tab bar.\n *\n * @param options - The options for initializing the tab bar.\n */\n constructor(options: TabBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-TabBar');\n this.contentNode.setAttribute('role', 'tablist');\n this.setFlag(Widget.Flag.DisallowLayout);\n this._document = options.document || document;\n this.tabsMovable = options.tabsMovable || false;\n this.titlesEditable = options.titlesEditable || false;\n this.allowDeselect = options.allowDeselect || false;\n this.addButtonEnabled = options.addButtonEnabled || false;\n this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n this.name = options.name || '';\n this.orientation = options.orientation || 'horizontal';\n this.removeBehavior = options.removeBehavior || 'select-tab-after';\n this.renderer = options.renderer || TabBar.defaultRenderer;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._releaseMouse();\n this._titles.length = 0;\n this._previousTitle = null;\n super.dispose();\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when a tab is moved by the user.\n *\n * #### Notes\n * This signal is emitted when a tab is moved by user interaction.\n *\n * This signal is not emitted when a tab is moved programmatically.\n */\n get tabMoved(): ISignal> {\n return this._tabMoved;\n }\n\n /**\n * A signal emitted when a tab is clicked by the user.\n *\n * #### Notes\n * If the clicked tab is not the current tab, the clicked tab will be\n * made current and the `currentChanged` signal will be emitted first.\n *\n * This signal is emitted even if the clicked tab is the current tab.\n */\n get tabActivateRequested(): ISignal<\n this,\n TabBar.ITabActivateRequestedArgs\n > {\n return this._tabActivateRequested;\n }\n\n /**\n * A signal emitted when the tab bar add button is clicked.\n */\n get addRequested(): ISignal {\n return this._addRequested;\n }\n\n /**\n * A signal emitted when a tab close icon is clicked.\n *\n * #### Notes\n * This signal is not emitted unless the tab title is `closable`.\n */\n get tabCloseRequested(): ISignal> {\n return this._tabCloseRequested;\n }\n\n /**\n * A signal emitted when a tab is dragged beyond the detach threshold.\n *\n * #### Notes\n * This signal is emitted when the user drags a tab with the mouse,\n * and mouse is dragged beyond the detach threshold.\n *\n * The consumer of the signal should call `releaseMouse` and remove\n * the tab in order to complete the detach.\n *\n * This signal is only emitted once per drag cycle.\n */\n get tabDetachRequested(): ISignal> {\n return this._tabDetachRequested;\n }\n\n /**\n * The renderer used by the tab bar.\n */\n readonly renderer: TabBar.IRenderer;\n\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n get document(): Document | ShadowRoot {\n return this._document;\n }\n\n /**\n * Whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n tabsMovable: boolean;\n\n /**\n * Whether the titles can be user-edited.\n *\n */\n get titlesEditable(): boolean {\n return this._titlesEditable;\n }\n\n /**\n * Set whether titles can be user edited.\n *\n */\n set titlesEditable(value: boolean) {\n this._titlesEditable = value;\n }\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * #### Notes\n * Tabs can be always be deselected programmatically.\n */\n allowDeselect: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n */\n insertBehavior: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n */\n removeBehavior: TabBar.RemoveBehavior;\n\n /**\n * Get the currently selected title.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get currentTitle(): Title | null {\n return this._titles[this._currentIndex] || null;\n }\n\n /**\n * Set the currently selected title.\n *\n * #### Notes\n * If the title does not exist, the title will be set to `null`.\n */\n set currentTitle(value: Title | null) {\n this.currentIndex = value ? this._titles.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this._currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `-1`.\n */\n set currentIndex(value: number) {\n // Adjust for an out of range index.\n if (value < 0 || value >= this._titles.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._currentIndex === value) {\n return;\n }\n\n // Look up the previous index and title.\n let pi = this._currentIndex;\n let pt = this._titles[pi] || null;\n\n // Look up the current index and title.\n let ci = value;\n let ct = this._titles[ci] || null;\n\n // Update the current index and previous title.\n this._currentIndex = ci;\n this._previousTitle = pt;\n\n // Schedule an update of the tabs.\n this.update();\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: ci,\n currentTitle: ct\n });\n }\n\n /**\n * Get the name of the tab bar.\n */\n get name(): string {\n return this._name;\n }\n\n /**\n * Set the name of the tab bar.\n */\n set name(value: string) {\n this._name = value;\n if (value) {\n this.contentNode.setAttribute('aria-label', value);\n } else {\n this.contentNode.removeAttribute('aria-label');\n }\n }\n\n /**\n * Get the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n get orientation(): TabBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n set orientation(value: TabBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Toggle the orientation values.\n this._orientation = value;\n this.dataset['orientation'] = value;\n this.contentNode.setAttribute('aria-orientation', value);\n }\n\n /**\n * Whether the add button is enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add button is enabled.\n */\n set addButtonEnabled(value: boolean) {\n // Do nothing if the value does not change.\n if (this._addButtonEnabled === value) {\n return;\n }\n\n this._addButtonEnabled = value;\n if (value) {\n this.addButtonNode.classList.remove('lm-mod-hidden');\n } else {\n this.addButtonNode.classList.add('lm-mod-hidden');\n }\n }\n\n /**\n * A read-only array of the titles in the tab bar.\n */\n get titles(): ReadonlyArray> {\n return this._titles;\n }\n\n /**\n * The tab bar content node.\n *\n * #### Notes\n * This is the node which holds the tab nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * The tab bar add button node.\n *\n * #### Notes\n * This is the node which holds the add button.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get addButtonNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-TabBar-addButton'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Add a tab to the end of the tab bar.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * If the title is already added to the tab bar, it will be moved.\n */\n addTab(value: Title | Title.IOptions): Title {\n return this.insertTab(this._titles.length, value);\n }\n\n /**\n * Insert a tab into the tab bar at the specified index.\n *\n * @param index - The index at which to insert the tab.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the tabs.\n *\n * If the title is already added to the tab bar, it will be moved.\n */\n insertTab(index: number, value: Title | Title.IOptions): Title {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Coerce the value to a title.\n let title = Private.asTitle(value);\n\n // Look up the index of the title.\n let i = this._titles.indexOf(title);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._titles.length));\n\n // If the title is not in the array, insert it.\n if (i === -1) {\n // Insert the title into the array.\n ArrayExt.insert(this._titles, j, title);\n\n // Connect to the title changed signal.\n title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the insert.\n this._adjustCurrentForInsert(j, title);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n // Otherwise, the title exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._titles.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return title;\n }\n\n // Move the title to the new location.\n ArrayExt.move(this._titles, i, j);\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Return the title added to the tab bar.\n return title;\n }\n\n /**\n * Remove a tab from the tab bar.\n *\n * @param title - The title for the tab to remove.\n *\n * #### Notes\n * This is a no-op if the title is not in the tab bar.\n */\n removeTab(title: Title): void {\n this.removeTabAt(this._titles.indexOf(title));\n }\n\n /**\n * Remove the tab at a given index from the tab bar.\n *\n * @param index - The index of the tab to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeTabAt(index: number): void {\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Remove the title from the array.\n let title = ArrayExt.removeAt(this._titles, index);\n\n // Bail if the index is out of range.\n if (!title) {\n return;\n }\n\n // Disconnect from the title changed signal.\n title.changed.disconnect(this._onTitleChanged, this);\n\n // Clear the previous title if it's being removed.\n if (title === this._previousTitle) {\n this._previousTitle = null;\n }\n\n // Schedule an update of the tabs.\n this.update();\n\n // Adjust the current index for the remove.\n this._adjustCurrentForRemove(index, title);\n }\n\n /**\n * Remove all tabs from the tab bar.\n */\n clearTabs(): void {\n // Bail if there is nothing to remove.\n if (this._titles.length === 0) {\n return;\n }\n\n // Release the mouse before making any changes.\n this._releaseMouse();\n\n // Disconnect from the title changed signals.\n for (let title of this._titles) {\n title.changed.disconnect(this._onTitleChanged, this);\n }\n\n // Get the current index and title.\n let pi = this.currentIndex;\n let pt = this.currentTitle;\n\n // Reset the current index and previous title.\n this._currentIndex = -1;\n this._previousTitle = null;\n\n // Clear the title array.\n this._titles.length = 0;\n\n // Schedule an update of the tabs.\n this.update();\n\n // If no tab was selected, there's nothing else to do.\n if (pi === -1) {\n return;\n }\n\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi,\n previousTitle: pt,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n *\n * #### Notes\n * This will cause the tab bar to stop handling mouse events and to\n * restore the tabs to their non-dragged positions.\n */\n releaseMouse(): void {\n this._releaseMouse();\n }\n\n /**\n * Handle the DOM events for the tab bar.\n *\n * @param event - The DOM event sent to the tab bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tab bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'dblclick':\n this._evtDblClick(event as MouseEvent);\n break;\n case 'keydown':\n event.eventPhase === Event.CAPTURING_PHASE\n ? this._evtKeyDownCapturing(event as KeyboardEvent)\n : this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('pointerdown', this);\n this.node.addEventListener('dblclick', this);\n this.node.addEventListener('keydown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('pointerdown', this);\n this.node.removeEventListener('dblclick', this);\n this.node.removeEventListener('keydown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let titles = this._titles;\n let renderer = this.renderer;\n let currentTitle = this.currentTitle;\n let content = new Array(titles.length);\n // Keep the tabindex=\"0\" attribute to the tab which handled it before the update.\n // If the add button handles it, no need to do anything. If no element of the tab\n // bar handles it, set it on the current or the first tab to ensure one element\n // handles it after update.\n const tabHandlingTabindex =\n this._getCurrentTabindex() ??\n (this._currentIndex > -1 ? this._currentIndex : 0);\n\n for (let i = 0, n = titles.length; i < n; ++i) {\n let title = titles[i];\n let current = title === currentTitle;\n let zIndex = current ? n : n - i - 1;\n let tabIndex = tabHandlingTabindex === i ? 0 : -1;\n content[i] = renderer.renderTab({ title, current, zIndex, tabIndex });\n }\n VirtualDOM.render(content, this.contentNode);\n }\n\n /**\n * Get the index of the tab which handles tabindex=\"0\".\n * If the add button handles tabindex=\"0\", -1 is returned.\n * If none of the previous handles tabindex=\"0\", null is returned.\n */\n private _getCurrentTabindex(): number | null {\n let index = null;\n const elemTabindex = this.contentNode.querySelector('li[tabindex=\"0\"]');\n if (elemTabindex) {\n index = [...this.contentNode.children].indexOf(elemTabindex);\n } else if (\n this._addButtonEnabled &&\n this.addButtonNode.getAttribute('tabindex') === '0'\n ) {\n index = -1;\n }\n return index;\n }\n\n /**\n * Handle the `'dblclick'` event for the tab bar.\n */\n private _evtDblClick(event: MouseEvent): void {\n // Do nothing if titles are not editable\n if (!this.titlesEditable) {\n return;\n }\n\n let tabs = this.contentNode.children;\n\n // Find the index of the targeted tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab.\n if (index === -1) {\n return;\n }\n\n let title = this.titles[index];\n let label = tabs[index].querySelector('.lm-TabBar-tabLabel') as HTMLElement;\n if (label && label.contains(event.target as HTMLElement)) {\n let value = title.label || '';\n\n // Clear the label element\n let oldValue = label.innerHTML;\n label.innerHTML = '';\n\n let input = document.createElement('input');\n input.classList.add('lm-TabBar-tabInput');\n input.value = value;\n label.appendChild(input);\n\n let onblur = () => {\n input.removeEventListener('blur', onblur);\n label.innerHTML = oldValue;\n this.node.addEventListener('keydown', this);\n };\n\n input.addEventListener('dblclick', (event: Event) =>\n event.stopPropagation()\n );\n input.addEventListener('blur', onblur);\n input.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n if (input.value !== '') {\n title.label = title.caption = input.value;\n }\n onblur();\n } else if (event.key === 'Escape') {\n onblur();\n }\n });\n this.node.removeEventListener('keydown', this);\n input.select();\n input.focus();\n\n if (label.children.length > 0) {\n (label.children[0] as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at capturing phase.\n */\n private _evtKeyDownCapturing(event: KeyboardEvent): void {\n if (event.eventPhase !== Event.CAPTURING_PHASE) {\n return;\n }\n\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.key === 'Escape') {\n this._releaseMouse();\n }\n }\n\n /**\n * Handle the `'keydown'` event for the tab bar at target phase.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Allow for navigation using tab key\n if (event.key === 'Tab' || event.eventPhase === Event.CAPTURING_PHASE) {\n return;\n }\n\n // Check if Enter or Spacebar key has been pressed and open that tab\n if (\n event.key === 'Enter' ||\n event.key === 'Spacebar' ||\n event.key === ' '\n ) {\n // Get focus element that is in focus by the tab key\n const focusedElement = document.activeElement;\n\n // Test first if the focus is on the add button node\n if (\n this.addButtonEnabled &&\n this.addButtonNode.contains(focusedElement)\n ) {\n event.preventDefault();\n event.stopPropagation();\n this._addRequested.emit();\n } else {\n const index = ArrayExt.findFirstIndex(this.contentNode.children, tab =>\n tab.contains(focusedElement)\n );\n if (index >= 0) {\n event.preventDefault();\n event.stopPropagation();\n this.currentIndex = index;\n }\n }\n // Handle the arrow keys to switch tabs.\n } else if (ARROW_KEYS.includes(event.key)) {\n // Create a list of all focusable elements in the tab bar.\n const focusable: Element[] = [...this.contentNode.children];\n if (this.addButtonEnabled) {\n focusable.push(this.addButtonNode);\n }\n // If the tab bar contains only one element, nothing to do.\n if (focusable.length <= 1) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n\n // Get the current focused element.\n let focusedIndex = focusable.indexOf(document.activeElement as Element);\n if (focusedIndex === -1) {\n focusedIndex = this._currentIndex;\n }\n\n // Find the next element to focus on.\n let nextFocused: Element | null | undefined;\n if (\n (event.key === 'ArrowRight' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowDown' && this._orientation === 'vertical')\n ) {\n nextFocused = focusable[focusedIndex + 1] ?? focusable[0];\n } else if (\n (event.key === 'ArrowLeft' && this._orientation === 'horizontal') ||\n (event.key === 'ArrowUp' && this._orientation === 'vertical')\n ) {\n nextFocused =\n focusable[focusedIndex - 1] ?? focusable[focusable.length - 1];\n } else if (event.key === 'Home') {\n nextFocused = focusable[0];\n } else if (event.key === 'End') {\n nextFocused = focusable[focusable.length - 1];\n }\n\n // Change the focused element and the tabindex value.\n if (nextFocused) {\n focusable[focusedIndex]?.setAttribute('tabindex', '-1');\n nextFocused?.setAttribute('tabindex', '0');\n (nextFocused as HTMLElement).focus();\n }\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the tab bar.\n */\n private _evtPointerDown(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse press.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if a drag is in progress.\n if (this._dragData) {\n return;\n }\n\n // Do nothing if a title editable input was clicked.\n if (\n (event.target as HTMLElement).classList.contains('lm-TabBar-tabInput')\n ) {\n return;\n }\n\n // Check if the add button was clicked.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the pressed tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the press is not on a tab or the add button.\n if (index === -1 && !addButtonClicked) {\n return;\n }\n\n // Pressing on a tab stops the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Initialize the non-measured parts of the drag data.\n this._dragData = {\n tab: tabs[index] as HTMLElement,\n index: index,\n pressX: event.clientX,\n pressY: event.clientY,\n tabPos: -1,\n tabSize: -1,\n tabPressPos: -1,\n targetIndex: -1,\n tabLayout: null,\n contentRect: null,\n override: null,\n dragActive: false,\n dragAborted: false,\n detachRequested: false\n };\n\n // Add the document pointer up listener.\n this.document.addEventListener('pointerup', this, true);\n\n // Do nothing else if the middle button or add button is clicked.\n if (event.button === 1 || addButtonClicked) {\n return;\n }\n\n // Do nothing else if the close icon is clicked.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n return;\n }\n\n // Add the extra listeners if the tabs are movable.\n if (this.tabsMovable) {\n this.document.addEventListener('pointermove', this, true);\n this.document.addEventListener('keydown', this, true);\n this.document.addEventListener('contextmenu', this, true);\n }\n\n // Update the current index as appropriate.\n if (this.allowDeselect && this.currentIndex === index) {\n this.currentIndex = -1;\n } else {\n this.currentIndex = index;\n }\n\n // Do nothing else if there is no current tab.\n if (this.currentIndex === -1) {\n return;\n }\n\n // Emit the tab activate request signal.\n this._tabActivateRequested.emit({\n index: this.currentIndex,\n title: this.currentTitle!\n });\n }\n\n /**\n * Handle the `'pointermove'` event for the tab bar.\n */\n private _evtPointerMove(event: PointerEvent | MouseEvent): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Suppress the event during a drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Bail early if the drag threshold has not been met.\n if (!data.dragActive && !Private.dragExceeded(data, event)) {\n return;\n }\n\n // Activate the drag if necessary.\n if (!data.dragActive) {\n // Fill in the rest of the drag data measurements.\n let tabRect = data.tab.getBoundingClientRect();\n if (this._orientation === 'horizontal') {\n data.tabPos = data.tab.offsetLeft;\n data.tabSize = tabRect.width;\n data.tabPressPos = data.pressX - tabRect.left;\n } else {\n data.tabPos = data.tab.offsetTop;\n data.tabSize = tabRect.height;\n data.tabPressPos = data.pressY - tabRect.top;\n }\n data.tabPressOffset = {\n x: data.pressX - tabRect.left,\n y: data.pressY - tabRect.top\n };\n data.tabLayout = Private.snapTabLayout(tabs, this._orientation);\n data.contentRect = this.contentNode.getBoundingClientRect();\n data.override = Drag.overrideCursor('default');\n\n // Add the dragging style classes.\n data.tab.classList.add('lm-mod-dragging');\n this.addClass('lm-mod-dragging');\n\n // Mark the drag as active.\n data.dragActive = true;\n }\n\n // Emit the detach requested signal if the threshold is exceeded.\n if (!data.detachRequested && Private.detachExceeded(data, event)) {\n // Only emit the signal once per drag cycle.\n data.detachRequested = true;\n\n // Setup the arguments for the signal.\n let index = data.index;\n let clientX = event.clientX;\n let clientY = event.clientY;\n let tab = tabs[index] as HTMLElement;\n let title = this._titles[index];\n\n // Emit the tab detach requested signal.\n this._tabDetachRequested.emit({\n index,\n title,\n tab,\n clientX,\n clientY,\n offset: data.tabPressOffset\n });\n\n // Bail if the signal handler aborted the drag.\n if (data.dragAborted) {\n return;\n }\n }\n\n // Update the positions of the tabs.\n Private.layoutTabs(tabs, data, event, this._orientation);\n }\n\n /**\n * Handle the `'pointerup'` event for the document.\n */\n private _evtPointerUp(event: PointerEvent | MouseEvent): void {\n // Do nothing if it's not a left or middle mouse release.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n\n // Do nothing if no drag is in progress.\n const data = this._dragData;\n if (!data) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Remove the extra mouse event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Handle a release when the drag is not active.\n if (!data.dragActive) {\n // Clear the drag data.\n this._dragData = null;\n\n // Handle clicking the add button.\n let addButtonClicked =\n this.addButtonEnabled &&\n this.addButtonNode.contains(event.target as HTMLElement);\n if (addButtonClicked) {\n this._addRequested.emit(undefined);\n return;\n }\n\n // Lookup the tab nodes.\n let tabs = this.contentNode.children;\n\n // Find the index of the released tab.\n let index = ArrayExt.findFirstIndex(tabs, tab => {\n return ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n\n // Do nothing if the release is not on the original pressed tab.\n if (index !== data.index) {\n return;\n }\n\n // Ignore the release if the title is not closable.\n let title = this._titles[index];\n if (!title.closable) {\n return;\n }\n\n // Emit the close requested signal if the middle button is released.\n if (event.button === 1) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Emit the close requested signal if the close icon was released.\n let icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target as HTMLElement)) {\n this._tabCloseRequested.emit({ index, title });\n return;\n }\n\n // Otherwise, there is nothing left to do.\n return;\n }\n\n // Do nothing if the left button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Position the tab at its final resting position.\n Private.finalizeTabPosition(data, this._orientation);\n\n // Remove the dragging class from the tab so it can be transitioned.\n data.tab.classList.remove('lm-mod-dragging');\n\n // Parse the transition duration for releasing the tab.\n let duration = Private.parseTransitionDuration(data.tab);\n\n // Complete the release on a timer to allow the tab to transition.\n setTimeout(() => {\n // Do nothing if the drag has been aborted.\n if (data.dragAborted) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Reset the positions of the tabs.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor grab.\n data.override!.dispose();\n\n // Remove the remaining dragging style.\n this.removeClass('lm-mod-dragging');\n\n // If the tab was not moved, there is nothing else to do.\n let i = data.index;\n let j = data.targetIndex;\n if (j === -1 || i === j) {\n return;\n }\n\n // Move the title to the new locations.\n ArrayExt.move(this._titles, i, j);\n\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n\n // Emit the tab moved signal.\n this._tabMoved.emit({\n fromIndex: i,\n toIndex: j,\n title: this._titles[j]\n });\n\n // Update the tabs immediately to prevent flicker.\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n }, duration);\n }\n\n /**\n * Release the mouse and restore the non-dragged tab positions.\n */\n private _releaseMouse(): void {\n // Do nothing if no drag is in progress.\n let data = this._dragData;\n if (!data) {\n return;\n }\n\n // Clear the drag data reference.\n this._dragData = null;\n\n // Remove the extra document event listeners.\n this.document.removeEventListener('pointermove', this, true);\n this.document.removeEventListener('pointerup', this, true);\n this.document.removeEventListener('keydown', this, true);\n this.document.removeEventListener('contextmenu', this, true);\n\n // Indicate the drag has been aborted. This allows the mouse\n // event handlers to return early when the drag is canceled.\n data.dragAborted = true;\n\n // If the drag is not active, there's nothing more to do.\n if (!data.dragActive) {\n return;\n }\n\n // Reset the tabs to their non-dragged positions.\n Private.resetTabPositions(this.contentNode.children, this._orientation);\n\n // Clear the cursor override.\n data.override!.dispose();\n\n // Clear the dragging style classes.\n data.tab.classList.remove('lm-mod-dragging');\n this.removeClass('lm-mod-dragging');\n }\n\n /**\n * Adjust the current index for a tab insert operation.\n *\n * This method accounts for the tab bar's insertion behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForInsert(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ct = this.currentTitle;\n let ci = this._currentIndex;\n let bh = this.insertBehavior;\n\n // TODO: do we need to do an update to update the aria-selected attribute?\n\n // Handle the behavior where the new tab is always selected,\n // or the behavior where the new tab is selected if needed.\n if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n this._currentIndex = i;\n this._previousTitle = ct;\n this._currentChanged.emit({\n previousIndex: ci,\n previousTitle: ct,\n currentIndex: i,\n currentTitle: title\n });\n return;\n }\n\n // Otherwise, silently adjust the current index if needed.\n if (ci >= i) {\n this._currentIndex++;\n }\n }\n\n /**\n * Adjust the current index for a tab move operation.\n *\n * This method will not cause the actual current tab to change.\n * It silently adjusts the index to account for the given move.\n */\n private _adjustCurrentForMove(i: number, j: number): void {\n if (this._currentIndex === i) {\n this._currentIndex = j;\n } else if (this._currentIndex < i && this._currentIndex >= j) {\n this._currentIndex++;\n } else if (this._currentIndex > i && this._currentIndex <= j) {\n this._currentIndex--;\n }\n }\n\n /**\n * Adjust the current index for a tab remove operation.\n *\n * This method accounts for the tab bar's remove behavior when\n * adjusting the current index and emitting the changed signal.\n */\n private _adjustCurrentForRemove(i: number, title: Title): void {\n // Lookup commonly used variables.\n let ci = this._currentIndex;\n let bh = this.removeBehavior;\n\n // Silently adjust the index if the current tab is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._currentIndex--;\n }\n return;\n }\n\n // TODO: do we need to do an update to adjust the aria-selected value?\n\n // No tab gets selected if the tab bar is empty.\n if (this._titles.length === 0) {\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n return;\n }\n\n // Handle behavior where the next sibling tab is selected.\n if (bh === 'select-tab-after') {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous sibling tab is selected.\n if (bh === 'select-tab-before') {\n this._currentIndex = Math.max(0, i - 1);\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Handle behavior where the previous history tab is selected.\n if (bh === 'select-previous-tab') {\n if (this._previousTitle) {\n this._currentIndex = this._titles.indexOf(this._previousTitle);\n this._previousTitle = null;\n } else {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n }\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: this._currentIndex,\n currentTitle: this.currentTitle\n });\n return;\n }\n\n // Otherwise, no tab gets selected.\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i,\n previousTitle: title,\n currentIndex: -1,\n currentTitle: null\n });\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(sender: Title): void {\n this.update();\n }\n\n private _name: string;\n private _currentIndex = -1;\n private _titles: Title[] = [];\n private _orientation: TabBar.Orientation;\n private _document: Document | ShadowRoot;\n private _titlesEditable: boolean = false;\n private _previousTitle: Title | null = null;\n private _dragData: Private.IDragData | null = null;\n private _addButtonEnabled: boolean = false;\n private _tabMoved = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n private _addRequested = new Signal(this);\n private _tabCloseRequested = new Signal<\n this,\n TabBar.ITabCloseRequestedArgs\n >(this);\n private _tabDetachRequested = new Signal<\n this,\n TabBar.ITabDetachRequestedArgs\n >(this);\n private _tabActivateRequested = new Signal<\n this,\n TabBar.ITabActivateRequestedArgs\n >(this);\n}\n\n/**\n * The namespace for the `TabBar` class statics.\n */\nexport namespace TabBar {\n /**\n * A type alias for a tab bar orientation.\n */\n export type Orientation =\n | /**\n * The tabs are arranged in a single row, left-to-right.\n *\n * The tab text orientation is horizontal.\n */\n 'horizontal'\n\n /**\n * The tabs are arranged in a single column, top-to-bottom.\n *\n * The tab text orientation is horizontal.\n */\n | 'vertical';\n\n /**\n * A type alias for the selection behavior on tab insert.\n */\n export type InsertBehavior =\n | /**\n * The selected tab will not be changed.\n */\n 'none'\n\n /**\n * The inserted tab will be selected.\n */\n | 'select-tab'\n\n /**\n * The inserted tab will be selected if the current tab is null.\n */\n | 'select-tab-if-needed';\n\n /**\n * A type alias for the selection behavior on tab remove.\n */\n export type RemoveBehavior =\n | /**\n * No tab will be selected.\n */\n 'none'\n\n /**\n * The tab after the removed tab will be selected if possible.\n */\n | 'select-tab-after'\n\n /**\n * The tab before the removed tab will be selected if possible.\n */\n | 'select-tab-before'\n\n /**\n * The previously selected tab will be selected if possible.\n */\n | 'select-previous-tab';\n\n /**\n * An options object for creating a tab bar.\n */\n export interface IOptions {\n /**\n * The document to use with the tab bar.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n\n /**\n * Name of the tab bar.\n *\n * This is used for accessibility reasons. The default is the empty string.\n */\n name?: string;\n\n /**\n * The layout orientation of the tab bar.\n *\n * The default is `horizontal`.\n */\n orientation?: TabBar.Orientation;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether a tab can be deselected by the user.\n *\n * The default is `false`.\n */\n allowDeselect?: boolean;\n\n /**\n * Whether the titles can be directly edited by the user.\n *\n * The default is `false`.\n */\n titlesEditable?: boolean;\n\n /**\n * Whether the add button is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The selection behavior when inserting a tab.\n *\n * The default is `'select-tab-if-needed'`.\n */\n insertBehavior?: TabBar.InsertBehavior;\n\n /**\n * The selection behavior when removing a tab.\n *\n * The default is `'select-tab-after'`.\n */\n removeBehavior?: TabBar.RemoveBehavior;\n\n /**\n * A renderer to use with the tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n readonly previousIndex: number;\n\n /**\n * The previously selected title.\n */\n readonly previousTitle: Title | null;\n\n /**\n * The currently selected index.\n */\n readonly currentIndex: number;\n\n /**\n * The currently selected title.\n */\n readonly currentTitle: Title | null;\n }\n\n /**\n * The arguments object for the `tabMoved` signal.\n */\n export interface ITabMovedArgs {\n /**\n * The previous index of the tab.\n */\n readonly fromIndex: number;\n\n /**\n * The current index of the tab.\n */\n readonly toIndex: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabActivateRequested` signal.\n */\n export interface ITabActivateRequestedArgs {\n /**\n * The index of the tab to activate.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabCloseRequested` signal.\n */\n export interface ITabCloseRequestedArgs {\n /**\n * The index of the tab to close.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n }\n\n /**\n * The arguments object for the `tabDetachRequested` signal.\n */\n export interface ITabDetachRequestedArgs {\n /**\n * The index of the tab to detach.\n */\n readonly index: number;\n\n /**\n * The title for the tab.\n */\n readonly title: Title;\n\n /**\n * The node representing the tab.\n */\n readonly tab: HTMLElement;\n\n /**\n * The current client X position of the mouse.\n */\n readonly clientX: number;\n\n /**\n * The current client Y position of the mouse.\n */\n readonly clientY: number;\n\n /**\n * The mouse position in the tab coordinate.\n */\n readonly offset?: { x: number; y: number };\n }\n\n /**\n * An object which holds the data to render a tab.\n */\n export interface IRenderData {\n /**\n * The title associated with the tab.\n */\n readonly title: Title;\n\n /**\n * Whether the tab is the current tab.\n */\n readonly current: boolean;\n\n /**\n * The z-index for the tab.\n */\n readonly zIndex: number;\n\n /**\n * The tabindex value for the tab.\n */\n readonly tabIndex?: number;\n }\n\n /**\n * A renderer for use with a tab bar.\n */\n export interface IRenderer {\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector: string;\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n constructor() {\n this._uuid = ++Renderer._nInstance;\n }\n /**\n * A selector which matches the close icon node in a tab.\n */\n readonly closeIconSelector = '.lm-TabBar-tabCloseIcon';\n\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n renderTab(data: IRenderData): VirtualElement {\n let title = data.title.caption;\n let key = this.createTabKey(data);\n let id = key;\n let style = this.createTabStyle(data);\n let className = this.createTabClass(data);\n let dataset = this.createTabDataset(data);\n let aria = this.createTabARIA(data);\n if (data.title.closable) {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data),\n this.renderCloseIcon(data)\n );\n } else {\n return h.li(\n { id, key, className, title, style, dataset, ...aria },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n }\n\n /**\n * Render the icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n const { title } = data;\n let className = this.createIconClass(data);\n\n // If title.icon is undefined, it will be ignored.\n return h.div({ className }, title.icon!, title.iconLabel);\n }\n\n /**\n * Render the label element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label);\n }\n\n /**\n * Render the close icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab close icon.\n */\n renderCloseIcon(data: IRenderData): VirtualElement {\n return h.div({ className: 'lm-TabBar-tabCloseIcon' });\n }\n\n /**\n * Create a unique render key for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The unique render key for the tab.\n *\n * #### Notes\n * This method caches the key against the tab title the first time\n * the key is generated. This enables efficient rendering of moved\n * tabs and avoids subtle hover style artifacts.\n */\n createTabKey(data: IRenderData): string {\n let key = this._tabKeys.get(data.title);\n if (key === undefined) {\n key = `tab-key-${this._uuid}-${this._tabID++}`;\n this._tabKeys.set(data.title, key);\n }\n return key;\n }\n\n /**\n * Create the inline style object for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The inline style data for the tab.\n */\n createTabStyle(data: IRenderData): ElementInlineStyle {\n return { zIndex: `${data.zIndex}` };\n }\n\n /**\n * Create the class name for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab.\n */\n createTabClass(data: IRenderData): string {\n let name = 'lm-TabBar-tab';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.title.closable) {\n name += ' lm-mod-closable';\n }\n if (data.current) {\n name += ' lm-mod-current';\n }\n return name;\n }\n\n /**\n * Create the dataset for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The dataset for the tab.\n */\n createTabDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the ARIA attributes for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The ARIA attributes for the tab.\n */\n createTabARIA(data: IRenderData): ElementARIAAttrs | ElementBaseAttrs {\n return {\n role: 'tab',\n 'aria-selected': data.current.toString(),\n tabindex: `${data.tabIndex ?? '-1'}`\n };\n }\n\n /**\n * Create the class name for the tab icon.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-TabBar-tabIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n private static _nInstance = 0;\n private readonly _uuid: number;\n private _tabID = 0;\n private _tabKeys = new WeakMap, string>();\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n\n /**\n * A selector which matches the add button node in the tab bar.\n */\n export const addButtonSelector = '.lm-TabBar-addButton';\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The start drag distance threshold.\n */\n export const DRAG_THRESHOLD = 5;\n\n /**\n * The detach distance threshold.\n */\n export const DETACH_THRESHOLD = 20;\n\n /**\n * A struct which holds the drag data for a tab bar.\n */\n export interface IDragData {\n /**\n * The tab node being dragged.\n */\n tab: HTMLElement;\n\n /**\n * The index of the tab being dragged.\n */\n index: number;\n\n /**\n * The mouse press client X position.\n */\n pressX: number;\n\n /**\n * The mouse press client Y position.\n */\n pressY: number;\n\n /**\n * The offset left/top of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPos: number;\n\n /**\n * The offset width/height of the tab being dragged.\n *\n * This will be `-1` if the drag is not active.\n */\n tabSize: number;\n\n /**\n * The original mouse X/Y position in tab coordinates.\n *\n * This will be `-1` if the drag is not active.\n */\n tabPressPos: number;\n\n /**\n * The original mouse position in tab coordinates.\n *\n * This is undefined if the drag is not active.\n */\n tabPressOffset?: { x: number; y: number };\n\n /**\n * The tab target index upon mouse release.\n *\n * This will be `-1` if the drag is not active.\n */\n targetIndex: number;\n\n /**\n * The array of tab layout objects snapped at drag start.\n *\n * This will be `null` if the drag is not active.\n */\n tabLayout: ITabLayout[] | null;\n\n /**\n * The bounding client rect of the tab bar content node.\n *\n * This will be `null` if the drag is not active.\n */\n contentRect: DOMRect | null;\n\n /**\n * The disposable to clean up the cursor override.\n *\n * This will be `null` if the drag is not active.\n */\n override: IDisposable | null;\n\n /**\n * Whether the drag is currently active.\n */\n dragActive: boolean;\n\n /**\n * Whether the drag has been aborted.\n */\n dragAborted: boolean;\n\n /**\n * Whether a detach request as been made.\n */\n detachRequested: boolean;\n }\n\n /**\n * An object which holds layout data for a tab.\n */\n export interface ITabLayout {\n /**\n * The left/top margin value for the tab.\n */\n margin: number;\n\n /**\n * The offset left/top position of the tab.\n */\n pos: number;\n\n /**\n * The offset width/height of the tab.\n */\n size: number;\n }\n\n /**\n * Create the DOM node for a tab bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.setAttribute('role', 'tablist');\n content.className = 'lm-TabBar-content';\n node.appendChild(content);\n\n let add = document.createElement('div');\n add.className = 'lm-TabBar-addButton lm-mod-hidden';\n add.setAttribute('tabindex', '-1');\n add.setAttribute('role', 'button');\n node.appendChild(add);\n return node;\n }\n\n /**\n * Coerce a title or options into a real title.\n */\n export function asTitle(value: Title | Title.IOptions): Title {\n return value instanceof Title ? value : new Title(value);\n }\n\n /**\n * Parse the transition duration for a tab node.\n */\n export function parseTransitionDuration(tab: HTMLElement): number {\n let style = window.getComputedStyle(tab);\n return 1000 * (parseFloat(style.transitionDuration!) || 0);\n }\n\n /**\n * Get a snapshot of the current tab layout values.\n */\n export function snapTabLayout(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): ITabLayout[] {\n let layout = new Array(tabs.length);\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let node = tabs[i] as HTMLElement;\n let style = window.getComputedStyle(node);\n if (orientation === 'horizontal') {\n layout[i] = {\n pos: node.offsetLeft,\n size: node.offsetWidth,\n margin: parseFloat(style.marginLeft!) || 0\n };\n } else {\n layout[i] = {\n pos: node.offsetTop,\n size: node.offsetHeight,\n margin: parseFloat(style.marginTop!) || 0\n };\n }\n }\n return layout;\n }\n\n /**\n * Test if the event exceeds the drag threshold.\n */\n export function dragExceeded(data: IDragData, event: MouseEvent): boolean {\n let dx = Math.abs(event.clientX - data.pressX);\n let dy = Math.abs(event.clientY - data.pressY);\n return dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD;\n }\n\n /**\n * Test if the event exceeds the drag detach threshold.\n */\n export function detachExceeded(data: IDragData, event: MouseEvent): boolean {\n let rect = data.contentRect!;\n return (\n event.clientX < rect.left - DETACH_THRESHOLD ||\n event.clientX >= rect.right + DETACH_THRESHOLD ||\n event.clientY < rect.top - DETACH_THRESHOLD ||\n event.clientY >= rect.bottom + DETACH_THRESHOLD\n );\n }\n\n /**\n * Update the relative tab positions and computed target index.\n */\n export function layoutTabs(\n tabs: HTMLCollection,\n data: IDragData,\n event: MouseEvent,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive values.\n let pressPos: number;\n let localPos: number;\n let clientPos: number;\n let clientSize: number;\n if (orientation === 'horizontal') {\n pressPos = data.pressX;\n localPos = event.clientX - data.contentRect!.left;\n clientPos = event.clientX;\n clientSize = data.contentRect!.width;\n } else {\n pressPos = data.pressY;\n localPos = event.clientY - data.contentRect!.top;\n clientPos = event.clientY;\n clientSize = data.contentRect!.height;\n }\n\n // Compute the target data.\n let targetIndex = data.index;\n let targetPos = localPos - data.tabPressPos;\n let targetEnd = targetPos + data.tabSize;\n\n // Update the relative tab positions.\n for (let i = 0, n = tabs.length; i < n; ++i) {\n let pxPos: string;\n let layout = data.tabLayout![i];\n let threshold = layout.pos + (layout.size >> 1);\n if (i < data.index && targetPos < threshold) {\n pxPos = `${data.tabSize + data.tabLayout![i + 1].margin}px`;\n targetIndex = Math.min(targetIndex, i);\n } else if (i > data.index && targetEnd > threshold) {\n pxPos = `${-data.tabSize - layout.margin}px`;\n targetIndex = Math.max(targetIndex, i);\n } else if (i === data.index) {\n let ideal = clientPos - pressPos;\n let limit = clientSize - (data.tabPos + data.tabSize);\n pxPos = `${Math.max(-data.tabPos, Math.min(ideal, limit))}px`;\n } else {\n pxPos = '';\n }\n if (orientation === 'horizontal') {\n (tabs[i] as HTMLElement).style.left = pxPos;\n } else {\n (tabs[i] as HTMLElement).style.top = pxPos;\n }\n }\n\n // Update the computed target index.\n data.targetIndex = targetIndex;\n }\n\n /**\n * Position the drag tab at its final resting relative position.\n */\n export function finalizeTabPosition(\n data: IDragData,\n orientation: TabBar.Orientation\n ): void {\n // Compute the orientation-sensitive client size.\n let clientSize: number;\n if (orientation === 'horizontal') {\n clientSize = data.contentRect!.width;\n } else {\n clientSize = data.contentRect!.height;\n }\n\n // Compute the ideal final tab position.\n let ideal: number;\n if (data.targetIndex === data.index) {\n ideal = 0;\n } else if (data.targetIndex > data.index) {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n } else {\n let tgt = data.tabLayout![data.targetIndex];\n ideal = tgt.pos - data.tabPos;\n }\n\n // Compute the tab position limit.\n let limit = clientSize - (data.tabPos + data.tabSize);\n let final = Math.max(-data.tabPos, Math.min(ideal, limit));\n\n // Set the final orientation-sensitive position.\n if (orientation === 'horizontal') {\n data.tab.style.left = `${final}px`;\n } else {\n data.tab.style.top = `${final}px`;\n }\n }\n\n /**\n * Reset the relative positions of the given tabs.\n */\n export function resetTabPositions(\n tabs: HTMLCollection,\n orientation: TabBar.Orientation\n ): void {\n for (const tab of tabs) {\n if (orientation === 'horizontal') {\n (tab as HTMLElement).style.left = '';\n } else {\n (tab as HTMLElement).style.top = '';\n }\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, empty } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { TabBar } from './tabbar';\n\nimport Utils from './utils';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nexport class DockLayout extends Layout {\n /**\n * Construct a new dock layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: DockLayout.IOptions) {\n super();\n this.renderer = options.renderer;\n if (options.spacing !== undefined) {\n this._spacing = Utils.clampDimension(options.spacing);\n }\n this._document = options.document || document;\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n */\n dispose(): void {\n // Get an iterator over the widgets in the layout.\n let widgets = this[Symbol.iterator]();\n\n // Dispose of the layout items.\n this._items.forEach(item => {\n item.dispose();\n });\n\n // Clear the layout state before disposing the widgets.\n this._box = null;\n this._root = null;\n this._items.clear();\n\n // Dispose of the widgets contained in the old layout root.\n for (const widget of widgets) {\n widget.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The renderer used by the dock layout.\n */\n readonly renderer: DockLayout.IRenderer;\n\n /**\n * The method for hiding child widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n for (const bar of this.tabBars()) {\n if (bar.titles.length > 1) {\n for (const title of bar.titles) {\n title.owner.hiddenMode = this._hiddenMode;\n }\n }\n }\n }\n\n /**\n * Get the inter-element spacing for the dock layout.\n */\n get spacing(): number {\n return this._spacing;\n }\n\n /**\n * Set the inter-element spacing for the dock layout.\n */\n set spacing(value: number) {\n value = Utils.clampDimension(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n }\n\n /**\n * Whether the dock layout is empty.\n */\n get isEmpty(): boolean {\n return this._root === null;\n }\n\n /**\n * Create an iterator over all widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This iterator includes the generated tab bars.\n */\n [Symbol.iterator](): IterableIterator {\n return this._root ? this._root.iterAllWidgets() : empty();\n }\n\n /**\n * Create an iterator over the user widgets in the layout.\n *\n * @returns A new iterator over the user widgets in the layout.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n widgets(): IterableIterator {\n return this._root ? this._root.iterUserWidgets() : empty();\n }\n\n /**\n * Create an iterator over the selected widgets in the layout.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the layout.\n */\n selectedWidgets(): IterableIterator {\n return this._root ? this._root.iterSelectedWidgets() : empty();\n }\n\n /**\n * Create an iterator over the tab bars in the layout.\n *\n * @returns A new iterator over the tab bars in the layout.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n tabBars(): IterableIterator> {\n return this._root ? this._root.iterTabBars() : empty();\n }\n\n /**\n * Create an iterator over the handles in the layout.\n *\n * @returns A new iterator over the handles in the layout.\n */\n handles(): IterableIterator {\n return this._root ? this._root.iterHandles() : empty();\n }\n\n /**\n * Move a handle to the given offset position.\n *\n * @param handle - The handle to move.\n *\n * @param offsetX - The desired offset X position of the handle.\n *\n * @param offsetY - The desired offset Y position of the handle.\n *\n * #### Notes\n * If the given handle is not contained in the layout, this is no-op.\n *\n * The handle will be moved as close as possible to the desired\n * position without violating any of the layout constraints.\n *\n * Only one of the coordinates is used depending on the orientation\n * of the handle. This method accepts both coordinates to make it\n * easy to invoke from a mouse move event without needing to know\n * the handle orientation.\n */\n moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void {\n // Bail early if there is no root or if the handle is hidden.\n let hidden = handle.classList.contains('lm-mod-hidden');\n if (!this._root || hidden) {\n return;\n }\n\n // Lookup the split node for the handle.\n let data = this._root.findSplitNode(handle);\n if (!data) {\n return;\n }\n\n // Compute the desired delta movement for the handle.\n let delta: number;\n if (data.node.orientation === 'horizontal') {\n delta = offsetX - handle.offsetLeft;\n } else {\n delta = offsetY - handle.offsetTop;\n }\n\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n\n // Prevent sibling resizing unless needed.\n data.node.holdSizes();\n\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(data.node.sizers, data.index, delta);\n\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Save the current configuration of the dock layout.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockLayout.ILayoutConfig {\n // Bail early if there is no root.\n if (!this._root) {\n return { main: null };\n }\n\n // Hold the current sizes in the layout tree.\n this._root.holdAllSizes();\n\n // Return the layout config.\n return { main: this._root.createConfig() };\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n */\n restoreLayout(config: DockLayout.ILayoutConfig): void {\n // Create the widget set for validating the config.\n let widgetSet = new Set();\n\n // Normalize the main area config and collect the widgets.\n let mainConfig: DockLayout.AreaConfig | null;\n if (config.main) {\n mainConfig = Private.normalizeAreaConfig(config.main, widgetSet);\n } else {\n mainConfig = null;\n }\n\n // Create iterators over the old content.\n let oldWidgets = this.widgets();\n let oldTabBars = this.tabBars();\n let oldHandles = this.handles();\n\n // Clear the root before removing the old content.\n this._root = null;\n\n // Unparent the old widgets which are not in the new config.\n for (const widget of oldWidgets) {\n if (!widgetSet.has(widget)) {\n widget.parent = null;\n }\n }\n\n // Dispose of the old tab bars.\n for (const tabBar of oldTabBars) {\n tabBar.dispose();\n }\n\n // Remove the old handles.\n for (const handle of oldHandles) {\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n }\n\n // Reparent the new widgets to the current parent.\n for (const widget of widgetSet) {\n widget.parent = this.parent;\n }\n\n // Create the root node for the new config.\n if (mainConfig) {\n this._root = Private.realizeAreaConfig(\n mainConfig,\n {\n // Ignoring optional `document` argument as we must reuse `this._document`\n createTabBar: (document?: Document | ShadowRoot) =>\n this._createTabBar(),\n createHandle: () => this._createHandle()\n },\n this._document\n );\n } else {\n this._root = null;\n }\n\n // If there is no parent, there is nothing more to do.\n if (!this.parent) {\n return;\n }\n\n // Attach the new widgets to the parent.\n widgetSet.forEach(widget => {\n this.attachWidget(widget);\n });\n\n // Post a fit request to the parent.\n this.parent.fit();\n }\n\n /**\n * Add a widget to the dock layout.\n *\n * @param widget - The widget to add to the dock layout.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * The widget will be moved if it is already contained in the layout.\n *\n * An error will be thrown if the reference widget is invalid.\n */\n addWidget(widget: Widget, options: DockLayout.IAddOptions = {}): void {\n // Parse the options.\n let ref = options.ref || null;\n let mode = options.mode || 'tab-after';\n\n // Find the tab node which holds the reference widget.\n let refNode: Private.TabLayoutNode | null = null;\n if (this._root && ref) {\n refNode = this._root.findTabNode(ref);\n }\n\n // Throw an error if the reference widget is invalid.\n if (ref && !refNode) {\n throw new Error('Reference widget is not in the layout.');\n }\n\n // Reparent the widget to the current layout parent.\n widget.parent = this.parent;\n\n // Insert the widget according to the insert mode.\n switch (mode) {\n case 'tab-after':\n this._insertTab(widget, ref, refNode, true);\n break;\n case 'tab-before':\n this._insertTab(widget, ref, refNode, false);\n break;\n case 'split-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false);\n break;\n case 'split-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false);\n break;\n case 'split-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true);\n break;\n case 'split-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true);\n break;\n case 'merge-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false, true);\n break;\n case 'merge-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false, true);\n break;\n case 'merge-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true, true);\n break;\n case 'merge-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true, true);\n break;\n }\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Ensure the widget is attached to the parent widget.\n this.attachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Remove the widget from its current layout location.\n this._removeWidget(widget);\n\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n\n // Detach the widget from the parent widget.\n this.detachWidget(widget);\n\n // Post a fit request for the parent widget.\n this.parent.fit();\n }\n\n /**\n * Find the tab area which contains the given client position.\n *\n * @param clientX - The client X position of interest.\n *\n * @param clientY - The client Y position of interest.\n *\n * @returns The geometry of the tab area at the given position, or\n * `null` if there is no tab area at the given position.\n */\n hitTestTabAreas(\n clientX: number,\n clientY: number\n ): DockLayout.ITabAreaGeometry | null {\n // Bail early if hit testing cannot produce valid results.\n if (!this._root || !this.parent || !this.parent.isVisible) {\n return null;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent.node);\n }\n\n // Convert from client to local coordinates.\n let rect = this.parent.node.getBoundingClientRect();\n let x = clientX - rect.left - this._box.borderLeft;\n let y = clientY - rect.top - this._box.borderTop;\n\n // Find the tab layout node at the local position.\n let tabNode = this._root.hitTestTabNodes(x, y);\n\n // Bail if a tab layout node was not found.\n if (!tabNode) {\n return null;\n }\n\n // Extract the data from the tab node.\n let { tabBar, top, left, width, height } = tabNode;\n\n // Compute the right and bottom edges of the tab area.\n let borderWidth = this._box.borderLeft + this._box.borderRight;\n let borderHeight = this._box.borderTop + this._box.borderBottom;\n let right = rect.width - borderWidth - (left + width);\n let bottom = rect.height - borderHeight - (top + height);\n\n // Return the hit test results.\n return { tabBar, x, y, top, left, right, bottom, width, height };\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n // Perform superclass initialization.\n super.init();\n\n // Attach each widget to the parent.\n for (const widget of this) {\n this.attachWidget(widget);\n }\n\n // Attach each handle to the parent.\n for (const handle of this.handles()) {\n this.parent!.node.appendChild(handle);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Attach the widget to the layout parent widget.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a no-op if the widget is already attached.\n */\n protected attachWidget(widget: Widget): void {\n // Do nothing if the widget is already attached.\n if (this.parent!.node === widget.node.parentNode) {\n return;\n }\n\n // Create the layout item for the widget.\n this._items.set(widget, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach the widget from the layout parent widget.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a no-op if the widget is not attached.\n */\n protected detachWidget(widget: Widget): void {\n // Do nothing if the widget is not attached.\n if (this.parent!.node !== widget.node.parentNode) {\n return;\n }\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Delete the layout item for the widget.\n let item = this._items.get(widget);\n if (item) {\n this._items.delete(widget);\n item.dispose();\n }\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Remove the specified widget from the layout structure.\n *\n * #### Notes\n * This is a no-op if the widget is not in the layout tree.\n *\n * This does not detach the widget from the parent node.\n */\n private _removeWidget(widget: Widget): void {\n // Bail early if there is no layout root.\n if (!this._root) {\n return;\n }\n\n // Find the tab node which contains the given widget.\n let tabNode = this._root.findTabNode(widget);\n\n // Bail early if the tab node is not found.\n if (!tabNode) {\n return;\n }\n\n Private.removeAria(widget);\n\n // If there are multiple tabs, just remove the widget's tab.\n if (tabNode.tabBar.titles.length > 1) {\n tabNode.tabBar.removeTab(widget.title);\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n tabNode.tabBar.titles.length == 1\n ) {\n const existingWidget = tabNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Display;\n }\n return;\n }\n\n // Otherwise, the tab node needs to be removed...\n\n // Dispose the tab bar.\n tabNode.tabBar.dispose();\n\n // Handle the case where the tab node is the root.\n if (this._root === tabNode) {\n this._root = null;\n return;\n }\n\n // Otherwise, remove the tab node from its parent...\n\n // Prevent widget resizing unless needed.\n this._root.holdAllSizes();\n\n // Clear the parent reference on the tab node.\n let splitNode = tabNode.parent!;\n tabNode.parent = null;\n\n // Remove the tab node from its parent split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);\n let handle = ArrayExt.removeAt(splitNode.handles, i)!;\n ArrayExt.removeAt(splitNode.sizers, i);\n\n // Remove the handle from its parent DOM node.\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n\n // If there are multiple children, just update the handles.\n if (splitNode.children.length > 1) {\n splitNode.syncHandles();\n return;\n }\n\n // Otherwise, the split node also needs to be removed...\n\n // Clear the parent reference on the split node.\n let maybeParent = splitNode.parent;\n splitNode.parent = null;\n\n // Lookup the remaining child node and handle.\n let childNode = splitNode.children[0];\n let childHandle = splitNode.handles[0];\n\n // Clear the split node data.\n splitNode.children.length = 0;\n splitNode.handles.length = 0;\n splitNode.sizers.length = 0;\n\n // Remove the child handle from its parent node.\n if (childHandle.parentNode) {\n childHandle.parentNode.removeChild(childHandle);\n }\n\n // Handle the case where the split node is the root.\n if (this._root === splitNode) {\n childNode.parent = null;\n this._root = childNode;\n return;\n }\n\n // Otherwise, move the child node to the parent node...\n let parentNode = maybeParent!;\n\n // Lookup the index of the split node.\n let j = parentNode.children.indexOf(splitNode);\n\n // Handle the case where the child node is a tab node.\n if (childNode instanceof Private.TabLayoutNode) {\n childNode.parent = parentNode;\n parentNode.children[j] = childNode;\n return;\n }\n\n // Remove the split data from the parent.\n let splitHandle = ArrayExt.removeAt(parentNode.handles, j)!;\n ArrayExt.removeAt(parentNode.children, j);\n ArrayExt.removeAt(parentNode.sizers, j);\n\n // Remove the handle from its parent node.\n if (splitHandle.parentNode) {\n splitHandle.parentNode.removeChild(splitHandle);\n }\n\n // The child node and the split parent node will have the same\n // orientation. Merge the grand-children with the parent node.\n for (let i = 0, n = childNode.children.length; i < n; ++i) {\n let gChild = childNode.children[i];\n let gHandle = childNode.handles[i];\n let gSizer = childNode.sizers[i];\n ArrayExt.insert(parentNode.children, j + i, gChild);\n ArrayExt.insert(parentNode.handles, j + i, gHandle);\n ArrayExt.insert(parentNode.sizers, j + i, gSizer);\n gChild.parent = parentNode;\n }\n\n // Clear the child node.\n childNode.children.length = 0;\n childNode.handles.length = 0;\n childNode.sizers.length = 0;\n childNode.parent = null;\n\n // Sync the handles on the parent node.\n parentNode.syncHandles();\n }\n\n /**\n * Create the tab layout node to hold the widget.\n */\n private _createTabNode(widget: Widget): Private.TabLayoutNode {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n Private.addAria(widget, tabNode.tabBar);\n return tabNode;\n }\n\n /**\n * Insert a widget next to an existing tab.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertTab(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n after: boolean\n ): void {\n // Do nothing if the tab is inserted next to itself.\n if (widget === ref) {\n return;\n }\n\n // Create the root if it does not exist.\n if (!this._root) {\n let tabNode = new Private.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n this._root = tabNode;\n Private.addAria(widget, tabNode.tabBar);\n return;\n }\n\n // Use the first tab node as the ref node if needed.\n if (!refNode) {\n refNode = this._root.findFirstTabNode()!;\n }\n\n // If the widget is not contained in the ref node, ensure it is\n // removed from the layout and hidden before being added again.\n if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n this._removeWidget(widget);\n widget.hide();\n }\n\n // Lookup the target index for inserting the tab.\n let index: number;\n if (ref) {\n index = refNode.tabBar.titles.indexOf(ref.title);\n } else {\n index = refNode.tabBar.currentIndex;\n }\n\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n if (refNode.tabBar.titles.length === 0) {\n // Singular tab should use display mode to limit number of layers.\n widget.hiddenMode = Widget.HiddenMode.Display;\n } else if (refNode.tabBar.titles.length == 1) {\n // If we are adding a second tab, switch the existing tab back to scale.\n const existingWidget = refNode.tabBar.titles[0].owner;\n existingWidget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n // For the third and subsequent tabs no special action is needed.\n widget.hiddenMode = Widget.HiddenMode.Scale;\n }\n } else {\n // For all other modes just propagate the current mode.\n widget.hiddenMode = this._hiddenMode;\n }\n\n // Insert the widget's tab relative to the target index.\n refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n Private.addAria(widget, refNode.tabBar);\n }\n\n /**\n * Insert a widget as a new split area.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n private _insertSplit(\n widget: Widget,\n ref: Widget | null,\n refNode: Private.TabLayoutNode | null,\n orientation: Private.Orientation,\n after: boolean,\n merge: boolean = false\n ): void {\n // Do nothing if there is no effective split.\n if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n return;\n }\n\n // Ensure the widget is removed from the current layout.\n this._removeWidget(widget);\n\n // Set the root if it does not exist.\n if (!this._root) {\n this._root = this._createTabNode(widget);\n return;\n }\n\n // If the ref node parent is null, split the root.\n if (!refNode || !refNode.parent) {\n // Ensure the root is split with the correct orientation.\n let root = this._splitRoot(orientation);\n\n // Determine the insert index for the new tab node.\n let i = after ? root.children.length : 0;\n\n // Normalize the split node.\n root.normalizeSizes();\n\n // Create the sizer for new tab node.\n let sizer = Private.createSizer(refNode ? 1 : Private.GOLDEN_RATIO);\n\n // Insert the tab node sized to the golden ratio.\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(root.children, i, tabNode);\n ArrayExt.insert(root.sizers, i, sizer);\n ArrayExt.insert(root.handles, i, this._createHandle());\n tabNode.parent = root;\n\n // Re-normalize the split node to maintain the ratios.\n root.normalizeSizes();\n\n // Finally, synchronize the visibility of the handles.\n root.syncHandles();\n return;\n }\n\n // Lookup the split node for the ref widget.\n let splitNode = refNode.parent;\n\n // If the split node already had the correct orientation,\n // the widget can be inserted into the split node directly.\n if (splitNode.orientation === orientation) {\n // Find the index of the ref node.\n let i = splitNode.children.indexOf(refNode);\n\n // Conditionally reuse a tab layout found in the wanted position.\n if (merge) {\n let j = i + (after ? 1 : -1);\n let sibling = splitNode.children[j];\n if (sibling instanceof Private.TabLayoutNode) {\n this._insertTab(widget, null, sibling, true);\n ++sibling.tabBar.currentIndex;\n return;\n }\n }\n\n // Normalize the split node.\n splitNode.normalizeSizes();\n\n // Consume half the space for the insert location.\n let s = (splitNode.sizers[i].sizeHint /= 2);\n\n // Insert the tab node sized to the other half.\n let j = i + (after ? 1 : 0);\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(splitNode.children, j, tabNode);\n ArrayExt.insert(splitNode.sizers, j, Private.createSizer(s));\n ArrayExt.insert(splitNode.handles, j, this._createHandle());\n tabNode.parent = splitNode;\n\n // Finally, synchronize the visibility of the handles.\n splitNode.syncHandles();\n return;\n }\n\n // Remove the ref node from the split node.\n let i = ArrayExt.removeFirstOf(splitNode.children, refNode);\n\n // Create a new normalized split node for the children.\n let childNode = new Private.SplitLayoutNode(orientation);\n childNode.normalized = true;\n\n // Add the ref node sized to half the space.\n childNode.children.push(refNode);\n childNode.sizers.push(Private.createSizer(0.5));\n childNode.handles.push(this._createHandle());\n refNode.parent = childNode;\n\n // Add the tab node sized to the other half.\n let j = after ? 1 : 0;\n let tabNode = this._createTabNode(widget);\n ArrayExt.insert(childNode.children, j, tabNode);\n ArrayExt.insert(childNode.sizers, j, Private.createSizer(0.5));\n ArrayExt.insert(childNode.handles, j, this._createHandle());\n tabNode.parent = childNode;\n\n // Synchronize the visibility of the handles.\n childNode.syncHandles();\n\n // Finally, add the new child node to the original split node.\n ArrayExt.insert(splitNode.children, i, childNode);\n childNode.parent = splitNode;\n }\n\n /**\n * Ensure the root is a split node with the given orientation.\n */\n private _splitRoot(\n orientation: Private.Orientation\n ): Private.SplitLayoutNode {\n // Bail early if the root already meets the requirements.\n let oldRoot = this._root;\n if (oldRoot instanceof Private.SplitLayoutNode) {\n if (oldRoot.orientation === orientation) {\n return oldRoot;\n }\n }\n\n // Create a new root node with the specified orientation.\n let newRoot = (this._root = new Private.SplitLayoutNode(orientation));\n\n // Add the old root to the new root.\n if (oldRoot) {\n newRoot.children.push(oldRoot);\n newRoot.sizers.push(Private.createSizer(0));\n newRoot.handles.push(this._createHandle());\n oldRoot.parent = newRoot;\n }\n\n // Return the new root as a convenience.\n return newRoot;\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the size limits for the layout tree.\n if (this._root) {\n let limits = this._root.fit(this._spacing, this._items);\n minW = limits.minWidth;\n minH = limits.minHeight;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Bail early if there is no root layout node.\n if (!this._root) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let x = this._box.paddingTop;\n let y = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the geometry of the layout tree.\n this._root.update(x, y, width, height, this._spacing, this._items);\n }\n\n /**\n * Create a new tab bar for use by the dock layout.\n *\n * #### Notes\n * The tab bar will be attached to the parent if it exists.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar using the renderer.\n let tabBar = this.renderer.createTabBar(this._document);\n\n // Enforce necessary tab bar behavior.\n tabBar.orientation = 'horizontal';\n\n // Attach the tab bar to the parent if possible.\n if (this.parent) {\n this.attachWidget(tabBar);\n }\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for the dock layout.\n *\n * #### Notes\n * The handle will be attached to the parent if it exists.\n */\n private _createHandle(): HTMLDivElement {\n // Create the handle using the renderer.\n let handle = this.renderer.createHandle();\n\n // Initialize the handle layout behavior.\n let style = handle.style;\n style.position = 'absolute';\n style.contain = 'strict';\n style.top = '0';\n style.left = '0';\n style.width = '0';\n style.height = '0';\n\n // Attach the handle to the parent if it exists.\n if (this.parent) {\n this.parent.node.appendChild(handle);\n }\n\n // Return the initialized handle.\n return handle;\n }\n\n private _spacing = 4;\n private _dirty = false;\n private _root: Private.LayoutNode | null = null;\n private _box: ElementExt.IBoxSizing | null = null;\n private _document: Document | ShadowRoot;\n private _hiddenMode: Widget.HiddenMode;\n private _items: Private.ItemMap = new Map();\n}\n\n/**\n * The namespace for the `DockLayout` class statics.\n */\nexport namespace DockLayout {\n /**\n * An options object for creating a dock layout.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * The renderer to use for the dock layout.\n */\n renderer: IRenderer;\n\n /**\n * The spacing between items in the layout.\n *\n * The default is `4`.\n */\n spacing?: number;\n }\n\n /**\n * A renderer for use with a dock layout.\n */\n export interface IRenderer {\n /**\n * Create a new tab bar for use with a dock layout.\n *\n * @returns A new tab bar for a dock layout.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar;\n\n /**\n * Create a new handle node for use with a dock layout.\n *\n * @returns A new handle node for a dock layout.\n */\n createHandle(): HTMLDivElement;\n }\n\n /**\n * A type alias for the supported insertion modes.\n *\n * An insert mode is used to specify how a widget should be added\n * to the dock layout relative to a reference widget.\n */\n export type InsertMode =\n | /**\n * The area to the top of the reference widget.\n *\n * The widget will be inserted just above the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the top edge of the dock layout.\n */\n 'split-top'\n\n /**\n * The area to the left of the reference widget.\n *\n * The widget will be inserted just left of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the left edge of the dock layout.\n */\n | 'split-left'\n\n /**\n * The area to the right of the reference widget.\n *\n * The widget will be inserted just right of the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the right edge of the dock layout.\n */\n | 'split-right'\n\n /**\n * The area to the bottom of the reference widget.\n *\n * The widget will be inserted just below the reference widget.\n *\n * If the reference widget is null or invalid, the widget will be\n * inserted at the bottom edge of the dock layout.\n */\n | 'split-bottom'\n\n /**\n * Like `split-top` but if a tab layout exists above the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-top'\n\n /**\n * Like `split-left` but if a tab layout exists left of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-left'\n\n /**\n * Like `split-right` but if a tab layout exists right of the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-right'\n\n /**\n * Like `split-bottom` but if a tab layout exists below the reference widget,\n * it behaves like `tab-after` with reference to that instead.\n */\n | 'merge-bottom'\n\n /**\n * The tab position before the reference widget.\n *\n * The widget will be added as a tab before the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-before'\n\n /**\n * The tab position after the reference widget.\n *\n * The widget will be added as a tab after the reference widget.\n *\n * If the reference widget is null or invalid, a sensible default\n * will be used.\n */\n | 'tab-after';\n\n /**\n * An options object for adding a widget to the dock layout.\n */\n export interface IAddOptions {\n /**\n * The insertion mode for adding the widget.\n *\n * The default is `'tab-after'`.\n */\n mode?: InsertMode;\n\n /**\n * The reference widget for the insert location.\n *\n * The default is `null`.\n */\n ref?: Widget | null;\n }\n\n /**\n * A layout config object for a tab area.\n */\n export interface ITabAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'tab-area';\n\n /**\n * The widgets contained in the tab area.\n */\n widgets: Widget[];\n\n /**\n * The index of the selected tab.\n */\n currentIndex: number;\n }\n\n /**\n * A layout config object for a split area.\n */\n export interface ISplitAreaConfig {\n /**\n * The discriminated type of the config object.\n */\n type: 'split-area';\n\n /**\n * The orientation of the split area.\n */\n orientation: 'horizontal' | 'vertical';\n\n /**\n * The children in the split area.\n */\n children: AreaConfig[];\n\n /**\n * The relative sizes of the children.\n */\n sizes: number[];\n }\n\n /**\n * A type alias for a general area config.\n */\n export type AreaConfig = ITabAreaConfig | ISplitAreaConfig;\n\n /**\n * A dock layout configuration object.\n */\n export interface ILayoutConfig {\n /**\n * The layout config for the main dock area.\n */\n main: AreaConfig | null;\n }\n\n /**\n * An object which represents the geometry of a tab area.\n */\n export interface ITabAreaGeometry {\n /**\n * The tab bar for the tab area.\n */\n tabBar: TabBar;\n\n /**\n * The local X position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the local X coordinate of the hit test query.\n */\n x: number;\n\n /**\n * The local Y position of the hit test in the dock area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the local Y coordinate of the hit test query.\n */\n y: number;\n\n /**\n * The local coordinate of the top edge of the tab area.\n *\n * #### Notes\n * This is the distance from the top edge of the layout parent\n * widget, to the top edge of the tab area.\n */\n top: number;\n\n /**\n * The local coordinate of the left edge of the tab area.\n *\n * #### Notes\n * This is the distance from the left edge of the layout parent\n * widget, to the left edge of the tab area.\n */\n left: number;\n\n /**\n * The local coordinate of the right edge of the tab area.\n *\n * #### Notes\n * This is the distance from the right edge of the layout parent\n * widget, to the right edge of the tab area.\n */\n right: number;\n\n /**\n * The local coordinate of the bottom edge of the tab area.\n *\n * #### Notes\n * This is the distance from the bottom edge of the layout parent\n * widget, to the bottom edge of the tab area.\n */\n bottom: number;\n\n /**\n * The width of the tab area.\n *\n * #### Notes\n * This is total width allocated for the tab area.\n */\n width: number;\n\n /**\n * The height of the tab area.\n *\n * #### Notes\n * This is total height allocated for the tab area.\n */\n height: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * A type alias for a dock layout node.\n */\n export type LayoutNode = TabLayoutNode | SplitLayoutNode;\n\n /**\n * A type alias for the orientation of a split layout node.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * A type alias for a layout item map.\n */\n export type ItemMap = Map;\n\n /**\n * Create a box sizer with an initial size hint.\n */\n export function createSizer(hint: number): BoxSizer {\n let sizer = new BoxSizer();\n sizer.sizeHint = hint;\n sizer.size = hint;\n return sizer;\n }\n\n /**\n * Normalize an area config object and collect the visited widgets.\n */\n export function normalizeAreaConfig(\n config: DockLayout.AreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n let result: DockLayout.AreaConfig | null;\n if (config.type === 'tab-area') {\n result = normalizeTabAreaConfig(config, widgetSet);\n } else {\n result = normalizeSplitAreaConfig(config, widgetSet);\n }\n return result;\n }\n\n /**\n * Convert a normalized area config into a layout tree.\n */\n export function realizeAreaConfig(\n config: DockLayout.AreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): LayoutNode {\n let node: LayoutNode;\n if (config.type === 'tab-area') {\n node = realizeTabAreaConfig(config, renderer, document);\n } else {\n node = realizeSplitAreaConfig(config, renderer, document);\n }\n return node;\n }\n\n /**\n * A layout node which holds the data for a tabbed area.\n */\n export class TabLayoutNode {\n /**\n * Construct a new tab layout node.\n *\n * @param tabBar - The tab bar to use for the layout node.\n */\n constructor(tabBar: TabBar) {\n let tabSizer = new BoxSizer();\n let widgetSizer = new BoxSizer();\n tabSizer.stretch = 0;\n widgetSizer.stretch = 1;\n this.tabBar = tabBar;\n this.sizers = [tabSizer, widgetSizer];\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * The tab bar for the layout node.\n */\n readonly tabBar: TabBar;\n\n /**\n * The sizers for the layout node.\n */\n readonly sizers: [BoxSizer, BoxSizer];\n\n /**\n * The most recent value for the `top` edge of the layout box.\n */\n get top(): number {\n return this._top;\n }\n\n /**\n * The most recent value for the `left` edge of the layout box.\n */\n get left(): number {\n return this._left;\n }\n\n /**\n * The most recent value for the `width` of the layout box.\n */\n get width(): number {\n return this._width;\n }\n\n /**\n * The most recent value for the `height` of the layout box.\n */\n get height(): number {\n return this._height;\n }\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n yield this.tabBar;\n yield* this.iterUserWidgets();\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const title of this.tabBar.titles) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n let title = this.tabBar.currentTitle;\n if (title) {\n yield title.owner;\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n yield this.tabBar;\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n // eslint-disable-next-line require-yield\n *iterHandles(): IterableIterator {\n return;\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n return this;\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n if (x < this._left || x >= this._left + this._width) {\n return null;\n }\n if (y < this._top || y >= this._top + this._height) {\n return null;\n }\n return this;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ITabAreaConfig {\n let widgets = this.tabBar.titles.map(title => title.owner);\n let currentIndex = this.tabBar.currentIndex;\n return { type: 'tab-area', widgets, currentIndex };\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n return;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Set up the limit variables.\n let minWidth = 0;\n let minHeight = 0;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Lookup the tab bar and widget sizers.\n let [tabBarSizer, widgetSizer] = this.sizers;\n\n // Update the tab bar limits.\n if (tabBarItem) {\n tabBarItem.fit();\n }\n\n // Update the widget limits.\n if (widgetItem) {\n widgetItem.fit();\n }\n\n // Update the results and sizer for the tab bar.\n if (tabBarItem && !tabBarItem.isHidden) {\n minWidth = Math.max(minWidth, tabBarItem.minWidth);\n minHeight += tabBarItem.minHeight;\n tabBarSizer.minSize = tabBarItem.minHeight;\n tabBarSizer.maxSize = tabBarItem.maxHeight;\n } else {\n tabBarSizer.minSize = 0;\n tabBarSizer.maxSize = 0;\n }\n\n // Update the results and sizer for the current widget.\n if (widgetItem && !widgetItem.isHidden) {\n minWidth = Math.max(minWidth, widgetItem.minWidth);\n minHeight += widgetItem.minHeight;\n widgetSizer.minSize = widgetItem.minHeight;\n widgetSizer.maxSize = Infinity;\n } else {\n widgetSizer.minSize = 0;\n widgetSizer.maxSize = Infinity;\n }\n\n // Return the computed size limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Update the layout box values.\n this._top = top;\n this._left = left;\n this._width = width;\n this._height = height;\n\n // Lookup the tab bar layout item.\n let tabBarItem = items.get(this.tabBar);\n\n // Lookup the widget layout item.\n let current = this.tabBar.currentTitle;\n let widgetItem = current ? items.get(current.owner) : undefined;\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, height);\n\n // Update the tab bar item using the computed size.\n if (tabBarItem && !tabBarItem.isHidden) {\n let size = this.sizers[0].size;\n tabBarItem.update(left, top, width, size);\n top += size;\n }\n\n // Layout the widget using the computed size.\n if (widgetItem && !widgetItem.isHidden) {\n let size = this.sizers[1].size;\n widgetItem.update(left, top, width, size);\n }\n }\n\n private _top = 0;\n private _left = 0;\n private _width = 0;\n private _height = 0;\n }\n\n /**\n * A layout node which holds the data for a split area.\n */\n export class SplitLayoutNode {\n /**\n * Construct a new split layout node.\n *\n * @param orientation - The orientation of the node.\n */\n constructor(orientation: Orientation) {\n this.orientation = orientation;\n }\n\n /**\n * The parent of the layout node.\n */\n parent: SplitLayoutNode | null = null;\n\n /**\n * Whether the sizers have been normalized.\n */\n normalized = false;\n\n /**\n * The orientation of the node.\n */\n readonly orientation: Orientation;\n\n /**\n * The child nodes for the split node.\n */\n readonly children: LayoutNode[] = [];\n\n /**\n * The box sizers for the layout children.\n */\n readonly sizers: BoxSizer[] = [];\n\n /**\n * The handles for the layout children.\n */\n readonly handles: HTMLDivElement[] = [];\n\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n *iterAllWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterAllWidgets();\n }\n }\n\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n *iterUserWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterUserWidgets();\n }\n }\n\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n *iterSelectedWidgets(): IterableIterator {\n for (const child of this.children) {\n yield* child.iterSelectedWidgets();\n }\n }\n\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n *iterTabBars(): IterableIterator> {\n for (const child of this.children) {\n yield* child.iterTabBars();\n }\n }\n\n /**\n * Create an iterator for the handles in the layout tree.\n */\n *iterHandles(): IterableIterator {\n yield* this.handles;\n for (const child of this.children) {\n yield* child.iterHandles();\n }\n }\n\n /**\n * Find the tab layout node which contains the given widget.\n */\n findTabNode(widget: Widget): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findTabNode(widget);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the split layout node which contains the given handle.\n */\n findSplitNode(\n handle: HTMLDivElement\n ): { index: number; node: SplitLayoutNode } | null {\n let index = this.handles.indexOf(handle);\n if (index !== -1) {\n return { index, node: this };\n }\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].findSplitNode(handle);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Find the first tab layout node in a layout tree.\n */\n findFirstTabNode(): TabLayoutNode | null {\n if (this.children.length === 0) {\n return null;\n }\n return this.children[0].findFirstTabNode();\n }\n\n /**\n * Find the tab layout node which contains the local point.\n */\n hitTestTabNodes(x: number, y: number): TabLayoutNode | null {\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let result = this.children[i].hitTestTabNodes(x, y);\n if (result) {\n return result;\n }\n }\n return null;\n }\n\n /**\n * Create a configuration object for the layout tree.\n */\n createConfig(): DockLayout.ISplitAreaConfig {\n let orientation = this.orientation;\n let sizes = this.createNormalizedSizes();\n let children = this.children.map(child => child.createConfig());\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Sync the visibility and orientation of the handles.\n */\n syncHandles(): void {\n this.handles.forEach((handle, i) => {\n handle.setAttribute('data-orientation', this.orientation);\n if (i === this.handles.length - 1) {\n handle.classList.add('lm-mod-hidden');\n } else {\n handle.classList.remove('lm-mod-hidden');\n }\n });\n }\n\n /**\n * Hold the current sizes of the box sizers.\n *\n * This sets the size hint of each sizer to its current size.\n */\n holdSizes(): void {\n for (const sizer of this.sizers) {\n sizer.sizeHint = sizer.size;\n }\n }\n\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n holdAllSizes(): void {\n for (const child of this.children) {\n child.holdAllSizes();\n }\n this.holdSizes();\n }\n\n /**\n * Normalize the sizes of the split layout node.\n */\n normalizeSizes(): void {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return;\n }\n\n // Hold the current sizes of the sizers.\n this.holdSizes();\n\n // Compute the sum of the sizes.\n let sum = this.sizers.reduce((v, sizer) => v + sizer.sizeHint, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint = 1 / n;\n }\n } else {\n for (const sizer of this.sizers) {\n sizer.size = sizer.sizeHint /= sum;\n }\n }\n\n // Mark the sizes as normalized.\n this.normalized = true;\n }\n\n /**\n * Snap the normalized sizes of the split layout node.\n */\n createNormalizedSizes(): number[] {\n // Bail early if the sizers are empty.\n let n = this.sizers.length;\n if (n === 0) {\n return [];\n }\n\n // Grab the current sizes of the sizers.\n let sizes = this.sizers.map(sizer => sizer.size);\n\n // Compute the sum of the sizes.\n let sum = sizes.reduce((v, size) => v + size, 0);\n\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] = 1 / n;\n }\n } else {\n for (let i = sizes.length - 1; i > -1; i--) {\n sizes[i] /= sum;\n }\n }\n\n // Return the normalized sizes.\n return sizes;\n }\n\n /**\n * Fit the layout tree.\n */\n fit(spacing: number, items: ItemMap): ElementExt.ISizeLimits {\n // Compute the required fixed space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n\n // Set up the limit variables.\n let minWidth = horizontal ? fixed : 0;\n let minHeight = horizontal ? 0 : fixed;\n let maxWidth = Infinity;\n let maxHeight = Infinity;\n\n // Fit the children and update the limits.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let limits = this.children[i].fit(spacing, items);\n if (horizontal) {\n minHeight = Math.max(minHeight, limits.minHeight);\n minWidth += limits.minWidth;\n this.sizers[i].minSize = limits.minWidth;\n } else {\n minWidth = Math.max(minWidth, limits.minWidth);\n minHeight += limits.minHeight;\n this.sizers[i].minSize = limits.minHeight;\n }\n }\n\n // Return the computed limits for the layout node.\n return { minWidth, minHeight, maxWidth, maxHeight };\n }\n\n /**\n * Update the layout tree.\n */\n update(\n left: number,\n top: number,\n width: number,\n height: number,\n spacing: number,\n items: ItemMap\n ): void {\n // Compute the available layout space.\n let horizontal = this.orientation === 'horizontal';\n let fixed = Math.max(0, this.children.length - 1) * spacing;\n let space = Math.max(0, (horizontal ? width : height) - fixed);\n\n // De-normalize the sizes if needed.\n if (this.normalized) {\n for (const sizer of this.sizers) {\n sizer.sizeHint *= space;\n }\n this.normalized = false;\n }\n\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, space);\n\n // Update the geometry of the child nodes and handles.\n for (let i = 0, n = this.children.length; i < n; ++i) {\n let child = this.children[i];\n let size = this.sizers[i].size;\n let handleStyle = this.handles[i].style;\n if (horizontal) {\n child.update(left, top, size, height, spacing, items);\n left += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${spacing}px`;\n handleStyle.height = `${height}px`;\n left += spacing;\n } else {\n child.update(left, top, width, size, spacing, items);\n top += size;\n handleStyle.top = `${top}px`;\n handleStyle.left = `${left}px`;\n handleStyle.width = `${width}px`;\n handleStyle.height = `${spacing}px`;\n top += spacing;\n }\n }\n }\n }\n\n export function addAria(widget: Widget, tabBar: TabBar): void {\n widget.node.setAttribute('role', 'tabpanel');\n let renderer = tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n export function removeAria(widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n }\n\n /**\n * Normalize a tab area config and collect the visited widgets.\n */\n function normalizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n widgetSet: Set\n ): DockLayout.ITabAreaConfig | null {\n // Bail early if there is no content.\n if (config.widgets.length === 0) {\n return null;\n }\n\n // Setup the filtered widgets array.\n let widgets: Widget[] = [];\n\n // Filter the config for unique widgets.\n for (const widget of config.widgets) {\n if (!widgetSet.has(widget)) {\n widgetSet.add(widget);\n widgets.push(widget);\n }\n }\n\n // Bail if there are no effective widgets.\n if (widgets.length === 0) {\n return null;\n }\n\n // Normalize the current index.\n let index = config.currentIndex;\n if (index !== -1 && (index < 0 || index >= widgets.length)) {\n index = 0;\n }\n\n // Return a normalized config object.\n return { type: 'tab-area', widgets, currentIndex: index };\n }\n\n /**\n * Normalize a split area config and collect the visited widgets.\n */\n function normalizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n widgetSet: Set\n ): DockLayout.AreaConfig | null {\n // Set up the result variables.\n let orientation = config.orientation;\n let children: DockLayout.AreaConfig[] = [];\n let sizes: number[] = [];\n\n // Normalize the config children.\n for (let i = 0, n = config.children.length; i < n; ++i) {\n // Normalize the child config.\n let child = normalizeAreaConfig(config.children[i], widgetSet);\n\n // Ignore an empty child.\n if (!child) {\n continue;\n }\n\n // Add the child or hoist its content as appropriate.\n if (child.type === 'tab-area' || child.orientation !== orientation) {\n children.push(child);\n sizes.push(Math.abs(config.sizes[i] || 0));\n } else {\n children.push(...child.children);\n sizes.push(...child.sizes);\n }\n }\n\n // Bail if there are no effective children.\n if (children.length === 0) {\n return null;\n }\n\n // If there is only one effective child, return that child.\n if (children.length === 1) {\n return children[0];\n }\n\n // Return a normalized config object.\n return { type: 'split-area', orientation, children, sizes };\n }\n\n /**\n * Convert a normalized tab area config into a layout tree.\n */\n function realizeTabAreaConfig(\n config: DockLayout.ITabAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): TabLayoutNode {\n // Create the tab bar for the layout node.\n let tabBar = renderer.createTabBar(document);\n\n // Hide each widget and add it to the tab bar.\n for (const widget of config.widgets) {\n widget.hide();\n tabBar.addTab(widget.title);\n Private.addAria(widget, tabBar);\n }\n\n // Set the current index of the tab bar.\n tabBar.currentIndex = config.currentIndex;\n\n // Return the new tab layout node.\n return new TabLayoutNode(tabBar);\n }\n\n /**\n * Convert a normalized split area config into a layout tree.\n */\n function realizeSplitAreaConfig(\n config: DockLayout.ISplitAreaConfig,\n renderer: DockLayout.IRenderer,\n document: Document | ShadowRoot\n ): SplitLayoutNode {\n // Create the split layout node.\n let node = new SplitLayoutNode(config.orientation);\n\n // Add each child to the layout node.\n config.children.forEach((child, i) => {\n // Create the child data for the layout node.\n let childNode = realizeAreaConfig(child, renderer, document);\n let sizer = createSizer(config.sizes[i]);\n let handle = renderer.createHandle();\n\n // Add the child data to the layout node.\n node.children.push(childNode);\n node.handles.push(handle);\n node.sizers.push(sizer);\n\n // Update the parent for the child node.\n childNode.parent = node;\n });\n\n // Synchronize the handle state for the layout node.\n node.syncHandles();\n\n // Normalize the sizes for the layout node.\n node.normalizeSizes();\n\n // Return the new layout node.\n return node;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { find } from '@lumino/algorithm';\n\nimport { MimeData } from '@lumino/coreutils';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt, Platform } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { ConflatableMessage, Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { DockLayout } from './docklayout';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which provides a flexible docking area for widgets.\n */\nexport class DockPanel extends Widget {\n /**\n * Construct a new dock panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: DockPanel.IOptions = {}) {\n super();\n this.addClass('lm-DockPanel');\n this._document = options.document || document;\n this._mode = options.mode || 'multiple-document';\n this._renderer = options.renderer || DockPanel.defaultRenderer;\n this._edges = options.edges || Private.DEFAULT_EDGES;\n if (options.tabsMovable !== undefined) {\n this._tabsMovable = options.tabsMovable;\n }\n if (options.tabsConstrained !== undefined) {\n this._tabsConstrained = options.tabsConstrained;\n }\n if (options.addButtonEnabled !== undefined) {\n this._addButtonEnabled = options.addButtonEnabled;\n }\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = this._mode;\n\n // Create the delegate renderer for the layout.\n let renderer: DockPanel.IRenderer = {\n createTabBar: () => this._createTabBar(),\n createHandle: () => this._createHandle()\n };\n\n // Set up the dock layout for the panel.\n this.layout = new DockLayout({\n document: this._document,\n renderer,\n spacing: options.spacing,\n hiddenMode: options.hiddenMode\n });\n\n // Set up the overlay drop indicator.\n this.overlay = options.overlay || new DockPanel.Overlay();\n this.node.appendChild(this.overlay.node);\n }\n\n /**\n * Dispose of the resources held by the panel.\n */\n dispose(): void {\n // Ensure the mouse is released.\n this._releaseMouse();\n\n // Hide the overlay.\n this.overlay.hide(0);\n\n // Cancel a drag if one is in progress.\n if (this._drag) {\n this._drag.dispose();\n }\n\n // Dispose of the base class.\n super.dispose();\n }\n\n /**\n * The method for hiding widgets.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as DockLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as DockLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when the layout configuration is modified.\n *\n * #### Notes\n * This signal is emitted whenever the current layout configuration\n * may have changed.\n *\n * This signal is emitted asynchronously in a collapsed fashion, so\n * that multiple synchronous modifications results in only a single\n * emit of the signal.\n */\n get layoutModified(): ISignal {\n return this._layoutModified;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The overlay used by the dock panel.\n */\n readonly overlay: DockPanel.IOverlay;\n\n /**\n * The renderer used by the dock panel.\n */\n get renderer(): DockPanel.IRenderer {\n return (this.layout as DockLayout).renderer;\n }\n\n /**\n * Get the spacing between the widgets.\n */\n get spacing(): number {\n return (this.layout as DockLayout).spacing;\n }\n\n /**\n * Set the spacing between the widgets.\n */\n set spacing(value: number) {\n (this.layout as DockLayout).spacing = value;\n }\n\n /**\n * Get the mode for the dock panel.\n */\n get mode(): DockPanel.Mode {\n return this._mode;\n }\n\n /**\n * Set the mode for the dock panel.\n *\n * #### Notes\n * Changing the mode is a destructive operation with respect to the\n * panel's layout configuration. If layout state must be preserved,\n * save the current layout config before changing the mode.\n */\n set mode(value: DockPanel.Mode) {\n // Bail early if the mode does not change.\n if (this._mode === value) {\n return;\n }\n\n // Update the internal mode.\n this._mode = value;\n\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = value;\n\n // Get the layout for the panel.\n let layout = this.layout as DockLayout;\n\n // Configure the layout for the specified mode.\n switch (value) {\n case 'multiple-document':\n for (const tabBar of layout.tabBars()) {\n tabBar.show();\n }\n break;\n case 'single-document':\n layout.restoreLayout(Private.createSingleDocumentConfig(this));\n break;\n default:\n throw 'unreachable';\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Whether the tabs can be dragged / moved at runtime.\n */\n get tabsMovable(): boolean {\n return this._tabsMovable;\n }\n\n /**\n * Enable / Disable draggable / movable tabs.\n */\n set tabsMovable(value: boolean) {\n this._tabsMovable = value;\n for (const tabBar of this.tabBars()) {\n tabBar.tabsMovable = value;\n }\n }\n\n /**\n * Whether the tabs are constrained to their source dock panel\n */\n get tabsConstrained(): boolean {\n return this._tabsConstrained;\n }\n\n /**\n * Constrain/Allow tabs to be dragged outside of this dock panel\n */\n set tabsConstrained(value: boolean) {\n this._tabsConstrained = value;\n }\n\n /**\n * Whether the add buttons for each tab bar are enabled.\n */\n get addButtonEnabled(): boolean {\n return this._addButtonEnabled;\n }\n\n /**\n * Set whether the add buttons for each tab bar are enabled.\n */\n set addButtonEnabled(value: boolean) {\n this._addButtonEnabled = value;\n for (const tabBar of this.tabBars()) {\n tabBar.addButtonEnabled = value;\n }\n }\n\n /**\n * Whether the dock panel is empty.\n */\n get isEmpty(): boolean {\n return (this.layout as DockLayout).isEmpty;\n }\n\n /**\n * Create an iterator over the user widgets in the panel.\n *\n * @returns A new iterator over the user widgets in the panel.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n *widgets(): IterableIterator {\n yield* (this.layout as DockLayout).widgets();\n }\n\n /**\n * Create an iterator over the selected widgets in the panel.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the panel.\n */\n *selectedWidgets(): IterableIterator {\n yield* (this.layout as DockLayout).selectedWidgets();\n }\n\n /**\n * Create an iterator over the tab bars in the panel.\n *\n * @returns A new iterator over the tab bars in the panel.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n *tabBars(): IterableIterator> {\n yield* (this.layout as DockLayout).tabBars();\n }\n\n /**\n * Create an iterator over the handles in the panel.\n *\n * @returns A new iterator over the handles in the panel.\n */\n *handles(): IterableIterator {\n yield* (this.layout as DockLayout).handles();\n }\n\n /**\n * Select a specific widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will make the widget the current widget in its tab area.\n */\n selectWidget(widget: Widget): void {\n // Find the tab bar which contains the widget.\n let tabBar = find(this.tabBars(), bar => {\n return bar.titles.indexOf(widget.title) !== -1;\n });\n\n // Throw an error if no tab bar is found.\n if (!tabBar) {\n throw new Error('Widget is not contained in the dock panel.');\n }\n\n // Ensure the widget is the current widget.\n tabBar.currentTitle = widget.title;\n }\n\n /**\n * Activate a specified widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will select and activate the given widget.\n */\n activateWidget(widget: Widget): void {\n this.selectWidget(widget);\n widget.activate();\n }\n\n /**\n * Save the current layout configuration of the dock panel.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n saveLayout(): DockPanel.ILayoutConfig {\n return (this.layout as DockLayout).saveLayout();\n }\n\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n *\n * The dock panel automatically reverts to `'multiple-document'`\n * mode when a layout config is restored.\n */\n restoreLayout(config: DockPanel.ILayoutConfig): void {\n // Reset the mode.\n this._mode = 'multiple-document';\n\n // Restore the layout.\n (this.layout as DockLayout).restoreLayout(config);\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Add a widget to the dock panel.\n *\n * @param widget - The widget to add to the dock panel.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * If the panel is in single document mode, the options are ignored\n * and the widget is always added as tab in the hidden tab bar.\n */\n addWidget(widget: Widget, options: DockPanel.IAddOptions = {}): void {\n // Add the widget to the layout.\n if (this._mode === 'single-document') {\n (this.layout as DockLayout).addWidget(widget);\n } else {\n (this.layout as DockLayout).addWidget(widget, options);\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n */\n processMessage(msg: Message): void {\n if (msg.type === 'layout-modified') {\n this._layoutModified.emit(undefined);\n } else {\n super.processMessage(msg);\n }\n }\n\n /**\n * Handle the DOM events for the dock panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'lm-dragenter':\n this._evtDragEnter(event as Drag.Event);\n break;\n case 'lm-dragleave':\n this._evtDragLeave(event as Drag.Event);\n break;\n case 'lm-dragover':\n this._evtDragOver(event as Drag.Event);\n break;\n case 'lm-drop':\n this._evtDrop(event as Drag.Event);\n break;\n case 'pointerdown':\n this._evtPointerDown(event as PointerEvent);\n break;\n case 'pointermove':\n this._evtPointerMove(event as PointerEvent);\n break;\n case 'pointerup':\n this._evtPointerUp(event as PointerEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('lm-dragenter', this);\n this.node.addEventListener('lm-dragleave', this);\n this.node.addEventListener('lm-dragover', this);\n this.node.addEventListener('lm-drop', this);\n this.node.addEventListener('pointerdown', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('lm-dragenter', this);\n this.node.removeEventListener('lm-dragleave', this);\n this.node.removeEventListener('lm-dragover', this);\n this.node.removeEventListener('lm-drop', this);\n this.node.removeEventListener('pointerdown', this);\n this._releaseMouse();\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Add the widget class to the child.\n msg.child.addClass('lm-DockPanel-widget');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n // Ignore the generated tab bars.\n if (Private.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n\n // Remove the widget class from the child.\n msg.child.removeClass('lm-DockPanel-widget');\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `'lm-dragenter'` event for the dock panel.\n */\n private _evtDragEnter(event: Drag.Event): void {\n // If the factory mime type is present, mark the event as\n // handled in order to get the rest of the drag events.\n if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handle the `'lm-dragleave'` event for the dock panel.\n */\n private _evtDragLeave(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n if (this._tabsConstrained && event.source !== this) return;\n\n event.stopPropagation();\n\n // The new target might be a descendant, so we might still handle the drop.\n // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n // hide is cancelled by the lm-dragover handler's show overlay logic.\n this.overlay.hide(1);\n }\n\n /**\n * Handle the `'lm-dragover'` event for the dock panel.\n */\n private _evtDragOver(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Show the drop indicator overlay and update the drop\n // action based on the drop target zone under the mouse.\n if (\n (this._tabsConstrained && event.source !== this) ||\n this._showOverlay(event.clientX, event.clientY) === 'invalid'\n ) {\n event.dropAction = 'none';\n } else {\n event.stopPropagation();\n event.dropAction = event.proposedAction;\n }\n }\n\n /**\n * Handle the `'lm-drop'` event for the dock panel.\n */\n private _evtDrop(event: Drag.Event): void {\n // Mark the event as handled.\n event.preventDefault();\n\n // Hide the drop indicator overlay.\n this.overlay.hide(0);\n\n // Bail if the proposed action is to do nothing.\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n\n // Find the drop target under the mouse.\n let { clientX, clientY } = event;\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // Bail if the drop zone is invalid.\n if (\n (this._tabsConstrained && event.source !== this) ||\n zone === 'invalid'\n ) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory mime type has invalid data.\n let mimeData = event.mimeData;\n let factory = mimeData.getData('application/vnd.lumino.widget-factory');\n if (typeof factory !== 'function') {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the factory does not produce a widget.\n let widget = factory();\n if (!(widget instanceof Widget)) {\n event.dropAction = 'none';\n return;\n }\n\n // Bail if the widget is an ancestor of the dock panel.\n if (widget.contains(this)) {\n event.dropAction = 'none';\n return;\n }\n\n // Find the reference widget for the drop target.\n let ref = target ? Private.getDropRef(target.tabBar) : null;\n\n // Add the widget according to the indicated drop zone.\n switch (zone) {\n case 'root-all':\n this.addWidget(widget);\n break;\n case 'root-top':\n this.addWidget(widget, { mode: 'split-top' });\n break;\n case 'root-left':\n this.addWidget(widget, { mode: 'split-left' });\n break;\n case 'root-right':\n this.addWidget(widget, { mode: 'split-right' });\n break;\n case 'root-bottom':\n this.addWidget(widget, { mode: 'split-bottom' });\n break;\n case 'widget-all':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n case 'widget-top':\n this.addWidget(widget, { mode: 'split-top', ref });\n break;\n case 'widget-left':\n this.addWidget(widget, { mode: 'split-left', ref });\n break;\n case 'widget-right':\n this.addWidget(widget, { mode: 'split-right', ref });\n break;\n case 'widget-bottom':\n this.addWidget(widget, { mode: 'split-bottom', ref });\n break;\n case 'widget-tab':\n this.addWidget(widget, { mode: 'tab-after', ref });\n break;\n default:\n throw 'unreachable';\n }\n\n // Accept the proposed drop action.\n event.dropAction = event.proposedAction;\n\n // Stop propagation if we have not bailed so far.\n event.stopPropagation();\n\n // Activate the dropped widget.\n this.activateWidget(widget);\n }\n\n /**\n * Handle the `'keydown'` event for the dock panel.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n }\n\n /**\n * Handle the `'pointerdown'` event for the dock panel.\n */\n private _evtPointerDown(event: PointerEvent): void {\n // Do nothing if the left mouse button is not pressed.\n if (event.button !== 0) {\n return;\n }\n\n // Find the handle which contains the mouse target, if any.\n let layout = this.layout as DockLayout;\n let target = event.target as HTMLElement;\n let handle = find(layout.handles(), handle => handle.contains(target));\n if (!handle) {\n return;\n }\n\n // Stop the event when a handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n\n // Add the extra document listeners.\n this._document.addEventListener('keydown', this, true);\n this._document.addEventListener('pointerup', this, true);\n this._document.addEventListener('pointermove', this, true);\n this._document.addEventListener('contextmenu', this, true);\n\n // Compute the offset deltas for the handle press.\n let rect = handle.getBoundingClientRect();\n let deltaX = event.clientX - rect.left;\n let deltaY = event.clientY - rect.top;\n\n // Override the cursor and store the press data.\n let style = window.getComputedStyle(handle);\n let override = Drag.overrideCursor(style.cursor!, this._document);\n this._pressData = { handle, deltaX, deltaY, override };\n }\n\n /**\n * Handle the `'pointermove'` event for the dock panel.\n */\n private _evtPointerMove(event: PointerEvent): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event when dragging a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Compute the desired offset position for the handle.\n let rect = this.node.getBoundingClientRect();\n let xPos = event.clientX - rect.left - this._pressData.deltaX;\n let yPos = event.clientY - rect.top - this._pressData.deltaY;\n\n // Set the handle as close to the desired position as possible.\n let layout = this.layout as DockLayout;\n layout.moveHandle(this._pressData.handle, xPos, yPos);\n }\n\n /**\n * Handle the `'pointerup'` event for the dock panel.\n */\n private _evtPointerUp(event: PointerEvent): void {\n // Do nothing if the left mouse button is not released.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n\n // Finalize the mouse release.\n this._releaseMouse();\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Release the mouse grab for the dock panel.\n */\n private _releaseMouse(): void {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra document listeners.\n this._document.removeEventListener('keydown', this, true);\n this._document.removeEventListener('pointerup', this, true);\n this._document.removeEventListener('pointermove', this, true);\n this._document.removeEventListener('contextmenu', this, true);\n }\n\n /**\n * Show the overlay indicator at the given client position.\n *\n * Returns the drop zone at the specified client position.\n *\n * #### Notes\n * If the position is not over a valid zone, the overlay is hidden.\n */\n private _showOverlay(clientX: number, clientY: number): Private.DropZone {\n // Find the dock target for the given client position.\n let { zone, target } = Private.findDropTarget(\n this,\n clientX,\n clientY,\n this._edges\n );\n\n // If the drop zone is invalid, hide the overlay and bail.\n if (zone === 'invalid') {\n this.overlay.hide(100);\n return zone;\n }\n\n // Setup the variables needed to compute the overlay geometry.\n let top: number;\n let left: number;\n let right: number;\n let bottom: number;\n let box = ElementExt.boxSizing(this.node); // TODO cache this?\n let rect = this.node.getBoundingClientRect();\n\n // Compute the overlay geometry based on the dock zone.\n switch (zone) {\n case 'root-all':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-top':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = rect.height * Private.GOLDEN_RATIO;\n break;\n case 'root-left':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = rect.width * Private.GOLDEN_RATIO;\n bottom = box.paddingBottom;\n break;\n case 'root-right':\n top = box.paddingTop;\n left = rect.width * Private.GOLDEN_RATIO;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-bottom':\n top = rect.height * Private.GOLDEN_RATIO;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'widget-all':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-top':\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height / 2;\n break;\n case 'widget-left':\n top = target!.top;\n left = target!.left;\n right = target!.right + target!.width / 2;\n bottom = target!.bottom;\n break;\n case 'widget-right':\n top = target!.top;\n left = target!.left + target!.width / 2;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-bottom':\n top = target!.top + target!.height / 2;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom;\n break;\n case 'widget-tab': {\n const tabHeight = target!.tabBar.node.getBoundingClientRect().height;\n top = target!.top;\n left = target!.left;\n right = target!.right;\n bottom = target!.bottom + target!.height - tabHeight;\n break;\n }\n default:\n throw 'unreachable';\n }\n\n // Show the overlay with the computed geometry.\n this.overlay.show({ top, left, right, bottom });\n\n // Finally, return the computed drop zone.\n return zone;\n }\n\n /**\n * Create a new tab bar for use by the panel.\n */\n private _createTabBar(): TabBar {\n // Create the tab bar.\n let tabBar = this._renderer.createTabBar(this._document);\n\n // Set the generated tab bar property for the tab bar.\n Private.isGeneratedTabBarProperty.set(tabBar, true);\n\n // Hide the tab bar when in single document mode.\n if (this._mode === 'single-document') {\n tabBar.hide();\n }\n\n // Enforce necessary tab bar behavior.\n // TODO do we really want to enforce *all* of these?\n tabBar.tabsMovable = this._tabsMovable;\n tabBar.allowDeselect = false;\n tabBar.addButtonEnabled = this._addButtonEnabled;\n tabBar.removeBehavior = 'select-previous-tab';\n tabBar.insertBehavior = 'select-tab-if-needed';\n\n // Connect the signal handlers for the tab bar.\n tabBar.tabMoved.connect(this._onTabMoved, this);\n tabBar.currentChanged.connect(this._onCurrentChanged, this);\n tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Return the initialized tab bar.\n return tabBar;\n }\n\n /**\n * Create a new handle for use by the panel.\n */\n private _createHandle(): HTMLDivElement {\n return this._renderer.createHandle();\n }\n\n /**\n * Handle the `tabMoved` signal from a tab bar.\n */\n private _onTabMoved(): void {\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `currentChanged` signal from a tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousTitle, currentTitle } = args;\n\n // Hide the previous widget.\n if (previousTitle) {\n previousTitle.owner.hide();\n }\n\n // Show the current widget.\n if (currentTitle) {\n currentTitle.owner.show();\n }\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n\n // Schedule an emit of the layout modified signal.\n MessageLoop.postMessage(this, Private.LayoutModified);\n }\n\n /**\n * Handle the `addRequested` signal from a tab bar.\n */\n private _onTabAddRequested(sender: TabBar): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from a tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from a tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabDetachRequested` signal from a tab bar.\n */\n private _onTabDetachRequested(\n sender: TabBar,\n args: TabBar.ITabDetachRequestedArgs\n ): void {\n // Do nothing if a drag is already in progress.\n if (this._drag) {\n return;\n }\n\n // Release the tab bar's hold on the mouse.\n sender.releaseMouse();\n\n // Extract the data from the args.\n let { title, tab, clientX, clientY, offset } = args;\n\n // Setup the mime data for the drag operation.\n let mimeData = new MimeData();\n let factory = () => title.owner;\n mimeData.setData('application/vnd.lumino.widget-factory', factory);\n\n // Create the drag image for the drag operation.\n let dragImage = tab.cloneNode(true) as HTMLElement;\n if (offset) {\n dragImage.style.top = `-${offset.y}px`;\n dragImage.style.left = `-${offset.x}px`;\n }\n\n // Create the drag object to manage the drag-drop operation.\n this._drag = new Drag({\n document: this._document,\n mimeData,\n dragImage,\n proposedAction: 'move',\n supportedActions: 'move',\n source: this\n });\n\n // Hide the tab node in the original tab.\n tab.classList.add('lm-mod-hidden');\n let cleanup = () => {\n this._drag = null;\n tab.classList.remove('lm-mod-hidden');\n };\n\n // Start the drag operation and cleanup when done.\n this._drag.start(clientX, clientY).then(cleanup);\n }\n\n private _edges: DockPanel.IEdges;\n private _document: Document | ShadowRoot;\n private _mode: DockPanel.Mode;\n private _drag: Drag | null = null;\n private _renderer: DockPanel.IRenderer;\n private _tabsMovable: boolean = true;\n private _tabsConstrained: boolean = false;\n private _addButtonEnabled: boolean = false;\n private _pressData: Private.IPressData | null = null;\n private _layoutModified = new Signal(this);\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `DockPanel` class statics.\n */\nexport namespace DockPanel {\n /**\n * An options object for creating a dock panel.\n */\n export interface IOptions {\n /**\n * The document to use with the dock panel.\n *\n * The default is the global `document` instance.\n */\n\n document?: Document | ShadowRoot;\n /**\n * The overlay to use with the dock panel.\n *\n * The default is a new `Overlay` instance.\n */\n overlay?: IOverlay;\n\n /**\n * The renderer to use for the dock panel.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n\n /**\n * The spacing between the items in the panel.\n *\n * The default is `4`.\n */\n spacing?: number;\n\n /**\n * The mode for the dock panel.\n *\n * The default is `'multiple-document'`.\n */\n mode?: DockPanel.Mode;\n\n /**\n * The sizes of the edge drop zones, in pixels.\n * If not given, default values will be used.\n */\n edges?: IEdges;\n\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n\n /**\n * Allow tabs to be draggable / movable by user.\n *\n * The default is `'true'`.\n */\n tabsMovable?: boolean;\n\n /**\n * Constrain tabs to this dock panel\n *\n * The default is `'false'`.\n */\n tabsConstrained?: boolean;\n\n /**\n * Enable add buttons in each of the dock panel's tab bars.\n *\n * The default is `'false'`.\n */\n addButtonEnabled?: boolean;\n }\n\n /**\n * The sizes of the edge drop zones, in pixels.\n */\n export interface IEdges {\n /**\n * The size of the top edge drop zone.\n */\n top: number;\n\n /**\n * The size of the right edge drop zone.\n */\n right: number;\n\n /**\n * The size of the bottom edge drop zone.\n */\n bottom: number;\n\n /**\n * The size of the left edge drop zone.\n */\n left: number;\n }\n\n /**\n * A type alias for the supported dock panel modes.\n */\n export type Mode =\n | /**\n * The single document mode.\n *\n * In this mode, only a single widget is visible at a time, and that\n * widget fills the available layout space. No tab bars are visible.\n */\n 'single-document'\n\n /**\n * The multiple document mode.\n *\n * In this mode, multiple documents are displayed in separate tab\n * areas, and those areas can be individually resized by the user.\n */\n | 'multiple-document';\n\n /**\n * A type alias for a layout configuration object.\n */\n export type ILayoutConfig = DockLayout.ILayoutConfig;\n\n /**\n * A type alias for the supported insertion modes.\n */\n export type InsertMode = DockLayout.InsertMode;\n\n /**\n * A type alias for the add widget options.\n */\n export type IAddOptions = DockLayout.IAddOptions;\n\n /**\n * An object which holds the geometry for overlay positioning.\n */\n export interface IOverlayGeometry {\n /**\n * The distance between the overlay and parent top edges.\n */\n top: number;\n\n /**\n * The distance between the overlay and parent left edges.\n */\n left: number;\n\n /**\n * The distance between the overlay and parent right edges.\n */\n right: number;\n\n /**\n * The distance between the overlay and parent bottom edges.\n */\n bottom: number;\n }\n\n /**\n * An object which manages the overlay node for a dock panel.\n */\n export interface IOverlay {\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n *\n * #### Notes\n * The given geometry values assume the node will use absolute\n * positioning.\n *\n * This is called on every mouse move event during a drag in order\n * to update the position of the overlay. It should be efficient.\n */\n show(geo: IOverlayGeometry): void;\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 should hide the overlay immediately.\n *\n * #### Notes\n * This is called whenever the overlay node should been hidden.\n */\n hide(delay: number): void;\n }\n\n /**\n * A concrete implementation of `IOverlay`.\n *\n * This is the default overlay implementation for a dock panel.\n */\n export class Overlay implements IOverlay {\n /**\n * Construct a new overlay.\n */\n constructor() {\n this.node = document.createElement('div');\n this.node.classList.add('lm-DockPanel-overlay');\n this.node.classList.add('lm-mod-hidden');\n this.node.style.position = 'absolute';\n this.node.style.contain = 'strict';\n }\n\n /**\n * The DOM node for the overlay.\n */\n readonly node: HTMLDivElement;\n\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n */\n show(geo: IOverlayGeometry): void {\n // Update the position of the overlay.\n let style = this.node.style;\n style.top = `${geo.top}px`;\n style.left = `${geo.left}px`;\n style.right = `${geo.right}px`;\n style.bottom = `${geo.bottom}px`;\n\n // Clear any pending hide timer.\n clearTimeout(this._timer);\n this._timer = -1;\n\n // If the overlay is already visible, we're done.\n if (!this._hidden) {\n return;\n }\n\n // Clear the hidden flag.\n this._hidden = false;\n\n // Finally, show the overlay.\n this.node.classList.remove('lm-mod-hidden');\n }\n\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 will hide the overlay immediately.\n */\n hide(delay: number): void {\n // Do nothing if the overlay is already hidden.\n if (this._hidden) {\n return;\n }\n\n // Hide immediately if the delay is <= 0.\n if (delay <= 0) {\n clearTimeout(this._timer);\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n return;\n }\n\n // Do nothing if a hide is already pending.\n if (this._timer !== -1) {\n return;\n }\n\n // Otherwise setup the hide timer.\n this._timer = window.setTimeout(() => {\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n }, delay);\n }\n\n private _timer = -1;\n private _hidden = true;\n }\n\n /**\n * A type alias for a dock panel renderer;\n */\n export type IRenderer = DockLayout.IRenderer;\n\n /**\n * The default implementation of `IRenderer`.\n */\n export class Renderer implements IRenderer {\n /**\n * Create a new tab bar for use with a dock panel.\n *\n * @returns A new tab bar for a dock panel.\n */\n createTabBar(document?: Document | ShadowRoot): TabBar {\n let bar = new TabBar({ document });\n bar.addClass('lm-DockPanel-tabBar');\n return bar;\n }\n\n /**\n * Create a new handle node for use with a dock panel.\n *\n * @returns A new handle node for a dock panel.\n */\n createHandle(): HTMLDivElement {\n let handle = document.createElement('div');\n handle.className = 'lm-DockPanel-handle';\n return handle;\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n export const GOLDEN_RATIO = 0.618;\n\n /**\n * The default sizes for the edge drop zones, in pixels.\n */\n export const DEFAULT_EDGES = {\n /**\n * The size of the top edge dock zone for the root panel, in pixels.\n * This is different from the others to distinguish between the top\n * tab bar and the top root zone.\n */\n top: 12,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n right: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n bottom: 40,\n\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n left: 40\n };\n\n /**\n * A singleton `'layout-modified'` conflatable message.\n */\n export const LayoutModified = new ConflatableMessage('layout-modified');\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The handle which was pressed.\n */\n handle: HTMLDivElement;\n\n /**\n * The X offset of the press in handle coordinates.\n */\n deltaX: number;\n\n /**\n * The Y offset of the press in handle coordinates.\n */\n deltaY: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n }\n\n /**\n * A type alias for a drop zone.\n */\n export type DropZone =\n | /**\n * An invalid drop zone.\n */\n 'invalid'\n\n /**\n * The entirety of the root dock area.\n */\n | 'root-all'\n\n /**\n * The top portion of the root dock area.\n */\n | 'root-top'\n\n /**\n * The left portion of the root dock area.\n */\n | 'root-left'\n\n /**\n * The right portion of the root dock area.\n */\n | 'root-right'\n\n /**\n * The bottom portion of the root dock area.\n */\n | 'root-bottom'\n\n /**\n * The entirety of a tabbed widget area.\n */\n | 'widget-all'\n\n /**\n * The top portion of tabbed widget area.\n */\n | 'widget-top'\n\n /**\n * The left portion of tabbed widget area.\n */\n | 'widget-left'\n\n /**\n * The right portion of tabbed widget area.\n */\n | 'widget-right'\n\n /**\n * The bottom portion of tabbed widget area.\n */\n | 'widget-bottom'\n\n /**\n * The the bar of a tabbed widget area.\n */\n | 'widget-tab';\n\n /**\n * An object which holds the drop target zone and widget.\n */\n export interface IDropTarget {\n /**\n * The semantic zone for the mouse position.\n */\n zone: DropZone;\n\n /**\n * The tab area geometry for the drop zone, or `null`.\n */\n target: DockLayout.ITabAreaGeometry | null;\n }\n\n /**\n * An attached property used to track generated tab bars.\n */\n export const isGeneratedTabBarProperty = new AttachedProperty<\n Widget,\n boolean\n >({\n name: 'isGeneratedTabBar',\n create: () => false\n });\n\n /**\n * Create a single document config for the widgets in a dock panel.\n */\n export function createSingleDocumentConfig(\n panel: DockPanel\n ): DockPanel.ILayoutConfig {\n // Return an empty config if the panel is empty.\n if (panel.isEmpty) {\n return { main: null };\n }\n\n // Get a flat array of the widgets in the panel.\n let widgets = Array.from(panel.widgets());\n\n // Get the first selected widget in the panel.\n let selected = panel.selectedWidgets().next().value;\n\n // Compute the current index for the new config.\n let currentIndex = selected ? widgets.indexOf(selected) : -1;\n\n // Return the single document config.\n return { main: { type: 'tab-area', widgets, currentIndex } };\n }\n\n /**\n * Find the drop target at the given client position.\n */\n export function findDropTarget(\n panel: DockPanel,\n clientX: number,\n clientY: number,\n edges: DockPanel.IEdges\n ): IDropTarget {\n // Bail if the mouse is not over the dock panel.\n if (!ElementExt.hitTest(panel.node, clientX, clientY)) {\n return { zone: 'invalid', target: null };\n }\n\n // Look up the layout for the panel.\n let layout = panel.layout as DockLayout;\n\n // If the layout is empty, indicate the entire root drop zone.\n if (layout.isEmpty) {\n return { zone: 'root-all', target: null };\n }\n\n // Test the edge zones when in multiple document mode.\n if (panel.mode === 'multiple-document') {\n // Get the client rect for the dock panel.\n let panelRect = panel.node.getBoundingClientRect();\n\n // Compute the distance to each edge of the panel.\n let pl = clientX - panelRect.left + 1;\n let pt = clientY - panelRect.top + 1;\n let pr = panelRect.right - clientX;\n let pb = panelRect.bottom - clientY;\n\n // Find the minimum distance to an edge.\n let pd = Math.min(pt, pr, pb, pl);\n\n // Return a root zone if the mouse is within an edge.\n switch (pd) {\n case pt:\n if (pt < edges.top) {\n return { zone: 'root-top', target: null };\n }\n break;\n case pr:\n if (pr < edges.right) {\n return { zone: 'root-right', target: null };\n }\n break;\n case pb:\n if (pb < edges.bottom) {\n return { zone: 'root-bottom', target: null };\n }\n break;\n case pl:\n if (pl < edges.left) {\n return { zone: 'root-left', target: null };\n }\n break;\n default:\n throw 'unreachable';\n }\n }\n\n // Hit test the dock layout at the given client position.\n let target = layout.hitTestTabAreas(clientX, clientY);\n\n // Bail if no target area was found.\n if (!target) {\n return { zone: 'invalid', target: null };\n }\n\n // Return the whole tab area when in single document mode.\n if (panel.mode === 'single-document') {\n return { zone: 'widget-all', target };\n }\n\n // Compute the distance to each edge of the tab area.\n let al = target.x - target.left + 1;\n let at = target.y - target.top + 1;\n let ar = target.left + target.width - target.x;\n let ab = target.top + target.height - target.y;\n\n const tabHeight = target.tabBar.node.getBoundingClientRect().height;\n if (at < tabHeight) {\n return { zone: 'widget-tab', target };\n }\n\n // Get the X and Y edge sizes for the area.\n let rx = Math.round(target.width / 3);\n let ry = Math.round(target.height / 3);\n\n // If the mouse is not within an edge, indicate the entire area.\n if (al > rx && ar > rx && at > ry && ab > ry) {\n return { zone: 'widget-all', target };\n }\n\n // Scale the distances by the slenderness ratio.\n al /= rx;\n at /= ry;\n ar /= rx;\n ab /= ry;\n\n // Find the minimum distance to the area edge.\n let ad = Math.min(al, at, ar, ab);\n\n // Find the widget zone for the area edge.\n let zone: DropZone;\n switch (ad) {\n case al:\n zone = 'widget-left';\n break;\n case at:\n zone = 'widget-top';\n break;\n case ar:\n zone = 'widget-right';\n break;\n case ab:\n zone = 'widget-bottom';\n break;\n default:\n throw 'unreachable';\n }\n\n // Return the final drop target.\n return { zone, target };\n }\n\n /**\n * Get the drop reference widget for a tab bar.\n */\n export function getDropRef(tabBar: TabBar): Widget | null {\n if (tabBar.titles.length === 0) {\n return null;\n }\n if (tabBar.currentTitle) {\n return tabBar.currentTitle.owner;\n }\n return tabBar.titles[tabBar.titles.length - 1].owner;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { AttachedProperty } from '@lumino/properties';\n\nimport { BoxEngine, BoxSizer } from './boxengine';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nexport class GridLayout extends Layout {\n /**\n * Construct a new grid layout.\n *\n * @param options - The options for initializing the layout.\n */\n constructor(options: GridLayout.IOptions = {}) {\n super(options);\n if (options.rowCount !== undefined) {\n Private.reallocSizers(this._rowSizers, options.rowCount);\n }\n if (options.columnCount !== undefined) {\n Private.reallocSizers(this._columnSizers, options.columnCount);\n }\n if (options.rowSpacing !== undefined) {\n this._rowSpacing = Private.clampValue(options.rowSpacing);\n }\n if (options.columnSpacing !== undefined) {\n this._columnSpacing = Private.clampValue(options.columnSpacing);\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the widgets and layout items.\n for (const item of this._items) {\n let widget = item.widget;\n item.dispose();\n widget.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._rowStarts.length = 0;\n this._rowSizers.length = 0;\n this._columnStarts.length = 0;\n this._columnSizers.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Get the number of rows in the layout.\n */\n get rowCount(): number {\n return this._rowSizers.length;\n }\n\n /**\n * Set the number of rows in the layout.\n *\n * #### Notes\n * The minimum row count is `1`.\n */\n set rowCount(value: number) {\n // Do nothing if the row count does not change.\n if (value === this.rowCount) {\n return;\n }\n\n // Reallocate the row sizers.\n Private.reallocSizers(this._rowSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the number of columns in the layout.\n */\n get columnCount(): number {\n return this._columnSizers.length;\n }\n\n /**\n * Set the number of columns in the layout.\n *\n * #### Notes\n * The minimum column count is `1`.\n */\n set columnCount(value: number) {\n // Do nothing if the column count does not change.\n if (value === this.columnCount) {\n return;\n }\n\n // Reallocate the column sizers.\n Private.reallocSizers(this._columnSizers, value);\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the row spacing for the layout.\n */\n get rowSpacing(): number {\n return this._rowSpacing;\n }\n\n /**\n * Set the row spacing for the layout.\n */\n set rowSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._rowSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._rowSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the column spacing for the layout.\n */\n get columnSpacing(): number {\n return this._columnSpacing;\n }\n\n /**\n * Set the col spacing for the layout.\n */\n set columnSpacing(value: number) {\n // Clamp the spacing to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the spacing does not change\n if (this._columnSpacing === value) {\n return;\n }\n\n // Update the internal spacing.\n this._columnSpacing = value;\n\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n }\n\n /**\n * Get the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @returns The stretch factor for the row.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n rowStretch(index: number): number {\n let sizer = this._rowSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @param value - The stretch factor for the row.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setRowStretch(index: number, value: number): void {\n // Look up the row sizer.\n let sizer = this._rowSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Get the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @returns The stretch factor for the column.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n columnStretch(index: number): number {\n let sizer = this._columnSizers[index];\n return sizer ? sizer.stretch : -1;\n }\n\n /**\n * Set the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @param value - The stretch factor for the column.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n setColumnStretch(index: number, value: number): void {\n // Look up the column sizer.\n let sizer = this._columnSizers[index];\n\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n\n // Clamp the value to the allowed range.\n value = Private.clampValue(value);\n\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n\n // Update the sizer stretch.\n sizer.stretch = value;\n\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n for (const item of this._items) {\n yield item.widget;\n }\n }\n\n /**\n * Add a widget to the grid layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, this is no-op.\n */\n addWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is already in the layout.\n if (i !== -1) {\n return;\n }\n\n // Add the widget to the layout.\n this._items.push(new LayoutItem(widget));\n\n // Attach the widget to the parent.\n if (this.parent) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Remove a widget from the grid layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Look up the index for the widget.\n let i = ArrayExt.findFirstIndex(this._items, it => it.widget === widget);\n\n // Bail if the widget is not in the layout.\n if (i === -1) {\n return;\n }\n\n // Remove the widget from the layout.\n let item = ArrayExt.removeAt(this._items, i)!;\n\n // Detach the widget from the parent.\n if (this.parent) {\n this.detachWidget(widget);\n }\n\n // Dispose the layout item.\n item.dispose();\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Reset the min sizes of the sizers.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n this._rowSizers[i].minSize = 0;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n this._columnSizers[i].minSize = 0;\n }\n\n // Filter for the visible layout items.\n let items = this._items.filter(it => !it.isHidden);\n\n // Fit the layout items.\n for (let i = 0, n = items.length; i < n; ++i) {\n items[i].fit();\n }\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Sort the items by row span.\n items.sort(Private.rowSpanCmp);\n\n // Update the min sizes of the row sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the row bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n\n // Distribute the minimum height to the sizers as needed.\n Private.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n }\n\n // Sort the items by column span.\n items.sort(Private.columnSpanCmp);\n\n // Update the min sizes of the column sizers.\n for (let i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n let item = items[i];\n\n // Get the column bounds for the item.\n let config = GridLayout.getCellConfig(item.widget);\n let c1 = Math.min(config.column, maxCol);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Distribute the minimum width to the sizers as needed.\n Private.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n }\n\n // If no size constraint is needed, just update the parent.\n if (this.fitPolicy === 'set-no-constraint') {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n return;\n }\n\n // Set up the computed min size.\n let minH = maxRow * this._rowSpacing;\n let minW = maxCol * this._columnSpacing;\n\n // Add the sizer minimums to the computed min size.\n for (let i = 0, n = this.rowCount; i < n; ++i) {\n minH += this._rowSizers[i].minSize;\n }\n for (let i = 0, n = this.columnCount; i < n; ++i) {\n minW += this._columnSizers[i].minSize;\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the layout area adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Get the max row and column index.\n let maxRow = this.rowCount - 1;\n let maxCol = this.columnCount - 1;\n\n // Compute the total fixed row and column space.\n let fixedRowSpace = maxRow * this._rowSpacing;\n let fixedColSpace = maxCol * this._columnSpacing;\n\n // Distribute the available space to the box sizers.\n BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n\n // Update the row start positions.\n for (let i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n this._rowStarts[i] = pos;\n pos += this._rowSizers[i].size + this._rowSpacing;\n }\n\n // Update the column start positions.\n for (let i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n this._columnStarts[i] = pos;\n pos += this._columnSizers[i].size + this._columnSpacing;\n }\n\n // Update the geometry of the layout items.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Fetch the cell bounds for the widget.\n let config = GridLayout.getCellConfig(item.widget);\n let r1 = Math.min(config.row, maxRow);\n let c1 = Math.min(config.column, maxCol);\n let r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n let c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n\n // Compute the cell geometry.\n let x = this._columnStarts[c1];\n let y = this._rowStarts[r1];\n let w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n let h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n\n // Update the geometry of the layout item.\n item.update(x, y, w, h);\n }\n }\n\n private _dirty = false;\n private _rowSpacing = 4;\n private _columnSpacing = 4;\n private _items: LayoutItem[] = [];\n private _rowStarts: number[] = [];\n private _columnStarts: number[] = [];\n private _rowSizers: BoxSizer[] = [new BoxSizer()];\n private _columnSizers: BoxSizer[] = [new BoxSizer()];\n private _box: ElementExt.IBoxSizing | null = null;\n}\n\n/**\n * The namespace for the `GridLayout` class statics.\n */\nexport namespace GridLayout {\n /**\n * An options object for initializing a grid layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The initial row count for the layout.\n *\n * The default is `1`.\n */\n rowCount?: number;\n\n /**\n * The initial column count for the layout.\n *\n * The default is `1`.\n */\n columnCount?: number;\n\n /**\n * The spacing between rows in the layout.\n *\n * The default is `4`.\n */\n rowSpacing?: number;\n\n /**\n * The spacing between columns in the layout.\n *\n * The default is `4`.\n */\n columnSpacing?: number;\n }\n\n /**\n * An object which holds the cell configuration for a widget.\n */\n export interface ICellConfig {\n /**\n * The row index for the widget.\n */\n readonly row: number;\n\n /**\n * The column index for the widget.\n */\n readonly column: number;\n\n /**\n * The row span for the widget.\n */\n readonly rowSpan: number;\n\n /**\n * The column span for the widget.\n */\n readonly columnSpan: number;\n }\n\n /**\n * Get the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The cell config for the widget.\n */\n export function getCellConfig(widget: Widget): ICellConfig {\n return Private.cellConfigProperty.get(widget);\n }\n\n /**\n * Set the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the cell config.\n */\n export function setCellConfig(\n widget: Widget,\n value: Partial\n ): void {\n Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * The property descriptor for the widget cell config.\n */\n export const cellConfigProperty = new AttachedProperty<\n Widget,\n GridLayout.ICellConfig\n >({\n name: 'cellConfig',\n create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),\n changed: onChildCellConfigChanged\n });\n\n /**\n * Normalize a partial cell config object.\n */\n export function normalizeConfig(\n config: Partial\n ): GridLayout.ICellConfig {\n let row = Math.max(0, Math.floor(config.row || 0));\n let column = Math.max(0, Math.floor(config.column || 0));\n let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n return { row, column, rowSpan, columnSpan };\n }\n\n /**\n * Clamp a value to an integer >= 0.\n */\n export function clampValue(value: number): number {\n return Math.max(0, Math.floor(value));\n }\n\n /**\n * A sort comparison function for row spans.\n */\n export function rowSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.rowSpan - c2.rowSpan;\n }\n\n /**\n * A sort comparison function for column spans.\n */\n export function columnSpanCmp(a: LayoutItem, b: LayoutItem): number {\n let c1 = cellConfigProperty.get(a.widget);\n let c2 = cellConfigProperty.get(b.widget);\n return c1.columnSpan - c2.columnSpan;\n }\n\n /**\n * Reallocate the box sizers for the given grid dimensions.\n */\n export function reallocSizers(sizers: BoxSizer[], count: number): void {\n // Coerce the count to the valid range.\n count = Math.max(1, Math.floor(count));\n\n // Add the missing sizers.\n while (sizers.length < count) {\n sizers.push(new BoxSizer());\n }\n\n // Remove the extra sizers.\n if (sizers.length > count) {\n sizers.length = count;\n }\n }\n\n /**\n * Distribute a min size constraint across a range of sizers.\n */\n export function distributeMin(\n sizers: BoxSizer[],\n i1: number,\n i2: number,\n minSize: number\n ): void {\n // Sanity check the indices.\n if (i2 < i1) {\n return;\n }\n\n // Handle the simple case of no cell span.\n if (i1 === i2) {\n let sizer = sizers[i1];\n sizer.minSize = Math.max(sizer.minSize, minSize);\n return;\n }\n\n // Compute the total current min size of the span.\n let totalMin = 0;\n for (let i = i1; i <= i2; ++i) {\n totalMin += sizers[i].minSize;\n }\n\n // Do nothing if the total is greater than the required.\n if (totalMin >= minSize) {\n return;\n }\n\n // Compute the portion of the space to allocate to each sizer.\n let portion = (minSize - totalMin) / (i2 - i1 + 1);\n\n // Add the portion to each sizer.\n for (let i = i1; i <= i2; ++i) {\n sizers[i].minSize += portion;\n }\n }\n\n /**\n * The change handler for the child cell config property.\n */\n function onChildCellConfigChanged(child: Widget): void {\n if (child.parent && child.parent.layout instanceof GridLayout) {\n child.parent.fit();\n }\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { getKeyboardLayout } from '@lumino/keyboard';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { CommandRegistry } from '@lumino/commands';\n\nimport {\n ElementARIAAttrs,\n ElementDataset,\n h,\n VirtualDOM,\n VirtualElement\n} from '@lumino/virtualdom';\n\nimport { Menu } from './menu';\n\nimport { Title } from './title';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which displays menus as a canonical menu bar.\n */\nexport class MenuBar extends Widget {\n /**\n * Construct a new menu bar.\n *\n * @param options - The options for initializing the menu bar.\n */\n constructor(options: MenuBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-MenuBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n this.renderer = options.renderer || MenuBar.defaultRenderer;\n this._forceItemsPosition = options.forceItemsPosition || {\n forceX: true,\n forceY: true\n };\n this._overflowMenuOptions = options.overflowMenuOptions || {\n isVisible: true\n };\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n this._closeChildMenu();\n this._menus.length = 0;\n super.dispose();\n }\n\n /**\n * The renderer used by the menu bar.\n */\n readonly renderer: MenuBar.IRenderer;\n\n /**\n * The child menu of the menu bar.\n *\n * #### Notes\n * This will be `null` if the menu bar does not have an open menu.\n */\n get childMenu(): Menu | null {\n return this._childMenu;\n }\n\n /**\n * The overflow index of the menu bar.\n */\n get overflowIndex(): number {\n return this._overflowIndex;\n }\n\n /**\n * The overflow menu of the menu bar.\n */\n get overflowMenu(): Menu | null {\n return this._overflowMenu;\n }\n\n /**\n * Get the menu bar content node.\n *\n * #### Notes\n * This is the node which holds the menu title nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get contentNode(): HTMLUListElement {\n return this.node.getElementsByClassName(\n 'lm-MenuBar-content'\n )[0] as HTMLUListElement;\n }\n\n /**\n * Get the currently active menu.\n */\n get activeMenu(): Menu | null {\n return this._menus[this._activeIndex] || null;\n }\n\n /**\n * Set the currently active menu.\n *\n * #### Notes\n * If the menu does not exist, the menu will be set to `null`.\n */\n set activeMenu(value: Menu | null) {\n this.activeIndex = value ? this._menus.indexOf(value) : -1;\n }\n\n /**\n * Get the index of the currently active menu.\n *\n * #### Notes\n * This will be `-1` if no menu is active.\n */\n get activeIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Set the index of the currently active menu.\n *\n * #### Notes\n * If the menu cannot be activated, the index will be set to `-1`.\n */\n set activeIndex(value: number) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._menus.length) {\n value = -1;\n }\n\n // Bail early if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n\n // Update the active index.\n this._activeIndex = value;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * A read-only array of the menus in the menu bar.\n */\n get menus(): ReadonlyArray {\n return this._menus;\n }\n\n /**\n * Open the active menu and activate its first menu item.\n *\n * #### Notes\n * If there is no active menu, this is a no-op.\n */\n openActiveMenu(): void {\n // Bail early if there is no active item.\n if (this._activeIndex === -1) {\n return;\n }\n\n // Open the child menu.\n this._openChildMenu();\n\n // Activate the first item in the child menu.\n if (this._childMenu) {\n this._childMenu.activeIndex = -1;\n this._childMenu.activateNextItem();\n }\n }\n\n /**\n * Add a menu to the end of the menu bar.\n *\n * @param menu - The menu to add to the menu bar.\n *\n * #### Notes\n * If the menu is already added to the menu bar, it will be moved.\n */\n addMenu(menu: Menu, update: boolean = true): void {\n this.insertMenu(this._menus.length, menu, update);\n }\n\n /**\n * Insert a menu into the menu bar at the specified index.\n *\n * @param index - The index at which to insert the menu.\n *\n * @param menu - The menu to insert into the menu bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the menus.\n *\n * If the menu is already added to the menu bar, it will be moved.\n */\n insertMenu(index: number, menu: Menu, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Look up the index of the menu.\n let i = this._menus.indexOf(menu);\n\n // Clamp the insert index to the array bounds.\n let j = Math.max(0, Math.min(index, this._menus.length));\n\n // If the menu is not in the array, insert it.\n if (i === -1) {\n // Insert the menu into the array.\n ArrayExt.insert(this._menus, j, menu);\n\n // Add the styling class to the menu.\n menu.addClass('lm-MenuBar-menu');\n\n // Connect to the menu signals.\n menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n menu.menuRequested.connect(this._onMenuMenuRequested, this);\n menu.title.changed.connect(this._onTitleChanged, this);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n\n // There is nothing more to do.\n return;\n }\n\n // Otherwise, the menu exists in the array and should be moved.\n\n // Adjust the index if the location is at the end of the array.\n if (j === this._menus.length) {\n j--;\n }\n\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n\n // Move the menu to the new locations.\n ArrayExt.move(this._menus, i, j);\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove a menu from the menu bar.\n *\n * @param menu - The menu to remove from the menu bar.\n *\n * #### Notes\n * This is a no-op if the menu is not in the menu bar.\n */\n removeMenu(menu: Menu, update: boolean = true): void {\n this.removeMenuAt(this._menus.indexOf(menu), update);\n }\n\n /**\n * Remove the menu at a given index from the menu bar.\n *\n * @param index - The index of the menu to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n removeMenuAt(index: number, update: boolean = true): void {\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Remove the menu from the array.\n let menu = ArrayExt.removeAt(this._menus, index);\n\n // Bail if the index is out of range.\n if (!menu) {\n return;\n }\n\n // Disconnect from the menu signals.\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n\n // Remove the styling class from the menu.\n menu.removeClass('lm-MenuBar-menu');\n\n // Schedule an update of the items.\n if (update) {\n this.update();\n }\n }\n\n /**\n * Remove all menus from the menu bar.\n */\n clearMenus(): void {\n // Bail if there is nothing to remove.\n if (this._menus.length === 0) {\n return;\n }\n\n // Close the child menu before making changes.\n this._closeChildMenu();\n\n // Disconnect from the menu signals and remove the styling class.\n for (let menu of this._menus) {\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n menu.removeClass('lm-MenuBar-menu');\n }\n\n // Clear the menus array.\n this._menus.length = 0;\n\n // Schedule an update of the items.\n this.update();\n }\n\n /**\n * Handle the DOM events for the menu bar.\n *\n * @param event - The DOM event sent to the menu bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu bar's DOM nodes. It\n * should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'focusout':\n this._evtFocusOut(event as FocusEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mousedown', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('focusout', this);\n this.node.addEventListener('contextmenu', this);\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mousedown', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('focusout', this);\n this.node.removeEventListener('contextmenu', this);\n this._closeChildMenu();\n }\n\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n protected onActivateRequest(msg: Message): void {\n if (this.isAttached) {\n this._focusItemAt(0);\n }\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n this.update();\n super.onResize(msg);\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n let menus = this._menus;\n let renderer = this.renderer;\n let activeIndex = this._activeIndex;\n let tabFocusIndex =\n this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length\n ? this._tabFocusIndex\n : 0;\n let length = this._overflowIndex > -1 ? this._overflowIndex : menus.length;\n let totalMenuSize = 0;\n let isVisible = false;\n\n // Check that the overflow menu doesn't count\n length = this._overflowMenu !== null ? length - 1 : length;\n let content = new Array(length);\n\n // Render visible menus\n for (let i = 0; i < length; ++i) {\n content[i] = renderer.renderItem({\n title: menus[i].title,\n active: i === activeIndex,\n tabbable: i === tabFocusIndex,\n disabled: menus[i].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = i;\n this.activeIndex = i;\n }\n });\n // Calculate size of current menu\n totalMenuSize += this._menuItemSizes[i];\n // Check if overflow menu is already rendered\n if (menus[i].title.label === this._overflowMenuOptions.title) {\n isVisible = true;\n length--;\n }\n }\n // Render overflow menu if needed and active\n if (this._overflowMenuOptions.isVisible) {\n if (this._overflowIndex > -1 && !isVisible) {\n // Create overflow menu\n if (this._overflowMenu === null) {\n const overflowMenuTitle = this._overflowMenuOptions.title ?? '...';\n this._overflowMenu = new Menu({ commands: new CommandRegistry() });\n this._overflowMenu.title.label = overflowMenuTitle;\n this._overflowMenu.title.mnemonic = 0;\n this.addMenu(this._overflowMenu, false);\n }\n // Move menus to overflow menu\n for (let i = menus.length - 2; i >= length; i--) {\n const submenu = this.menus[i];\n submenu.title.mnemonic = 0;\n this._overflowMenu.insertItem(0, {\n type: 'submenu',\n submenu: submenu\n });\n this.removeMenu(submenu, false);\n }\n content[length] = renderer.renderItem({\n title: this._overflowMenu.title,\n active: length === activeIndex && menus[length].items.length !== 0,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n } else if (this._overflowMenu !== null) {\n // Remove submenus from overflow menu\n let overflowMenuItems = this._overflowMenu.items;\n let screenSize = this.node.offsetWidth;\n let n = this._overflowMenu.items.length;\n for (let i = 0; i < n; ++i) {\n let index = menus.length - 1 - i;\n if (screenSize - totalMenuSize > this._menuItemSizes[index]) {\n let menu = overflowMenuItems[0].submenu as Menu;\n this._overflowMenu.removeItemAt(0);\n this.insertMenu(length, menu, false);\n content[length] = renderer.renderItem({\n title: menu.title,\n active: false,\n tabbable: length === tabFocusIndex,\n disabled: menus[length].items.length === 0,\n onfocus: () => {\n this._tabFocusIndex = length;\n this.activeIndex = length;\n }\n });\n length++;\n }\n }\n if (this._overflowMenu.items.length === 0) {\n this.removeMenu(this._overflowMenu, false);\n content.pop();\n this._overflowMenu = null;\n this._overflowIndex = -1;\n }\n }\n }\n VirtualDOM.render(content, this.contentNode);\n this._updateOverflowIndex();\n }\n\n /**\n * Calculate and update the current overflow index.\n */\n private _updateOverflowIndex(): void {\n if (!this._overflowMenuOptions.isVisible) {\n return;\n }\n\n // Get elements visible in the main menu bar\n const itemMenus = this.contentNode.childNodes;\n let screenSize = this.node.offsetWidth;\n let totalMenuSize = 0;\n let index = -1;\n let n = itemMenus.length;\n\n if (this._menuItemSizes.length == 0) {\n // Check if it is the first resize and get info about menu items sizes\n for (let i = 0; i < n; i++) {\n let item = itemMenus[i] as HTMLLIElement;\n // Add sizes to array\n totalMenuSize += item.offsetWidth;\n this._menuItemSizes.push(item.offsetWidth);\n if (totalMenuSize > screenSize && index === -1) {\n index = i;\n }\n }\n } else {\n // Calculate current menu size\n for (let i = 0; i < this._menuItemSizes.length; i++) {\n totalMenuSize += this._menuItemSizes[i];\n if (totalMenuSize > screenSize) {\n index = i;\n break;\n }\n }\n }\n this._overflowIndex = index;\n }\n\n /**\n * Handle the `'keydown'` event for the menu bar.\n *\n * #### Notes\n * All keys are trapped except the tab key that is ignored.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Fetch the key code for the event.\n let kc = event.keyCode;\n\n // Reset the active index on tab, but do not trap the tab key.\n if (kc === 9) {\n this.activeIndex = -1;\n return;\n }\n\n // A menu bar handles all other keydown events.\n event.preventDefault();\n event.stopPropagation();\n\n // Enter, Space, Up Arrow, Down Arrow\n if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {\n // The active index may have changed (for example, user hovers over an\n // item with the mouse), so be sure to use the focus index.\n this.activeIndex = this._tabFocusIndex;\n if (this.activeIndex !== this._tabFocusIndex) {\n // Bail if the setter refused to set activeIndex to tabFocusIndex\n // because it means that the item at tabFocusIndex cannot be opened (for\n // example, it has an empty menu)\n return;\n }\n this.openActiveMenu();\n return;\n }\n\n // Escape\n if (kc === 27) {\n this._closeChildMenu();\n this._focusItemAt(this.activeIndex);\n return;\n }\n\n // Left or Right Arrow\n if (kc === 37 || kc === 39) {\n let direction = kc === 37 ? -1 : 1;\n let start = this._tabFocusIndex + direction;\n let n = this._menus.length;\n for (let i = 0; i < n; i++) {\n let index = (n + start + direction * i) % n;\n if (this._menus[index].items.length) {\n this._focusItemAt(index);\n return;\n }\n }\n return;\n }\n\n // Get the pressed key character.\n let key = getKeyboardLayout().keyForKeydownEvent(event);\n\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n\n // Search for the next best matching mnemonic item.\n let start = this._activeIndex + 1;\n let result = Private.findMnemonic(this._menus, key, start);\n\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that menu is opened.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.openActiveMenu();\n } else if (result.index !== -1) {\n this.activeIndex = result.index;\n this._focusItemAt(this.activeIndex);\n } else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n this._focusItemAt(this.activeIndex);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the menu bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Bail if the mouse press was not on the menu bar. This can occur\n // when the document listener is installed for an active menu bar.\n if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n return;\n }\n\n // Stop the propagation of the event. Immediate propagation is\n // also stopped so that an open menu does not handle the event.\n event.stopPropagation();\n event.stopImmediatePropagation();\n\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // If the press was not on an item, close the child menu.\n if (index === -1) {\n this._closeChildMenu();\n return;\n }\n\n // If the press was not the left mouse button, do nothing further.\n if (event.button !== 0) {\n return;\n }\n\n // Otherwise, toggle the open state of the child menu.\n if (this._childMenu) {\n this._closeChildMenu();\n this.activeIndex = index;\n } else {\n // If we don't call preventDefault() here, then the item in the menu\n // bar will take focus over the menu that is being opened.\n event.preventDefault();\n const position = this._positionForMenu(index);\n Menu.saveWindowData();\n // Begin DOM modifications.\n this.activeIndex = index;\n this._openChildMenu(position);\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the menu bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Check if the mouse is over one of the menu items.\n let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {\n return ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n\n // Bail early if the active index will not change.\n if (index === this._activeIndex) {\n return;\n }\n\n // Bail early if a child menu is open and the mouse is not over\n // an item. This allows the child menu to be kept open when the\n // mouse is over the empty part of the menu bar.\n if (index === -1 && this._childMenu) {\n return;\n }\n\n // Get position for the new menu >before< updating active index.\n const position =\n index >= 0 && this._childMenu ? this._positionForMenu(index) : null;\n\n // Before any modification, update window data.\n Menu.saveWindowData();\n\n // Begin DOM modifications.\n\n // Update the active index to the hovered item.\n this.activeIndex = index;\n\n // Open the new menu if a menu is already open.\n if (position) {\n this._openChildMenu(position);\n }\n }\n\n /**\n * Find initial position for the menu based on menubar item position.\n *\n * NOTE: this should be called before updating active index to avoid\n * an additional layout and style invalidation as changing active\n * index modifies DOM.\n */\n private _positionForMenu(index: number): Private.IPosition {\n let itemNode = this.contentNode.children[index];\n let { left, bottom } = (itemNode as HTMLElement).getBoundingClientRect();\n return {\n top: bottom,\n left\n };\n }\n\n /**\n * Handle the `'focusout'` event for the menu bar.\n */\n private _evtFocusOut(event: FocusEvent): void {\n // Reset the active index if there is no open menu and the menubar is losing focus.\n if (!this._childMenu && !this.node.contains(event.relatedTarget as Node)) {\n this.activeIndex = -1;\n }\n }\n\n /**\n * Focus an item in the menu bar.\n *\n * #### Notes\n * Does not open the associated menu.\n */\n private _focusItemAt(index: number): void {\n const itemNode = this.contentNode.childNodes[index] as HTMLElement | void;\n if (itemNode) {\n itemNode.focus();\n }\n }\n\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if there is no active menu.\n */\n private _openChildMenu(options: { left?: number; top?: number } = {}): void {\n // If there is no active menu, close the current menu.\n let newMenu = this.activeMenu;\n if (!newMenu) {\n this._closeChildMenu();\n return;\n }\n\n // Bail if there is no effective menu change.\n let oldMenu = this._childMenu;\n if (oldMenu === newMenu) {\n return;\n }\n\n // Swap the internal menu reference.\n this._childMenu = newMenu;\n\n // Close the current menu, or setup for the new menu.\n if (oldMenu) {\n oldMenu.close();\n } else {\n document.addEventListener('mousedown', this, true);\n }\n\n // Update the tab focus index and ensure the menu bar is updated.\n this._tabFocusIndex = this.activeIndex;\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n\n // Get the positioning data for the new menu.\n let { left, top } = options;\n if (typeof left === 'undefined' || typeof top === 'undefined') {\n ({ left, top } = this._positionForMenu(this._activeIndex));\n }\n // Begin DOM modifications\n\n if (!oldMenu) {\n // Continue setup for new menu\n this.addClass('lm-mod-active');\n }\n\n // Open the new menu at the computed location.\n if (newMenu.items.length > 0) {\n newMenu.open(left, top, this._forceItemsPosition);\n }\n }\n\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n private _closeChildMenu(): void {\n // Bail if no child menu is open.\n if (!this._childMenu) {\n return;\n }\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n let menu = this._childMenu;\n this._childMenu = null;\n\n // Close the menu.\n menu.close();\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `aboutToClose` signal of a menu.\n */\n private _onMenuAboutToClose(sender: Menu): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n\n // Clear the internal menu reference.\n this._childMenu = null;\n\n // Reset the active index.\n this.activeIndex = -1;\n }\n\n /**\n * Handle the `menuRequested` signal of a child menu.\n */\n private _onMenuMenuRequested(sender: Menu, args: 'next' | 'previous'): void {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n\n // Look up the active index and menu count.\n let i = this._activeIndex;\n let n = this._menus.length;\n\n // Active the next requested index.\n switch (args) {\n case 'next':\n this.activeIndex = i === n - 1 ? 0 : i + 1;\n break;\n case 'previous':\n this.activeIndex = i === 0 ? n - 1 : i - 1;\n break;\n }\n\n // Open the active menu.\n this.openActiveMenu();\n }\n\n /**\n * Handle the `changed` signal of a title object.\n */\n private _onTitleChanged(): void {\n this.update();\n }\n\n // Track the index of the item that is currently focused or hovered. -1 means nothing focused or hovered.\n private _activeIndex = -1;\n // Track which item can be focused using the TAB key. Unlike _activeIndex will\n // always point to a menuitem. Whenever you update this value, it's important\n // to follow it with an \"update-request\" message so that the `tabindex`\n // attribute on each menubar item gets properly updated.\n private _tabFocusIndex = 0;\n private _forceItemsPosition: Menu.IOpenOptions;\n private _overflowMenuOptions: IOverflowMenuOptions;\n private _menus: Menu[] = [];\n private _childMenu: Menu | null = null;\n private _overflowMenu: Menu | null = null;\n private _menuItemSizes: number[] = [];\n private _overflowIndex: number = -1;\n}\n\n/**\n * The namespace for the `MenuBar` class statics.\n */\nexport namespace MenuBar {\n /**\n * An options object for creating a menu bar.\n */\n export interface IOptions {\n /**\n * A custom renderer for creating menu bar content.\n *\n * The default is a shared renderer instance.\n */\n renderer?: IRenderer;\n /**\n * Whether to force the position of the menu. The MenuBar forces the\n * coordinates of its menus by default. With this option you can disable it.\n *\n * Setting to `false` will enable the logic which repositions the\n * coordinates of the menu if it will not fit entirely on screen.\n *\n * The default is `true`.\n */\n forceItemsPosition?: Menu.IOpenOptions;\n /**\n * Whether to add a overflow menu if there's overflow.\n *\n * Setting to `true` will enable the logic that creates an overflow menu\n * to show the menu items that don't fit entirely on the screen.\n *\n * The default is `true`.\n */\n overflowMenuOptions?: IOverflowMenuOptions;\n }\n\n /**\n * An object which holds the data to render a menu bar item.\n */\n export interface IRenderData {\n /**\n * The title to be rendered.\n */\n readonly title: Title;\n\n /**\n * Whether the item is the active item.\n */\n readonly active: boolean;\n\n /**\n * Whether the user can tab to the item.\n */\n readonly tabbable: boolean;\n\n /**\n * Whether the item is disabled.\n *\n * #### Notes\n * A disabled item cannot be active.\n * A disabled item cannot be focussed.\n */\n readonly disabled?: boolean;\n\n readonly onfocus?: (event: FocusEvent) => void;\n }\n\n /**\n * A renderer for use with a menu bar.\n */\n export interface IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement;\n }\n\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n export class Renderer implements IRenderer {\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n renderItem(data: IRenderData): VirtualElement {\n let className = this.createItemClass(data);\n let dataset = this.createItemDataset(data);\n let aria = this.createItemARIA(data);\n return h.li(\n {\n className,\n dataset,\n ...(data.disabled ? {} : { tabindex: data.tabbable ? '0' : '-1' }),\n onfocus: data.onfocus,\n ...aria\n },\n this.renderIcon(data),\n this.renderLabel(data)\n );\n }\n\n /**\n * Render the icon element for a menu bar item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n renderIcon(data: IRenderData): VirtualElement {\n let className = this.createIconClass(data);\n\n // If data.title.icon is undefined, it will be ignored.\n return h.div({ className }, data.title.icon!, data.title.iconLabel);\n }\n\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n renderLabel(data: IRenderData): VirtualElement {\n let content = this.formatLabel(data);\n return h.div({ className: 'lm-MenuBar-itemLabel' }, content);\n }\n\n /**\n * Create the class name for the menu bar item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n createItemClass(data: IRenderData): string {\n let name = 'lm-MenuBar-item';\n if (data.title.className) {\n name += ` ${data.title.className}`;\n }\n if (data.active && !data.disabled) {\n name += ' lm-mod-active';\n }\n return name;\n }\n\n /**\n * Create the dataset for a menu bar item.\n *\n * @param data - The data to use for the item.\n *\n * @returns The dataset for the menu bar item.\n */\n createItemDataset(data: IRenderData): ElementDataset {\n return data.title.dataset;\n }\n\n /**\n * Create the aria attributes for menu bar item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n createItemARIA(data: IRenderData): ElementARIAAttrs {\n return {\n role: 'menuitem',\n 'aria-haspopup': 'true',\n 'aria-disabled': data.disabled ? 'true' : 'false'\n };\n }\n\n /**\n * Create the class name for the menu bar item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n createIconClass(data: IRenderData): string {\n let name = 'lm-MenuBar-itemIcon';\n let extra = data.title.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n formatLabel(data: IRenderData): h.Child {\n // Fetch the label text and mnemonic index.\n let { label, mnemonic } = data.title;\n\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n\n // Split the label into parts.\n let prefix = label.slice(0, mnemonic);\n let suffix = label.slice(mnemonic + 1);\n let char = label[mnemonic];\n\n // Wrap the mnemonic character in a span.\n let span = h.span({ className: 'lm-MenuBar-itemMnemonic' }, char);\n\n // Return the content parts.\n return [prefix, span, suffix];\n }\n }\n\n /**\n * The default `Renderer` instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * Options for overflow menu.\n */\nexport interface IOverflowMenuOptions {\n /**\n * Determines if a overflow menu appears when the menu items overflow.\n *\n * Defaults to `true`.\n */\n isVisible: boolean;\n /**\n * Determines the title of the overflow menu.\n *\n * Default: `...`.\n */\n title?: string;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create the DOM node for a menu bar.\n */\n export function createNode(): HTMLDivElement {\n let node = document.createElement('div');\n let content = document.createElement('ul');\n content.className = 'lm-MenuBar-content';\n node.appendChild(content);\n content.setAttribute('role', 'menubar');\n return node;\n }\n\n /**\n * Position for the menu relative to top-left screen corner.\n */\n export interface IPosition {\n /**\n * Pixels right from screen origin.\n */\n left: number;\n /**\n * Pixels down from screen origin.\n */\n top: number;\n }\n\n /**\n * The results of a mnemonic search.\n */\n export interface IMnemonicResult {\n /**\n * The index of the first matching mnemonic item, or `-1`.\n */\n index: number;\n\n /**\n * Whether multiple mnemonic items matched.\n */\n multiple: boolean;\n\n /**\n * The index of the first auto matched non-mnemonic item.\n */\n auto: number;\n }\n\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n export function findMnemonic(\n menus: ReadonlyArray,\n key: string,\n start: number\n ): IMnemonicResult {\n // Setup the result variables.\n let index = -1;\n let auto = -1;\n let multiple = false;\n\n // Normalize the key to upper case.\n let upperKey = key.toUpperCase();\n\n // Search the items from the given start index.\n for (let i = 0, n = menus.length; i < n; ++i) {\n // Compute the wrapped index.\n let k = (i + start) % n;\n\n // Look up the menu title.\n let title = menus[k].title;\n\n // Ignore titles with an empty label.\n if (title.label.length === 0) {\n continue;\n }\n\n // Look up the mnemonic index for the label.\n let mn = title.mnemonic;\n\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < title.label.length) {\n if (title.label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n } else {\n multiple = true;\n }\n }\n continue;\n }\n\n // Finally, handle the auto index if possible.\n if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n\n // Return the search results.\n return { index, multiple, auto };\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Drag } from '@lumino/dragdrop';\n\nimport { Message } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nexport class ScrollBar extends Widget {\n /**\n * Construct a new scroll bar.\n *\n * @param options - The options for initializing the scroll bar.\n */\n constructor(options: ScrollBar.IOptions = {}) {\n super({ node: Private.createNode() });\n this.addClass('lm-ScrollBar');\n this.setFlag(Widget.Flag.DisallowLayout);\n\n // Set the orientation.\n this._orientation = options.orientation || 'vertical';\n this.dataset['orientation'] = this._orientation;\n\n // Parse the rest of the options.\n if (options.maximum !== undefined) {\n this._maximum = Math.max(0, options.maximum);\n }\n if (options.page !== undefined) {\n this._page = Math.max(0, options.page);\n }\n if (options.value !== undefined) {\n this._value = Math.max(0, Math.min(options.value, this._maximum));\n }\n }\n\n /**\n * A signal emitted when the user moves the scroll thumb.\n *\n * #### Notes\n * The payload is the current value of the scroll bar.\n */\n get thumbMoved(): ISignal {\n return this._thumbMoved;\n }\n\n /**\n * A signal emitted when the user clicks a step button.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get stepRequested(): ISignal {\n return this._stepRequested;\n }\n\n /**\n * A signal emitted when the user clicks the scroll track.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get pageRequested(): ISignal {\n return this._pageRequested;\n }\n\n /**\n * Get the orientation of the scroll bar.\n */\n get orientation(): ScrollBar.Orientation {\n return this._orientation;\n }\n\n /**\n * Set the orientation of the scroll bar.\n */\n set orientation(value: ScrollBar.Orientation) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n\n // Release the mouse before making changes.\n this._releaseMouse();\n\n // Update the internal orientation.\n this._orientation = value;\n this.dataset['orientation'] = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the current value of the scroll bar.\n */\n get value(): number {\n return this._value;\n }\n\n /**\n * Set the current value of the scroll bar.\n *\n * #### Notes\n * The value will be clamped to the range `[0, maximum]`.\n */\n set value(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Do nothing if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the page size of the scroll bar.\n *\n * #### Notes\n * The page size is the amount of visible content in the scrolled\n * region, expressed in data units. It determines the size of the\n * scroll bar thumb.\n */\n get page(): number {\n return this._page;\n }\n\n /**\n * Set the page size of the scroll bar.\n *\n * #### Notes\n * The page size will be clamped to the range `[0, Infinity]`.\n */\n set page(value: number) {\n // Clamp the page size to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._page === value) {\n return;\n }\n\n // Update the internal page size.\n this._page = value;\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * Get the maximum value of the scroll bar.\n */\n get maximum(): number {\n return this._maximum;\n }\n\n /**\n * Set the maximum value of the scroll bar.\n *\n * #### Notes\n * The max size will be clamped to the range `[0, Infinity]`.\n */\n set maximum(value: number) {\n // Clamp the value to the allowable range.\n value = Math.max(0, value);\n\n // Do nothing if the value does not change.\n if (this._maximum === value) {\n return;\n }\n\n // Update the internal values.\n this._maximum = value;\n\n // Clamp the current value to the new range.\n this._value = Math.min(this._value, value);\n\n // Schedule an update the scroll bar.\n this.update();\n }\n\n /**\n * The scroll bar decrement button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get decrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar increment button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get incrementNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-button'\n )[1] as HTMLDivElement;\n }\n\n /**\n * The scroll bar track node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get trackNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-track'\n )[0] as HTMLDivElement;\n }\n\n /**\n * The scroll bar thumb node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get thumbNode(): HTMLDivElement {\n return this.node.getElementsByClassName(\n 'lm-ScrollBar-thumb'\n )[0] as HTMLDivElement;\n }\n\n /**\n * Handle the DOM events for the scroll bar.\n *\n * @param event - The DOM event sent to the scroll bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the scroll bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event as MouseEvent);\n break;\n case 'mousemove':\n this._evtMouseMove(event as MouseEvent);\n break;\n case 'mouseup':\n this._evtMouseUp(event as MouseEvent);\n break;\n case 'keydown':\n this._evtKeyDown(event as KeyboardEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * A method invoked on a 'before-attach' message.\n */\n protected onBeforeAttach(msg: Message): void {\n this.node.addEventListener('mousedown', this);\n this.update();\n }\n\n /**\n * A method invoked on an 'after-detach' message.\n */\n protected onAfterDetach(msg: Message): void {\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n }\n\n /**\n * A method invoked on an 'update-request' message.\n */\n protected onUpdateRequest(msg: Message): void {\n // Convert the value and page into percentages.\n let value = (this._value * 100) / this._maximum;\n let page = (this._page * 100) / (this._page + this._maximum);\n\n // Clamp the value and page to the relevant range.\n value = Math.max(0, Math.min(value, 100));\n page = Math.max(0, Math.min(page, 100));\n\n // Fetch the thumb style.\n let thumbStyle = this.thumbNode.style;\n\n // Update the thumb style for the current orientation.\n if (this._orientation === 'horizontal') {\n thumbStyle.top = '';\n thumbStyle.height = '';\n thumbStyle.left = `${value}%`;\n thumbStyle.width = `${page}%`;\n thumbStyle.transform = `translate(${-value}%, 0%)`;\n } else {\n thumbStyle.left = '';\n thumbStyle.width = '';\n thumbStyle.top = `${value}%`;\n thumbStyle.height = `${page}%`;\n thumbStyle.transform = `translate(0%, ${-value}%)`;\n }\n }\n\n /**\n * Handle the `'keydown'` event for the scroll bar.\n */\n private _evtKeyDown(event: KeyboardEvent): void {\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n\n // Ignore anything except the `Escape` key.\n if (event.keyCode !== 27) {\n return;\n }\n\n // Fetch the previous scroll value.\n let value = this._pressData ? this._pressData.value : -1;\n\n // Release the mouse.\n this._releaseMouse();\n\n // Restore the old scroll value if possible.\n if (value !== -1) {\n this._moveThumb(value);\n }\n }\n\n /**\n * Handle the `'mousedown'` event for the scroll bar.\n */\n private _evtMouseDown(event: MouseEvent): void {\n // Do nothing if it's not a left mouse press.\n if (event.button !== 0) {\n return;\n }\n\n // Send an activate request to the scroll bar. This can be\n // used by message hooks to activate something relevant.\n this.activate();\n\n // Do nothing if the mouse is already captured.\n if (this._pressData) {\n return;\n }\n\n // Find the pressed scroll bar part.\n let part = Private.findPart(this, event.target as HTMLElement);\n\n // Do nothing if the part is not of interest.\n if (!part) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Override the mouse cursor.\n let override = Drag.overrideCursor('default');\n\n // Set up the press data.\n this._pressData = {\n part,\n override,\n delta: -1,\n value: -1,\n mouseX: event.clientX,\n mouseY: event.clientY\n };\n\n // Add the extra event listeners.\n document.addEventListener('mousemove', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n\n // Handle a thumb press.\n if (part === 'thumb') {\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Update the press data delta for the current orientation.\n if (this._orientation === 'horizontal') {\n this._pressData.delta = event.clientX - thumbRect.left;\n } else {\n this._pressData.delta = event.clientY - thumbRect.top;\n }\n\n // Add the active class to the thumb node.\n thumbNode.classList.add('lm-mod-active');\n\n // Store the current value in the press data.\n this._pressData.value = this._value;\n\n // Finished.\n return;\n }\n\n // Handle a track press.\n if (part === 'track') {\n // Fetch the client rect for the thumb.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n\n // Handle a decrement button press.\n if (part === 'decrement') {\n // Add the active class to the decrement node.\n this.decrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button press.\n if (part === 'increment') {\n // Add the active class to the increment node.\n this.incrementNode.classList.add('lm-mod-active');\n\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n }\n\n /**\n * Handle the `'mousemove'` event for the scroll bar.\n */\n private _evtMouseMove(event: MouseEvent): void {\n // Do nothing if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Update the mouse position.\n this._pressData.mouseX = event.clientX;\n this._pressData.mouseY = event.clientY;\n\n // Bail if the thumb is not being dragged.\n if (this._pressData.part !== 'thumb') {\n return;\n }\n\n // Get the client rect for the thumb and track.\n let thumbRect = this.thumbNode.getBoundingClientRect();\n let trackRect = this.trackNode.getBoundingClientRect();\n\n // Fetch the scroll geometry based on the orientation.\n let trackPos: number;\n let trackSpan: number;\n if (this._orientation === 'horizontal') {\n trackPos = event.clientX - trackRect.left - this._pressData.delta;\n trackSpan = trackRect.width - thumbRect.width;\n } else {\n trackPos = event.clientY - trackRect.top - this._pressData.delta;\n trackSpan = trackRect.height - thumbRect.height;\n }\n\n // Compute the desired value from the scroll geometry.\n let value = trackSpan === 0 ? 0 : (trackPos * this._maximum) / trackSpan;\n\n // Move the thumb to the computed value.\n this._moveThumb(value);\n }\n\n /**\n * Handle the `'mouseup'` event for the scroll bar.\n */\n private _evtMouseUp(event: MouseEvent): void {\n // Do nothing if it's not a left mouse release.\n if (event.button !== 0) {\n return;\n }\n\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n\n // Release the mouse.\n this._releaseMouse();\n }\n\n /**\n * Release the mouse and restore the node states.\n */\n private _releaseMouse(): void {\n // Bail if there is no press data.\n if (!this._pressData) {\n return;\n }\n\n // Clear the repeat timer.\n clearTimeout(this._repeatTimer);\n this._repeatTimer = -1;\n\n // Clear the press data.\n this._pressData.override.dispose();\n this._pressData = null;\n\n // Remove the extra event listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n\n // Remove the active classes from the nodes.\n this.thumbNode.classList.remove('lm-mod-active');\n this.decrementNode.classList.remove('lm-mod-active');\n this.incrementNode.classList.remove('lm-mod-active');\n }\n\n /**\n * Move the thumb to the specified position.\n */\n private _moveThumb(value: number): void {\n // Clamp the value to the allowed range.\n value = Math.max(0, Math.min(value, this._maximum));\n\n // Bail if the value does not change.\n if (this._value === value) {\n return;\n }\n\n // Update the internal value.\n this._value = value;\n\n // Schedule an update of the scroll bar.\n this.update();\n\n // Emit the thumb moved signal.\n this._thumbMoved.emit(value);\n }\n\n /**\n * A timeout callback for repeating the mouse press.\n */\n private _onRepeat = () => {\n // Clear the repeat timer id.\n this._repeatTimer = -1;\n\n // Bail if the mouse has been released.\n if (!this._pressData) {\n return;\n }\n\n // Look up the part that was pressed.\n let part = this._pressData.part;\n\n // Bail if the thumb was pressed.\n if (part === 'thumb') {\n return;\n }\n\n // Schedule the timer for another repeat.\n this._repeatTimer = window.setTimeout(this._onRepeat, 20);\n\n // Get the current mouse position.\n let mouseX = this._pressData.mouseX;\n let mouseY = this._pressData.mouseY;\n\n // Handle a decrement button repeat.\n if (part === 'decrement') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n\n // Finished.\n return;\n }\n\n // Handle an increment button repeat.\n if (part === 'increment') {\n // Bail if the mouse is not over the button.\n if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {\n return;\n }\n\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n\n // Finished.\n return;\n }\n\n // Handle a track repeat.\n if (part === 'track') {\n // Bail if the mouse is not over the track.\n if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the thumb node.\n let thumbNode = this.thumbNode;\n\n // Bail if the mouse is over the thumb.\n if (ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n return;\n }\n\n // Fetch the client rect for the thumb.\n let thumbRect = thumbNode.getBoundingClientRect();\n\n // Determine the direction for the page request.\n let dir: 'decrement' | 'increment';\n if (this._orientation === 'horizontal') {\n dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n } else {\n dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n }\n\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n\n // Finished.\n return;\n }\n };\n\n private _value = 0;\n private _page = 10;\n private _maximum = 100;\n private _repeatTimer = -1;\n private _orientation: ScrollBar.Orientation;\n private _pressData: Private.IPressData | null = null;\n private _thumbMoved = new Signal(this);\n private _stepRequested = new Signal(this);\n private _pageRequested = new Signal(this);\n}\n\n/**\n * The namespace for the `ScrollBar` class statics.\n */\nexport namespace ScrollBar {\n /**\n * A type alias for a scroll bar orientation.\n */\n export type Orientation = 'horizontal' | 'vertical';\n\n /**\n * An options object for creating a scroll bar.\n */\n export interface IOptions {\n /**\n * The orientation of the scroll bar.\n *\n * The default is `'vertical'`.\n */\n orientation?: Orientation;\n\n /**\n * The value for the scroll bar.\n *\n * The default is `0`.\n */\n value?: number;\n\n /**\n * The page size for the scroll bar.\n *\n * The default is `10`.\n */\n page?: number;\n\n /**\n * The maximum value for the scroll bar.\n *\n * The default is `100`.\n */\n maximum?: number;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * A type alias for the parts of a scroll bar.\n */\n export type ScrollBarPart = 'thumb' | 'track' | 'decrement' | 'increment';\n\n /**\n * An object which holds mouse press data.\n */\n export interface IPressData {\n /**\n * The scroll bar part which was pressed.\n */\n part: ScrollBarPart;\n\n /**\n * The offset of the press in thumb coordinates, or -1.\n */\n delta: number;\n\n /**\n * The scroll value at the time the thumb was pressed, or -1.\n */\n value: number;\n\n /**\n * The disposable which will clear the override cursor.\n */\n override: IDisposable;\n\n /**\n * The current X position of the mouse.\n */\n mouseX: number;\n\n /**\n * The current Y position of the mouse.\n */\n mouseY: number;\n }\n\n /**\n * Create the DOM node for a scroll bar.\n */\n export function createNode(): HTMLElement {\n let node = document.createElement('div');\n let decrement = document.createElement('div');\n let increment = document.createElement('div');\n let track = document.createElement('div');\n let thumb = document.createElement('div');\n decrement.className = 'lm-ScrollBar-button';\n increment.className = 'lm-ScrollBar-button';\n decrement.dataset['action'] = 'decrement';\n increment.dataset['action'] = 'increment';\n track.className = 'lm-ScrollBar-track';\n thumb.className = 'lm-ScrollBar-thumb';\n track.appendChild(thumb);\n node.appendChild(decrement);\n node.appendChild(track);\n node.appendChild(increment);\n return node;\n }\n\n /**\n * Find the scroll bar part which contains the given target.\n */\n export function findPart(\n scrollBar: ScrollBar,\n target: HTMLElement\n ): ScrollBarPart | null {\n // Test the thumb.\n if (scrollBar.thumbNode.contains(target)) {\n return 'thumb';\n }\n\n // Test the track.\n if (scrollBar.trackNode.contains(target)) {\n return 'track';\n }\n\n // Test the decrement button.\n if (scrollBar.decrementNode.contains(target)) {\n return 'decrement';\n }\n\n // Test the increment button.\n if (scrollBar.incrementNode.contains(target)) {\n return 'increment';\n }\n\n // Indicate no match.\n return null;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Panel } from './panel';\n\nimport { StackedLayout } from './stackedlayout';\n\nimport { Widget } from './widget';\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a {@link StackedLayout}.\n */\nexport class StackedPanel extends Panel {\n /**\n * Construct a new stacked panel.\n *\n * @param options - The options for initializing the panel.\n */\n constructor(options: StackedPanel.IOptions = {}) {\n super({ layout: Private.createLayout(options) });\n this.addClass('lm-StackedPanel');\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return (this.layout as StackedLayout).hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n (this.layout as StackedLayout).hiddenMode = v;\n }\n\n /**\n * A signal emitted when a widget is removed from a stacked panel.\n */\n get widgetRemoved(): ISignal {\n return this._widgetRemoved;\n }\n\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n protected onChildAdded(msg: Widget.ChildMessage): void {\n msg.child.addClass('lm-StackedPanel-child');\n }\n\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n protected onChildRemoved(msg: Widget.ChildMessage): void {\n msg.child.removeClass('lm-StackedPanel-child');\n this._widgetRemoved.emit(msg.child);\n }\n\n private _widgetRemoved = new Signal(this);\n}\n\n/**\n * The namespace for the `StackedPanel` class statics.\n */\nexport namespace StackedPanel {\n /**\n * An options object for creating a stacked panel.\n */\n export interface IOptions {\n /**\n * The stacked layout to use for the stacked panel.\n *\n * The default is a new `StackedLayout`.\n */\n layout?: StackedLayout;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Create a stacked layout for the given panel options.\n */\n export function createLayout(options: StackedPanel.IOptions): StackedLayout {\n return options.layout || new StackedLayout();\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { Platform } from '@lumino/domutils';\n\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { BoxLayout } from './boxlayout';\n\nimport { StackedPanel } from './stackedpanel';\n\nimport { TabBar } from './tabbar';\n\nimport { Widget } from './widget';\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nexport class TabPanel extends Widget {\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n constructor(options: TabPanel.IOptions = {}) {\n super();\n this.addClass('lm-TabPanel');\n\n // Create the tab bar and stacked panel.\n this.tabBar = new TabBar(options);\n this.tabBar.addClass('lm-TabPanel-tabBar');\n this.stackedPanel = new StackedPanel();\n this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n\n // Connect the tab bar signal handlers.\n this.tabBar.tabMoved.connect(this._onTabMoved, this);\n this.tabBar.currentChanged.connect(this._onCurrentChanged, this);\n this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n this.tabBar.tabActivateRequested.connect(\n this._onTabActivateRequested,\n this\n );\n this.tabBar.addRequested.connect(this._onTabAddRequested, this);\n\n // Connect the stacked panel signal handlers.\n this.stackedPanel.widgetRemoved.connect(this._onWidgetRemoved, this);\n\n // Get the data related to the placement.\n this._tabPlacement = options.tabPlacement || 'top';\n let direction = Private.directionFromPlacement(this._tabPlacement);\n let orientation = Private.orientationFromPlacement(this._tabPlacement);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = this._tabPlacement;\n\n // Create the box layout.\n let layout = new BoxLayout({ direction, spacing: 0 });\n\n // Set the stretch factors for the child widgets.\n BoxLayout.setStretch(this.tabBar, 0);\n BoxLayout.setStretch(this.stackedPanel, 1);\n\n // Add the child widgets to the layout.\n layout.addWidget(this.tabBar);\n layout.addWidget(this.stackedPanel);\n\n // Install the layout on the tab panel.\n this.layout = layout;\n }\n\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get currentChanged(): ISignal {\n return this._currentChanged;\n }\n\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get currentIndex(): number {\n return this.tabBar.currentIndex;\n }\n\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `-1`.\n */\n set currentIndex(value: number) {\n this.tabBar.currentIndex = value;\n }\n\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get currentWidget(): Widget | null {\n let title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n }\n\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set currentWidget(value: Widget | null) {\n this.tabBar.currentTitle = value ? value.title : null;\n }\n\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get tabsMovable(): boolean {\n return this.tabBar.tabsMovable;\n }\n\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set tabsMovable(value: boolean) {\n this.tabBar.tabsMovable = value;\n }\n\n /**\n * Get the whether the add button is enabled.\n *\n */\n get addButtonEnabled(): boolean {\n return this.tabBar.addButtonEnabled;\n }\n\n /**\n * Set the whether the add button is enabled.\n *\n */\n set addButtonEnabled(value: boolean) {\n this.tabBar.addButtonEnabled = value;\n }\n\n /**\n * Get the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n get tabPlacement(): TabPanel.TabPlacement {\n return this._tabPlacement;\n }\n\n /**\n * Set the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n set tabPlacement(value: TabPanel.TabPlacement) {\n // Bail if the placement does not change.\n if (this._tabPlacement === value) {\n return;\n }\n\n // Update the internal value.\n this._tabPlacement = value;\n\n // Get the values related to the placement.\n let direction = Private.directionFromPlacement(value);\n let orientation = Private.orientationFromPlacement(value);\n\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = value;\n\n // Update the layout direction.\n (this.layout as BoxLayout).direction = direction;\n }\n\n /**\n * A signal emitted when the add button on a tab bar is clicked.\n *\n */\n get addRequested(): ISignal> {\n return this._addRequested;\n }\n\n /**\n * The tab bar used by the tab panel.\n *\n * #### Notes\n * Modifying the tab bar directly can lead to undefined behavior.\n */\n readonly tabBar: TabBar;\n\n /**\n * The stacked panel used by the tab panel.\n *\n * #### Notes\n * Modifying the panel directly can lead to undefined behavior.\n */\n readonly stackedPanel: StackedPanel;\n\n /**\n * A read-only array of the widgets in the panel.\n */\n get widgets(): ReadonlyArray {\n return this.stackedPanel.widgets;\n }\n\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n addWidget(widget: Widget): void {\n this.insertWidget(this.widgets.length, widget);\n }\n\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n insertWidget(index: number, widget: Widget): void {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.stackedPanel.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n\n widget.node.setAttribute('role', 'tabpanel');\n\n let renderer = this.tabBar.renderer;\n if (renderer instanceof TabBar.Renderer) {\n let tabId = renderer.createTabKey({\n title: widget.title,\n current: false,\n zIndex: 0\n });\n widget.node.setAttribute('aria-labelledby', tabId);\n }\n }\n\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n private _onCurrentChanged(\n sender: TabBar,\n args: TabBar.ICurrentChangedArgs\n ): void {\n // Extract the previous and current title from the args.\n let { previousIndex, previousTitle, currentIndex, currentTitle } = args;\n\n // Extract the widgets from the titles.\n let previousWidget = previousTitle ? previousTitle.owner : null;\n let currentWidget = currentTitle ? currentTitle.owner : null;\n\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex,\n previousWidget,\n currentIndex,\n currentWidget\n });\n\n // Flush the message loop on IE and Edge to prevent flicker.\n if (Platform.IS_EDGE || Platform.IS_IE) {\n MessageLoop.flush();\n }\n }\n\n /**\n * Handle the `tabAddRequested` signal from the tab bar.\n */\n private _onTabAddRequested(sender: TabBar, args: void): void {\n this._addRequested.emit(sender);\n }\n\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n private _onTabActivateRequested(\n sender: TabBar,\n args: TabBar.ITabActivateRequestedArgs\n ): void {\n args.title.owner.activate();\n }\n\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n private _onTabCloseRequested(\n sender: TabBar,\n args: TabBar.ITabCloseRequestedArgs\n ): void {\n args.title.owner.close();\n }\n\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n private _onTabMoved(\n sender: TabBar,\n args: TabBar.ITabMovedArgs\n ): void {\n this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n }\n\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n private _onWidgetRemoved(sender: StackedPanel, widget: Widget): void {\n widget.node.removeAttribute('role');\n widget.node.removeAttribute('aria-labelledby');\n this.tabBar.removeTab(widget.title);\n }\n\n private _tabPlacement: TabPanel.TabPlacement;\n private _currentChanged = new Signal(\n this\n );\n\n private _addRequested = new Signal>(this);\n}\n\n/**\n * The namespace for the `TabPanel` class statics.\n */\nexport namespace TabPanel {\n /**\n * A type alias for tab placement in a tab bar.\n */\n export type TabPlacement =\n | /**\n * The tabs are placed as a row above the content.\n */\n 'top'\n\n /**\n * The tabs are placed as a column to the left of the content.\n */\n | 'left'\n\n /**\n * The tabs are placed as a column to the right of the content.\n */\n | 'right'\n\n /**\n * The tabs are placed as a row below the content.\n */\n | 'bottom';\n\n /**\n * An options object for initializing a tab panel.\n */\n export interface IOptions {\n /**\n * The document to use with the tab panel.\n *\n * The default is the global `document` instance.\n */\n document?: Document | ShadowRoot;\n\n /**\n * Whether the tabs are movable by the user.\n *\n * The default is `false`.\n */\n tabsMovable?: boolean;\n\n /**\n * Whether the button to add new tabs is enabled.\n *\n * The default is `false`.\n */\n addButtonEnabled?: boolean;\n\n /**\n * The placement of the tab bar relative to the content.\n *\n * The default is `'top'`.\n */\n tabPlacement?: TabPlacement;\n\n /**\n * The renderer for the panel's tab bar.\n *\n * The default is a shared renderer instance.\n */\n renderer?: TabBar.IRenderer;\n }\n\n /**\n * The arguments object for the `currentChanged` signal.\n */\n export interface ICurrentChangedArgs {\n /**\n * The previously selected index.\n */\n previousIndex: number;\n\n /**\n * The previously selected widget.\n */\n previousWidget: Widget | null;\n\n /**\n * The currently selected index.\n */\n currentIndex: number;\n\n /**\n * The currently selected widget.\n */\n currentWidget: Widget | null;\n }\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Convert a tab placement to tab bar orientation.\n */\n export function orientationFromPlacement(\n plc: TabPanel.TabPlacement\n ): TabBar.Orientation {\n return placementToOrientationMap[plc];\n }\n\n /**\n * Convert a tab placement to a box layout direction.\n */\n export function directionFromPlacement(\n plc: TabPanel.TabPlacement\n ): BoxLayout.Direction {\n return placementToDirectionMap[plc];\n }\n\n /**\n * A mapping of tab placement to tab bar orientation.\n */\n const placementToOrientationMap: { [key: string]: TabBar.Orientation } = {\n top: 'horizontal',\n left: 'vertical',\n right: 'vertical',\n bottom: 'horizontal'\n };\n\n /**\n * A mapping of tab placement to box layout direction.\n */\n const placementToDirectionMap: { [key: string]: BoxLayout.Direction } = {\n top: 'top-to-bottom',\n left: 'left-to-right',\n right: 'right-to-left',\n bottom: 'bottom-to-top'\n };\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { Layout } from './layout';\n\nimport { Widget } from './widget';\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nexport class SingletonLayout extends Layout {\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n if (this._widget) {\n let widget = this._widget;\n this._widget = null;\n widget.dispose();\n }\n super.dispose();\n }\n\n /**\n * Get the child widget for the layout.\n */\n get widget(): Widget | null {\n return this._widget;\n }\n\n /**\n * Set the child widget for the layout.\n *\n * #### Notes\n * Setting the child widget will cause the old child widget to be\n * automatically disposed. If that is not desired, set the parent\n * of the old child to `null` before assigning a new child.\n */\n set widget(widget: Widget | null) {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n if (widget) {\n widget.parent = this.parent;\n }\n\n // Bail early if the widget does not change.\n if (this._widget === widget) {\n return;\n }\n\n // Dispose of the old child widget.\n if (this._widget) {\n this._widget.dispose();\n }\n\n // Update the internal widget.\n this._widget = widget;\n\n // Attach the new child widget if needed.\n if (this.parent && widget) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n *[Symbol.iterator](): IterableIterator {\n if (this._widget) {\n yield this._widget;\n }\n }\n\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n removeWidget(widget: Widget): void {\n // Bail early if the widget does not exist in the layout.\n if (this._widget !== widget) {\n return;\n }\n\n // Clear the internal widget.\n this._widget = null;\n\n // If the layout is parented, detach the widget from the DOM.\n if (this.parent) {\n this.detachWidget(widget);\n }\n }\n\n /**\n * Perform layout initialization which requires the parent widget.\n */\n protected init(): void {\n super.init();\n for (const widget of this) {\n this.attachWidget(widget);\n }\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n protected attachWidget(widget: Widget): void {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n protected detachWidget(widget: Widget): void {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n }\n\n private _widget: Widget | null = null;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt } from '@lumino/algorithm';\n\nimport { ElementExt } from '@lumino/domutils';\n\nimport { Message, MessageLoop } from '@lumino/messaging';\n\nimport { Layout, LayoutItem } from './layout';\n\nimport { PanelLayout } from './panellayout';\n\nimport { Widget } from './widget';\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nexport class StackedLayout extends PanelLayout {\n constructor(options: StackedLayout.IOptions = {}) {\n super(options);\n this._hiddenMode =\n options.hiddenMode !== undefined\n ? options.hiddenMode\n : Widget.HiddenMode.Display;\n }\n\n /**\n * The method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n get hiddenMode(): Widget.HiddenMode {\n return this._hiddenMode;\n }\n\n /**\n * Set the method for hiding widgets.\n *\n * #### Notes\n * If there is only one child widget, `Display` hiding mode will be used\n * regardless of this setting.\n */\n set hiddenMode(v: Widget.HiddenMode) {\n if (this._hiddenMode === v) {\n return;\n }\n this._hiddenMode = v;\n if (this.widgets.length > 1) {\n this.widgets.forEach(w => {\n w.hiddenMode = this._hiddenMode;\n });\n }\n }\n\n /**\n * Dispose of the resources held by the layout.\n */\n dispose(): void {\n // Dispose of the layout items.\n for (const item of this._items) {\n item.dispose();\n }\n\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n\n // Dispose of the rest of the layout.\n super.dispose();\n }\n\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected attachWidget(index: number, widget: Widget): void {\n // Using transform create an additional layer in the pixel pipeline\n // to limit the number of layer, it is set only if there is more than one widget.\n if (\n this._hiddenMode === Widget.HiddenMode.Scale &&\n this._items.length > 0\n ) {\n if (this._items.length === 1) {\n this.widgets[0].hiddenMode = Widget.HiddenMode.Scale;\n }\n widget.hiddenMode = Widget.HiddenMode.Scale;\n } else {\n widget.hiddenMode = Widget.HiddenMode.Display;\n }\n\n // Create and add a new layout item for the widget.\n ArrayExt.insert(this._items, index, new LayoutItem(widget));\n\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n\n // Add the widget's node to the parent.\n this.parent!.node.appendChild(widget.node);\n\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected moveWidget(\n fromIndex: number,\n toIndex: number,\n widget: Widget\n ): void {\n // Move the layout item for the widget.\n ArrayExt.move(this._items, fromIndex, toIndex);\n\n // Post an update request for the parent widget.\n this.parent!.update();\n }\n\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n protected detachWidget(index: number, widget: Widget): void {\n // Remove the layout item for the widget.\n let item = ArrayExt.removeAt(this._items, index);\n\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n\n // Remove the widget's node from the parent.\n this.parent!.node.removeChild(widget.node);\n\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent!.isAttached) {\n MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n\n // Reset the z-index for the widget.\n item!.widget.node.style.zIndex = '';\n\n // Reset the hidden mode for the widget.\n if (this._hiddenMode === Widget.HiddenMode.Scale) {\n widget.hiddenMode = Widget.HiddenMode.Display;\n\n // Reset the hidden mode for the first widget if necessary.\n if (this._items.length === 1) {\n this._items[0].widget.hiddenMode = Widget.HiddenMode.Display;\n }\n }\n\n // Dispose of the layout item.\n item!.dispose();\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n protected onBeforeShow(msg: Message): void {\n super.onBeforeShow(msg);\n this.parent!.update();\n }\n\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n protected onChildHidden(msg: Widget.ChildMessage): void {\n this.parent!.fit();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (this.parent!.isVisible) {\n this._update(msg.width, msg.height);\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n if (this.parent!.isVisible) {\n this._update(-1, -1);\n }\n }\n\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n protected onFitRequest(msg: Message): void {\n if (this.parent!.isAttached) {\n this._fit();\n }\n }\n\n /**\n * Fit the layout to the total size required by the widgets.\n */\n private _fit(): void {\n // Set up the computed minimum size.\n let minW = 0;\n let minH = 0;\n\n // Update the computed minimum size.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Update the size limits for the item.\n item.fit();\n\n // Update the computed minimum size.\n minW = Math.max(minW, item.minWidth);\n minH = Math.max(minH, item.minHeight);\n }\n\n // Update the box sizing and add it to the computed min size.\n let box = (this._box = ElementExt.boxSizing(this.parent!.node));\n minW += box.horizontalSum;\n minH += box.verticalSum;\n\n // Update the parent's min size constraints.\n let style = this.parent!.node.style;\n style.minWidth = `${minW}px`;\n style.minHeight = `${minH}px`;\n\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent!.parent) {\n MessageLoop.sendMessage(this.parent!.parent!, Widget.Msg.FitRequest);\n }\n\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n MessageLoop.sendMessage(this.parent!, Widget.Msg.UpdateRequest);\n }\n }\n\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n private _update(offsetWidth: number, offsetHeight: number): void {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n\n // Compute the visible item count.\n let nVisible = 0;\n for (let i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent!.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent!.node.offsetHeight;\n }\n\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = ElementExt.boxSizing(this.parent!.node);\n }\n\n // Compute the actual layout bounds adjusted for border and padding.\n let top = this._box.paddingTop;\n let left = this._box.paddingLeft;\n let width = offsetWidth - this._box.horizontalSum;\n let height = offsetHeight - this._box.verticalSum;\n\n // Update the widget stacking order and layout geometry.\n for (let i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n let item = this._items[i];\n\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n\n // Set the z-index for the widget.\n item.widget.node.style.zIndex = `${i}`;\n\n // Update the item geometry.\n item.update(left, top, width, height);\n }\n }\n\n private _dirty = false;\n private _items: LayoutItem[] = [];\n private _box: ElementExt.IBoxSizing | null = null;\n private _hiddenMode: Widget.HiddenMode;\n}\n\n/**\n * The namespace for the `StackedLayout` class statics.\n */\nexport namespace StackedLayout {\n /**\n * An options object for initializing a stacked layout.\n */\n export interface IOptions extends Layout.IOptions {\n /**\n * The method for hiding widgets.\n *\n * The default is `Widget.HiddenMode.Display`.\n */\n hiddenMode?: Widget.HiddenMode;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { ArrayExt, find, max } from '@lumino/algorithm';\n\nimport { IDisposable } from '@lumino/disposable';\n\nimport { ISignal, Signal } from '@lumino/signaling';\n\nimport { Widget } from './widget';\n\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nexport class FocusTracker implements IDisposable {\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose(): void {\n // Do nothing if the tracker is already disposed.\n if (this._counter < 0) {\n return;\n }\n\n // Mark the tracker as disposed.\n this._counter = -1;\n\n // Clear the connections for the tracker.\n Signal.clearData(this);\n\n // Remove all event listeners.\n for (const widget of this._widgets) {\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n }\n\n // Clear the internal data structures.\n this._activeWidget = null;\n this._currentWidget = null;\n this._nodes.clear();\n this._numbers.clear();\n this._widgets.length = 0;\n }\n\n /**\n * A signal emitted when the current widget has changed.\n */\n get currentChanged(): ISignal> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when the active widget has changed.\n */\n get activeChanged(): ISignal> {\n return this._activeChanged;\n }\n\n /**\n * A flag indicating whether the tracker is disposed.\n */\n get isDisposed(): boolean {\n return this._counter < 0;\n }\n\n /**\n * The current widget in the tracker.\n *\n * #### Notes\n * The current widget is the widget among the tracked widgets which\n * has the *descendant node* which has most recently been focused.\n *\n * The current widget will not be updated if the node loses focus. It\n * will only be updated when a different tracked widget gains focus.\n *\n * If the current widget is removed from the tracker, the previous\n * current widget will be restored.\n *\n * This behavior is intended to follow a user's conceptual model of\n * a semantically \"current\" widget, where the \"last thing of type X\"\n * to be interacted with is the \"current instance of X\", regardless\n * of whether that instance still has focus.\n */\n get currentWidget(): T | null {\n return this._currentWidget;\n }\n\n /**\n * The active widget in the tracker.\n *\n * #### Notes\n * The active widget is the widget among the tracked widgets which\n * has the *descendant node* which is currently focused.\n */\n get activeWidget(): T | null {\n return this._activeWidget;\n }\n\n /**\n * A read only array of the widgets being tracked.\n */\n get widgets(): ReadonlyArray {\n return this._widgets;\n }\n\n /**\n * Get the focus number for a particular widget in the tracker.\n *\n * @param widget - The widget of interest.\n *\n * @returns The focus number for the given widget, or `-1` if the\n * widget has not had focus since being added to the tracker, or\n * is not contained by the tracker.\n *\n * #### Notes\n * The focus number indicates the relative order in which the widgets\n * have gained focus. A widget with a larger number has gained focus\n * more recently than a widget with a smaller number.\n *\n * The `currentWidget` will always have the largest focus number.\n *\n * All widgets start with a focus number of `-1`, which indicates that\n * the widget has not been focused since being added to the tracker.\n */\n focusNumber(widget: T): number {\n let n = this._numbers.get(widget);\n return n === undefined ? -1 : n;\n }\n\n /**\n * Test whether the focus tracker contains a given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns `true` if the widget is tracked, `false` otherwise.\n */\n has(widget: T): boolean {\n return this._numbers.has(widget);\n }\n\n /**\n * Add a widget to the focus tracker.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is already tracked, this is a no-op.\n */\n add(widget: T): void {\n // Do nothing if the widget is already tracked.\n if (this._numbers.has(widget)) {\n return;\n }\n\n // Test whether the widget has focus.\n let focused = widget.node.contains(document.activeElement);\n\n // Set up the initial focus number.\n let n = focused ? this._counter++ : -1;\n\n // Add the widget to the internal data structures.\n this._widgets.push(widget);\n this._numbers.set(widget, n);\n this._nodes.set(widget.node, widget);\n\n // Set up the event listeners. The capturing phase must be used\n // since the 'focus' and 'blur' events don't bubble and Firefox\n // doesn't support the 'focusin' or 'focusout' events.\n widget.node.addEventListener('focus', this, true);\n widget.node.addEventListener('blur', this, true);\n\n // Connect the disposed signal handler.\n widget.disposed.connect(this._onWidgetDisposed, this);\n\n // Set the current and active widgets if needed.\n if (focused) {\n this._setWidgets(widget, widget);\n }\n }\n\n /**\n * Remove a widget from the focus tracker.\n *\n * #### Notes\n * If the widget is the `currentWidget`, the previous current widget\n * will become the new `currentWidget`.\n *\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is not tracked, this is a no-op.\n */\n remove(widget: T): void {\n // Bail early if the widget is not tracked.\n if (!this._numbers.has(widget)) {\n return;\n }\n\n // Disconnect the disposed signal handler.\n widget.disposed.disconnect(this._onWidgetDisposed, this);\n\n // Remove the event listeners.\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n\n // Remove the widget from the internal data structures.\n ArrayExt.removeFirstOf(this._widgets, widget);\n this._nodes.delete(widget.node);\n this._numbers.delete(widget);\n\n // Bail early if the widget is not the current widget.\n if (this._currentWidget !== widget) {\n return;\n }\n\n // Filter the widgets for those which have had focus.\n let valid = this._widgets.filter(w => this._numbers.get(w) !== -1);\n\n // Get the valid widget with the max focus number.\n let previous =\n max(valid, (first, second) => {\n let a = this._numbers.get(first)!;\n let b = this._numbers.get(second)!;\n return a - b;\n }) || null;\n\n // Set the current and active widgets.\n this._setWidgets(previous, null);\n }\n\n /**\n * Handle the DOM events for the focus tracker.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tracked nodes. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n }\n }\n\n /**\n * Set the current and active widgets for the tracker.\n */\n private _setWidgets(current: T | null, active: T | null): void {\n // Swap the current widget.\n let oldCurrent = this._currentWidget;\n this._currentWidget = current;\n\n // Swap the active widget.\n let oldActive = this._activeWidget;\n this._activeWidget = active;\n\n // Emit the `currentChanged` signal if needed.\n if (oldCurrent !== current) {\n this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n }\n\n // Emit the `activeChanged` signal if needed.\n if (oldActive !== active) {\n this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n }\n }\n\n /**\n * Handle the `'focus'` event for a tracked widget.\n */\n private _evtFocus(event: FocusEvent): void {\n // Find the widget which gained focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Update the focus number if necessary.\n if (widget !== this._currentWidget) {\n this._numbers.set(widget, this._counter++);\n }\n\n // Set the current and active widgets.\n this._setWidgets(widget, widget);\n }\n\n /**\n * Handle the `'blur'` event for a tracked widget.\n */\n private _evtBlur(event: FocusEvent): void {\n // Find the widget which lost focus, which is known to exist.\n let widget = this._nodes.get(event.currentTarget as HTMLElement)!;\n\n // Get the node which being focused after this blur.\n let focusTarget = event.relatedTarget as HTMLElement;\n\n // If no other node is being focused, clear the active widget.\n if (!focusTarget) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n\n // Bail if the focus widget is not changing.\n if (widget.node.contains(focusTarget)) {\n return;\n }\n\n // If no tracked widget is being focused, clear the active widget.\n if (!find(this._widgets, w => w.node.contains(focusTarget))) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n }\n\n /**\n * Handle the `disposed` signal for a tracked widget.\n */\n private _onWidgetDisposed(sender: T): void {\n this.remove(sender);\n }\n\n private _counter = 0;\n private _widgets: T[] = [];\n private _activeWidget: T | null = null;\n private _currentWidget: T | null = null;\n private _numbers = new Map();\n private _nodes = new Map();\n private _activeChanged = new Signal>(this);\n private _currentChanged = new Signal>(\n this\n );\n}\n\n/**\n * The namespace for the `FocusTracker` class statics.\n */\nexport namespace FocusTracker {\n /**\n * An arguments object for the changed signals.\n */\n export interface IChangedArgs {\n /**\n * The old value for the widget.\n */\n oldValue: T | null;\n\n /**\n * The new value for the widget.\n */\n newValue: T | null;\n }\n}\n"],"mappings":"2/BAoBaA,EAAbC,cAcEC,KAAQC,SAAG,EAeXD,KAAOE,QAAG,EAeVF,KAAOG,QAAGC,IAkBVJ,KAAOK,QAAG,EAcVL,KAAIM,KAAG,EAUPN,KAAIO,MAAG,C,EAMT,IAAiBC,ECo/BPC,EC/RAA,ECh0BOC,EH2GAF,gDA0XhB,KA3TiBG,KAAhB,SAAqBC,EAA6BC,GAEhD,IAAIC,EAAQF,EAAOG,OACnB,GAAc,IAAVD,EACF,OAAOD,EAIT,IAAIG,EAAW,EACXC,EAAW,EACXC,EAAY,EACZC,EAAe,EACfC,EAAe,EAGnB,IAAK,IAAIC,EAAI,EAAGA,EAAIP,IAASO,EAAG,CAC9B,IAAIC,EAAQV,EAAOS,GACfE,EAAMD,EAAMpB,QACZsB,EAAMF,EAAMnB,QACZsB,EAAOH,EAAMrB,SACjBqB,EAAMf,MAAO,EACbe,EAAMhB,KAAOoB,KAAKF,IAAID,EAAKG,KAAKH,IAAIE,EAAMD,IAC1CN,GAAaI,EAAMhB,KACnBU,GAAYO,EACZN,GAAYO,EACRF,EAAMjB,QAAU,IAClBc,GAAgBG,EAAMjB,QACtBe,IAEH,CAGD,GAAIP,IAAUK,EACZ,OAAO,EAIT,GAAIL,GAASG,EAAU,CACrB,IAAK,IAAIK,EAAI,EAAGA,EAAIP,IAASO,EAAG,CAC9B,IAAIC,EAAQV,EAAOS,GACnBC,EAAM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yB,qBACNxiB,EACAoG,GAEAA,EAAK9Y,MAAMlC,MAAM+E,O,CAMXmyB,YACNtiB,EACAoG,GAEA1e,KAAK4lC,aAAaz2B,aAAauP,EAAK3O,QAAS2O,EAAK9Y,MAAMlC,M,CAMlDmiC,iBAAiBvtB,EAAsB9Q,GAC7CA,EAAOrC,KAAK0F,gBAAgB,QAC5BrD,EAAOrC,KAAK0F,gBAAgB,mBAC5B7K,KAAKs0B,OAAOjH,UAAU7lB,EAAO5B,M"} +\ No newline at end of file +diff --git a/node_modules/@lumino/widgets/src/menu.ts b/node_modules/@lumino/widgets/src/menu.ts +index 80ca9e7..9874f25 100644 +--- a/node_modules/@lumino/widgets/src/menu.ts ++++ b/node_modules/@lumino/widgets/src/menu.ts +@@ -520,7 +520,7 @@ export class Menu extends Widget { + this.node.addEventListener('mouseenter', this); + this.node.addEventListener('mouseleave', this); + this.node.addEventListener('contextmenu', this); +- document.addEventListener('mousedown', this, true); ++ this.node.ownerDocument.addEventListener('mousedown', this, true); + } + + /** +@@ -533,7 +533,7 @@ export class Menu extends Widget { + this.node.removeEventListener('mouseenter', this); + this.node.removeEventListener('mouseleave', this); + this.node.removeEventListener('contextmenu', this); +- document.removeEventListener('mousedown', this, true); ++ this.node.ownerDocument.removeEventListener('mousedown', this, true); + } + + /** +@@ -1636,7 +1636,7 @@ namespace Private { + style.maxHeight = `${maxHeight}px`; + + // Attach the menu to the document. +- Widget.attach(submenu, document.body); ++ Widget.attach(submenu, itemNode.ownerDocument.body); + + // Measure the size of the menu. + let { width, height } = node.getBoundingClientRect(); +diff --git a/node_modules/@lumino/widgets/src/menubar.ts b/node_modules/@lumino/widgets/src/menubar.ts +index 9c7561a..ce51938 100644 +--- a/node_modules/@lumino/widgets/src/menubar.ts ++++ b/node_modules/@lumino/widgets/src/menubar.ts +@@ -145,11 +145,6 @@ export class MenuBar extends Widget { + value = -1; + } + +- // An empty menu cannot be active +- if (value > -1 && this._menus[value].items.length === 0) { +- value = -1; +- } +- + // Bail early if the index will not change. + if (this._activeIndex === value) { + return; diff --git a/dev-packages/cli/patches/@phosphor+widgets+1.9.3.patch b/dev-packages/cli/patches/@phosphor+widgets+1.9.3.patch deleted file mode 100644 index 40f582ab14dcf..0000000000000 --- a/dev-packages/cli/patches/@phosphor+widgets+1.9.3.patch +++ /dev/null @@ -1,157 +0,0 @@ -diff --git a/node_modules/@phosphor/widgets/lib/menu.d.ts b/node_modules/@phosphor/widgets/lib/menu.d.ts -index 5d5053c..7802167 100644 ---- a/node_modules/@phosphor/widgets/lib/menu.d.ts -+++ b/node_modules/@phosphor/widgets/lib/menu.d.ts -@@ -195,7 +195,7 @@ export declare class Menu extends Widget { - * - * This is a no-op if the menu is already attached to the DOM. - */ -- open(x: number, y: number, options?: Menu.IOpenOptions): void; -+ open(x: number, y: number, options?: Menu.IOpenOptions, anchor?: HTMLElement): void; - /** - * Handle the DOM events for the menu. - * -diff --git a/node_modules/@phosphor/widgets/lib/menu.js b/node_modules/@phosphor/widgets/lib/menu.js -index de23022..a8b15b1 100644 ---- a/node_modules/@phosphor/widgets/lib/menu.js -+++ b/node_modules/@phosphor/widgets/lib/menu.js -@@ -13,7 +13,7 @@ var __extends = (this && this.__extends) || (function () { - }; - })(); - var __assign = (this && this.__assign) || function () { -- __assign = Object.assign || function(t) { -+ __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) -@@ -424,7 +424,7 @@ var Menu = /** @class */ (function (_super) { - * - * This is a no-op if the menu is already attached to the DOM. - */ -- Menu.prototype.open = function (x, y, options) { -+ Menu.prototype.open = function (x, y, options, node) { - if (options === void 0) { options = {}; } - // Bail early if the menu is already attached. - if (this.isAttached) { -@@ -434,7 +434,7 @@ var Menu = /** @class */ (function (_super) { - var forceX = options.forceX || false; - var forceY = options.forceY || false; - // Open the menu as a root menu. -- Private.openRootMenu(this, x, y, forceX, forceY); -+ Private.openRootMenu(this, x, y, forceX, forceY, node); - // Activate the menu to accept keyboard input. - this.activate(); - }; -@@ -484,8 +484,16 @@ var Menu = /** @class */ (function (_super) { - this.node.addEventListener('mouseenter', this); - this.node.addEventListener('mouseleave', this); - this.node.addEventListener('contextmenu', this); -- document.addEventListener('mousedown', this, true); - }; -+ -+ Menu.prototype.onAfterAttach = function (msg) { -+ this.node.ownerDocument.addEventListener('mousedown', this, true); -+ } -+ -+ Menu.prototype.onBeforeDetach = function (msg) { -+ this.node.ownerDocument.removeEventListener('mousedown', this, true); -+ } -+ - /** - * A message handler invoked on an `'after-detach'` message. - */ -@@ -496,7 +504,6 @@ var Menu = /** @class */ (function (_super) { - this.node.removeEventListener('mouseenter', this); - this.node.removeEventListener('mouseleave', this); - this.node.removeEventListener('contextmenu', this); -- document.removeEventListener('mousedown', this, true); - }; - /** - * A message handler invoked on an `'activate-request'` message. -@@ -1124,14 +1131,15 @@ var Private; - /** - * Open a menu as a root menu at the target location. - */ -- function openRootMenu(menu, x, y, forceX, forceY) { -+ function openRootMenu(menu, x, y, forceX, forceY, element) { - // Ensure the menu is updated before attaching and measuring. - messaging_1.MessageLoop.sendMessage(menu, widget_1.Widget.Msg.UpdateRequest); - // Get the current position and size of the main viewport. -+ var doc = element ? element.ownerDocument : document; - var px = window.pageXOffset; - var py = window.pageYOffset; -- var cw = document.documentElement.clientWidth; -- var ch = document.documentElement.clientHeight; -+ var cw = doc.documentElement.clientWidth; -+ var ch = doc.documentElement.clientHeight; - // Compute the maximum allowed height for the menu. - var maxHeight = ch - (forceY ? y : 0); - // Fetch common variables. -@@ -1145,7 +1153,7 @@ var Private; - style.visibility = 'hidden'; - style.maxHeight = maxHeight + "px"; - // Attach the menu to the document. -- widget_1.Widget.attach(menu, document.body); -+ widget_1.Widget.attach(menu, doc.body); - // Measure the size of the menu. - var _a = node.getBoundingClientRect(), width = _a.width, height = _a.height; - // Adjust the X position of the menu to fit on-screen. -@@ -1177,8 +1185,8 @@ var Private; - // Get the current position and size of the main viewport. - var px = window.pageXOffset; - var py = window.pageYOffset; -- var cw = document.documentElement.clientWidth; -- var ch = document.documentElement.clientHeight; -+ var cw = itemNode.ownerDocument.documentElement.clientWidth; -+ var ch = itemNode.ownerDocument.documentElement.clientHeight; - // Compute the maximum allowed height for the menu. - var maxHeight = ch; - // Fetch common variables. -@@ -1192,7 +1200,7 @@ var Private; - style.visibility = 'hidden'; - style.maxHeight = maxHeight + "px"; - // Attach the menu to the document. -- widget_1.Widget.attach(submenu, document.body); -+ widget_1.Widget.attach(submenu, itemNode.ownerDocument.body); - // Measure the size of the menu. - var _a = node.getBoundingClientRect(), width = _a.width, height = _a.height; - // Compute the box sizing for the menu. -diff --git a/node_modules/@phosphor/widgets/lib/menubar.js b/node_modules/@phosphor/widgets/lib/menubar.js -index a8e10f4..da2ee82 100644 ---- a/node_modules/@phosphor/widgets/lib/menubar.js -+++ b/node_modules/@phosphor/widgets/lib/menubar.js -@@ -521,7 +521,7 @@ var MenuBar = /** @class */ (function (_super) { - // Get the positioning data for the new menu. - var _a = itemNode.getBoundingClientRect(), left = _a.left, bottom = _a.bottom; - // Open the new menu at the computed location. -- newMenu.open(left, bottom, { forceX: true, forceY: true }); -+ newMenu.open(left, bottom, { forceX: true, forceY: true }, this.node); - }; - /** - * Close the child menu immediately. -diff --git a/node_modules/@phosphor/widgets/lib/widget.js b/node_modules/@phosphor/widgets/lib/widget.js -index 01241fa..62da27c 100644 ---- a/node_modules/@phosphor/widgets/lib/widget.js -+++ b/node_modules/@phosphor/widgets/lib/widget.js -@@ -906,10 +906,10 @@ exports.Widget = Widget; - if (widget.parent) { - throw new Error('Cannot attach a child widget.'); - } -- if (widget.isAttached || document.body.contains(widget.node)) { -+ if (widget.isAttached || widget.node.ownerDocument.body.contains(widget.node)) { - throw new Error('Widget is already attached.'); - } -- if (!document.body.contains(host)) { -+ if (!host.ownerDocument.body.contains(host)) { - throw new Error('Host is not attached.'); - } - messaging_1.MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach); -@@ -930,7 +930,7 @@ exports.Widget = Widget; - if (widget.parent) { - throw new Error('Cannot detach a child widget.'); - } -- if (!widget.isAttached || !document.body.contains(widget.node)) { -+ if (!widget.isAttached || !widget.node.ownerDocument.body.contains(widget.node)) { - throw new Error('Widget is not attached.'); - } - messaging_1.MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach); diff --git a/dev-packages/cli/src/run-test.ts b/dev-packages/cli/src/run-test.ts index 57a6e3aecc6b9..4e4d40913f866 100644 --- a/dev-packages/cli/src/run-test.ts +++ b/dev-packages/cli/src/run-test.ts @@ -49,7 +49,7 @@ export default async function runTest(options: TestOptions): Promise { // When launching in non-headless mode (with a UI and dev-tools open), make sure // the app has focus, to avoid failures of tests that query the UI's state. if (launch && launch.devtools) { - promises.push(testPage.waitForSelector('#theia-app-shell.p-Widget.theia-ApplicationShell') + promises.push(testPage.waitForSelector('#theia-app-shell.lm-Widget.theia-ApplicationShell') .then(e => { // eslint-disable-next-line no-null/no-null if (e !== null) { diff --git a/dev-packages/private-test-setup/README.md b/dev-packages/private-test-setup/README.md new file mode 100644 index 0000000000000..8b3255088103e --- /dev/null +++ b/dev-packages/private-test-setup/README.md @@ -0,0 +1,32 @@ +
+ +
+ +theia-ext-logo + +

ECLIPSE THEIA - TEST SETUP

+ +
+ +
+ +## Description + +The `@theia/test-setup` contributes a setup script for mocha executed tests in Theia. +This setup script is executed before any test file is loaded or compiled. +This is for example useful for globals which must exist before dependencies are loaded. + +## Additional Information + +- [Theia - GitHub](https://github.com/eclipse-theia/theia) +- [Theia - Website](https://theia-ide.org/) + +## License + +- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) +- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) + +## Trademark + +"Theia" is a trademark of the Eclipse Foundation +https://www.eclipse.org/theia diff --git a/dev-packages/private-test-setup/package.json b/dev-packages/private-test-setup/package.json new file mode 100644 index 0000000000000..04aef22a86835 --- /dev/null +++ b/dev-packages/private-test-setup/package.json @@ -0,0 +1,7 @@ +{ + "private": true, + "name": "@theia/test-setup", + "version": "1.56.0", + "description": "Custom setup for mocha tests", + "main": "test-setup.js" +} diff --git a/dev-packages/private-test-setup/test-setup.js b/dev-packages/private-test-setup/test-setup.js new file mode 100644 index 0000000000000..702b12303794b --- /dev/null +++ b/dev-packages/private-test-setup/test-setup.js @@ -0,0 +1,18 @@ +// ***************************************************************************** +// Copyright (C) 2024 STMicroelectronics and others. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 +// ***************************************************************************** + +// Mock DragEvent as '@lumino/dragdrop' already requires it at require time +global.DragEvent = class DragEvent { }; diff --git a/examples/api-samples/src/browser/menu/sample-browser-menu-module.ts b/examples/api-samples/src/browser/menu/sample-browser-menu-module.ts index ef3c61d0d5d02..71d08c0256bcf 100644 --- a/examples/api-samples/src/browser/menu/sample-browser-menu-module.ts +++ b/examples/api-samples/src/browser/menu/sample-browser-menu-module.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { injectable, ContainerModule } from '@theia/core/shared/inversify'; -import { Menu as MenuWidget } from '@theia/core/shared/@phosphor/widgets'; +import { Menu as MenuWidget } from '@theia/core/shared/@lumino/widgets'; import { Disposable } from '@theia/core/lib/common/disposable'; import { MenuNode, CompoundMenuNode, MenuPath } from '@theia/core/lib/common/menu'; import { BrowserMainMenuFactory, MenuCommandRegistry, DynamicMenuWidget, BrowserMenuOptions } from '@theia/core/lib/browser/menu/browser-menu-plugin'; @@ -74,7 +74,7 @@ class SampleMenuCommandRegistry extends MenuCommandRegistry { return this.addCommand(id, { execute: () => { /* NOOP */ }, label: menu.label, - icon: menu.icon, + iconClass: menu.icon, isEnabled: () => false, isVisible: () => true }); diff --git a/examples/api-samples/src/browser/monaco-editor-preferences/monaco-editor-preference-extractor.ts b/examples/api-samples/src/browser/monaco-editor-preferences/monaco-editor-preference-extractor.ts index e9a8b1369e13c..0700fd3e1f455 100644 --- a/examples/api-samples/src/browser/monaco-editor-preferences/monaco-editor-preference-extractor.ts +++ b/examples/api-samples/src/browser/monaco-editor-preferences/monaco-editor-preference-extractor.ts @@ -29,7 +29,7 @@ import { inject, injectable, interfaces } from '@theia/core/shared/inversify'; import { FileService } from '@theia/filesystem/lib/browser/file-service'; import { WorkspaceService } from '@theia/workspace/lib/browser'; import { PreferenceItem, PreferenceValidationService } from '@theia/core/lib/browser'; -import { JSONValue } from '@theia/core/shared/@phosphor/coreutils'; +import { JSONValue } from '@theia/core/shared/@lumino/coreutils'; import { JsonType } from '@theia/core/lib/common/json-schema'; import { editorOptionsRegistry } from '@theia/monaco-editor-core/esm/vs/editor/common/config/editorOptions'; import { MonacoEditorProvider } from '@theia/monaco/lib/browser/monaco-editor-provider'; diff --git a/examples/playwright/src/theia-app.ts b/examples/playwright/src/theia-app.ts index 43b102df4f156..9708321d3f8bb 100644 --- a/examples/playwright/src/theia-app.ts +++ b/examples/playwright/src/theia-app.ts @@ -176,7 +176,7 @@ export class TheiaApp { } protected async visibleTabIds(): Promise { - const tabs = await this.page.$$('.p-TabBar-tab'); + const tabs = await this.page.$$('.lm-TabBar-tab'); const tabIds = (await Promise.all(tabs.map(tab => tab.getAttribute('id')))).filter(id => !!id); return tabIds as string[]; } diff --git a/examples/playwright/src/theia-main-menu.ts b/examples/playwright/src/theia-main-menu.ts index 428d8f148e0c8..8d643aaf58a6f 100644 --- a/examples/playwright/src/theia-main-menu.ts +++ b/examples/playwright/src/theia-main-menu.ts @@ -21,7 +21,7 @@ import { TheiaPageObject } from './theia-page-object'; import { normalizeId, toTextContentArray } from './util'; export class TheiaMainMenu extends TheiaMenu { - override selector = '.p-Menu.p-MenuBar-menu'; + override selector = '.lm-Menu.lm-MenuBar-menu'; } export class TheiaMenuBar extends TheiaPageObject { @@ -48,7 +48,7 @@ export class TheiaMenuBar extends TheiaPageObject { } protected menuBarItemSelector(label = ''): string { - return `${normalizeId('#theia:menubar')} .p-MenuBar-itemLabel >> text=${label}`; + return `${normalizeId('#theia:menubar')} .lm-MenuBar-itemLabel >> text=${label}`; } } diff --git a/examples/playwright/src/theia-menu-item.ts b/examples/playwright/src/theia-menu-item.ts index 8d814c5b7fd4f..67e99dc8524b3 100644 --- a/examples/playwright/src/theia-menu-item.ts +++ b/examples/playwright/src/theia-menu-item.ts @@ -23,15 +23,15 @@ export class TheiaMenuItem { constructor(protected element: ElementHandle) { } protected labelElementHandle(): Promise> { - return this.element.waitForSelector('.p-Menu-itemLabel'); + return this.element.waitForSelector('.lm-Menu-itemLabel'); } protected shortCutElementHandle(): Promise> { - return this.element.waitForSelector('.p-Menu-itemShortcut'); + return this.element.waitForSelector('.lm-Menu-itemShortcut'); } protected isHidden(): Promise { - return elementContainsClass(this.element, 'p-mod-collapsed'); + return elementContainsClass(this.element, 'lm-mod-collapsed'); } async label(): Promise { @@ -60,11 +60,11 @@ export class TheiaMenuItem { if (classAttribute === undefined || classAttribute === null) { return false; } - return !classAttribute.includes('p-mod-disabled') && !classAttribute.includes('p-mod-collapsed'); + return !classAttribute.includes('lm-mod-disabled') && !classAttribute.includes('lm-mod-collapsed'); } async click(): Promise { - return this.element.waitForSelector('.p-Menu-itemLabel') + return this.element.waitForSelector('.lm-Menu-itemLabel') .then(labelElement => labelElement.click({ position: { x: 10, y: 10 } })); } diff --git a/examples/playwright/src/theia-menu.ts b/examples/playwright/src/theia-menu.ts index 74747e03ac01a..b813a31072d4d 100644 --- a/examples/playwright/src/theia-menu.ts +++ b/examples/playwright/src/theia-menu.ts @@ -22,7 +22,7 @@ import { isDefined } from './util'; export class TheiaMenu extends TheiaPageObject { - selector = '.p-Menu'; + selector = '.lm-Menu'; protected async menuElementHandle(): Promise | null> { return this.page.$(this.selector); @@ -50,7 +50,7 @@ export class TheiaMenu extends TheiaPageObject { if (!menuHandle) { return []; } - const items = await menuHandle.$$('.p-Menu-content .p-Menu-item'); + const items = await menuHandle.$$('.lm-Menu-content .lm-Menu-item'); return items.map(element => new TheiaMenuItem(element)); } @@ -84,7 +84,7 @@ export class TheiaMenu extends TheiaPageObject { } protected menuItemSelector(label = ''): string { - return `.p-Menu-content .p-Menu-itemLabel >> text=${label}`; + return `.lm-Menu-content .lm-Menu-itemLabel >> text=${label}`; } async visibleMenuItems(): Promise { diff --git a/examples/playwright/src/theia-output-view.ts b/examples/playwright/src/theia-output-view.ts index 514a19bf549da..8419921a018d3 100644 --- a/examples/playwright/src/theia-output-view.ts +++ b/examples/playwright/src/theia-output-view.ts @@ -47,7 +47,7 @@ export class TheiaOutputView extends TheiaView { await this.activate(); const channel = new TheiaOutputViewChannel( { - viewSelector: 'div.p-Widget.theia-editor.p-DockPanel-widget > div.monaco-editor', + viewSelector: 'div.lm-Widget.theia-editor.lm-DockPanel-widget > div.monaco-editor', dataUri: normalizeId(`output:/${encodeURIComponent(outputChannelName)}`), channelName: outputChannelName }, diff --git a/examples/playwright/src/theia-preference-view.ts b/examples/playwright/src/theia-preference-view.ts index 1af41fdb55a21..8eb64e8b240a9 100644 --- a/examples/playwright/src/theia-preference-view.ts +++ b/examples/playwright/src/theia-preference-view.ts @@ -106,7 +106,7 @@ export class TheiaPreferenceView extends TheiaView { } protected getScopeSelector(scope: TheiaPreferenceScope): string { - return `li.preferences-scope-tab div.p-TabBar-tabLabel:has-text("${scope}")`; + return `li.preferences-scope-tab div.lm-TabBar-tabLabel:has-text("${scope}")`; } async openPreferenceScope(scope: TheiaPreferenceScope): Promise { diff --git a/examples/playwright/src/theia-toolbar.ts b/examples/playwright/src/theia-toolbar.ts index 97fda9c8a1872..69e138e0adf1e 100644 --- a/examples/playwright/src/theia-toolbar.ts +++ b/examples/playwright/src/theia-toolbar.ts @@ -19,7 +19,7 @@ import { TheiaPageObject } from './theia-page-object'; import { TheiaToolbarItem } from './theia-toolbar-item'; export class TheiaToolbar extends TheiaPageObject { - selector = 'div#main-toolbar.p-TabBar-toolbar'; + selector = 'div#main-toolbar.lm-TabBar-toolbar'; protected async toolbarElementHandle(): Promise | null> { return this.page.$(this.selector); diff --git a/examples/playwright/src/theia-view.ts b/examples/playwright/src/theia-view.ts index c89e7ef5aa4f7..d32faef894a92 100644 --- a/examples/playwright/src/theia-view.ts +++ b/examples/playwright/src/theia-view.ts @@ -84,11 +84,11 @@ export class TheiaView extends TheiaPageObject { } async isActive(): Promise { - return await this.isTabVisible() && containsClass(this.tabElement(), 'p-mod-current'); + return await this.isTabVisible() && containsClass(this.tabElement(), 'lm-mod-current'); } async isClosable(): Promise { - return await this.isTabVisible() && containsClass(this.tabElement(), 'p-mod-closable'); + return await this.isTabVisible() && containsClass(this.tabElement(), 'lm-mod-closable'); } async close(waitForClosed = true): Promise { @@ -101,7 +101,7 @@ export class TheiaView extends TheiaPageObject { const tab = await this.tabElement(); const side = await this.side(); if (side === 'main' || side === 'bottom') { - const closeIcon = await tab?.waitForSelector('div.p-TabBar-tabCloseIcon'); + const closeIcon = await tab?.waitForSelector('div.lm-TabBar-tabCloseIcon'); await closeIcon?.click(); } else { const menu = await this.openContextMenuOnTab(); @@ -130,7 +130,7 @@ export class TheiaView extends TheiaPageObject { } const tab = await this.tabElement(); if (tab) { - return textContent(tab.waitForSelector('div.theia-tab-icon-label > div.p-TabBar-tabLabel')); + return textContent(tab.waitForSelector('div.theia-tab-icon-label > div.lm-TabBar-tabLabel')); } return undefined; } diff --git a/packages/ai-core/src/browser/ai-settings-service.ts b/packages/ai-core/src/browser/ai-settings-service.ts index f4c2ea5124688..71d3be6f0eb10 100644 --- a/packages/ai-core/src/browser/ai-settings-service.ts +++ b/packages/ai-core/src/browser/ai-settings-service.ts @@ -16,7 +16,7 @@ import { DisposableCollection, Emitter, Event } from '@theia/core'; import { PreferenceScope, PreferenceService } from '@theia/core/lib/browser'; import { inject, injectable } from '@theia/core/shared/inversify'; -import { JSONObject } from '@theia/core/shared/@phosphor/coreutils'; +import { JSONObject } from '@theia/core/shared/@lumino/coreutils'; import { AISettings, AISettingsService, AgentSettings } from '../common'; @injectable() diff --git a/packages/console/src/browser/console-content-widget.tsx b/packages/console/src/browser/console-content-widget.tsx index e9e3f0a4c3271..7ff3f6fc66cc9 100644 --- a/packages/console/src/browser/console-content-widget.tsx +++ b/packages/console/src/browser/console-content-widget.tsx @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import { interfaces, Container, injectable } from '@theia/core/shared/inversify'; import { MenuPath } from '@theia/core'; import { TreeProps } from '@theia/core/lib/browser/tree'; diff --git a/packages/console/src/browser/console-widget.ts b/packages/console/src/browser/console-widget.ts index 8948c9b57141b..392fcf2904d32 100644 --- a/packages/console/src/browser/console-widget.ts +++ b/packages/console/src/browser/console-widget.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { ElementExt } from '@theia/core/shared/@phosphor/domutils'; +import { ElementExt } from '@theia/core/shared/@lumino/domutils'; import { injectable, inject, postConstruct, interfaces, Container } from '@theia/core/shared/inversify'; import { TreeSourceNode } from '@theia/core/lib/browser/source-tree'; import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service'; diff --git a/packages/core/README.md b/packages/core/README.md index 2f598c6e398a9..5deaa68fbbe41 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -74,16 +74,16 @@ export class SomeClass { - `electron-store` (from [`electron-store@^8.0.0`](https://www.npmjs.com/package/electron-store)) - `fix-path` (from [`fix-path@^3.0.0`](https://www.npmjs.com/package/fix-path)) - `@theia/core/shared/...` - - `@phosphor/algorithm` (from [`@phosphor/algorithm@1`](https://www.npmjs.com/package/@phosphor/algorithm)) - - `@phosphor/commands` (from [`@phosphor/commands@1`](https://www.npmjs.com/package/@phosphor/commands)) - - `@phosphor/coreutils` (from [`@phosphor/coreutils@1`](https://www.npmjs.com/package/@phosphor/coreutils)) - - `@phosphor/domutils` (from [`@phosphor/domutils@1`](https://www.npmjs.com/package/@phosphor/domutils)) - - `@phosphor/dragdrop` (from [`@phosphor/dragdrop@1`](https://www.npmjs.com/package/@phosphor/dragdrop)) - - `@phosphor/messaging` (from [`@phosphor/messaging@1`](https://www.npmjs.com/package/@phosphor/messaging)) - - `@phosphor/properties` (from [`@phosphor/properties@1`](https://www.npmjs.com/package/@phosphor/properties)) - - `@phosphor/signaling` (from [`@phosphor/signaling@1`](https://www.npmjs.com/package/@phosphor/signaling)) - - `@phosphor/virtualdom` (from [`@phosphor/virtualdom@1`](https://www.npmjs.com/package/@phosphor/virtualdom)) - - `@phosphor/widgets` (from [`@phosphor/widgets@1`](https://www.npmjs.com/package/@phosphor/widgets)) + - `@lumino/algorithm` (from [`@lumino/algorithm@^2.0.2`](https://www.npmjs.com/package/@lumino/algorithm)) + - `@lumino/commands` (from [`@lumino/commands@^2.3.1`](https://www.npmjs.com/package/@lumino/commands)) + - `@lumino/coreutils` (from [`@lumino/coreutils@^2.2.0`](https://www.npmjs.com/package/@lumino/coreutils)) + - `@lumino/domutils` (from [`@lumino/domutils@^2.0.2`](https://www.npmjs.com/package/@lumino/domutils)) + - `@lumino/dragdrop` (from [`@lumino/dragdrop@^2.1.5`](https://www.npmjs.com/package/@lumino/dragdrop)) + - `@lumino/messaging` (from [`@lumino/messaging@^2.0.2`](https://www.npmjs.com/package/@lumino/messaging)) + - `@lumino/properties` (from [`@lumino/properties@^2.0.2`](https://www.npmjs.com/package/@lumino/properties)) + - `@lumino/signaling` (from [`@lumino/signaling@^2.1.3`](https://www.npmjs.com/package/@lumino/signaling)) + - `@lumino/virtualdom` (from [`@lumino/virtualdom@^2.0.2`](https://www.npmjs.com/package/@lumino/virtualdom)) + - `@lumino/widgets` (from [`@lumino/widgets@2.5.0`](https://www.npmjs.com/package/@lumino/widgets/v/2.5.0)) - `@theia/application-package` (from [`@theia/application-package@1.56.0`](https://www.npmjs.com/package/@theia/application-package/v/1.56.0)) - `@theia/application-package/lib/api` (from [`@theia/application-package@1.56.0`](https://www.npmjs.com/package/@theia/application-package/v/1.56.0)) - `@theia/application-package/lib/environment` (from [`@theia/application-package@1.56.0`](https://www.npmjs.com/package/@theia/application-package/v/1.56.0)) diff --git a/packages/core/package.json b/packages/core/package.json index bb20d499acf0c..e4a9d501333cb 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -7,16 +7,16 @@ "dependencies": { "@babel/runtime": "^7.10.0", "@parcel/watcher": "^2.5.0", - "@phosphor/algorithm": "1", - "@phosphor/commands": "1", - "@phosphor/coreutils": "1", - "@phosphor/domutils": "1", - "@phosphor/dragdrop": "1", - "@phosphor/messaging": "1", - "@phosphor/properties": "1", - "@phosphor/signaling": "1", - "@phosphor/virtualdom": "1", - "@phosphor/widgets": "1", + "@lumino/algorithm": "^2.0.2", + "@lumino/commands": "^2.3.1", + "@lumino/coreutils": "^2.2.0", + "@lumino/domutils": "^2.0.2", + "@lumino/dragdrop": "^2.1.5", + "@lumino/messaging": "^2.0.2", + "@lumino/properties": "^2.0.2", + "@lumino/signaling": "^2.1.3", + "@lumino/virtualdom": "^2.0.2", + "@lumino/widgets": "2.5.0", "@theia/application-package": "1.56.0", "@theia/request": "1.56.0", "@types/body-parser": "^1.16.4", @@ -93,16 +93,16 @@ }, "shared": { "export *": [ - "@phosphor/algorithm", - "@phosphor/commands", - "@phosphor/coreutils", - "@phosphor/domutils", - "@phosphor/dragdrop", - "@phosphor/messaging", - "@phosphor/properties", - "@phosphor/signaling", - "@phosphor/virtualdom", - "@phosphor/widgets", + "@lumino/algorithm", + "@lumino/commands", + "@lumino/coreutils", + "@lumino/domutils", + "@lumino/dragdrop", + "@lumino/messaging", + "@lumino/properties", + "@lumino/signaling", + "@lumino/virtualdom", + "@lumino/widgets", "@theia/application-package", "@theia/application-package/lib/api", "@theia/application-package/lib/environment", diff --git a/packages/core/shared/@lumino/algorithm/index.d.ts b/packages/core/shared/@lumino/algorithm/index.d.ts new file mode 100644 index 0000000000000..26a0bd8c02a4d --- /dev/null +++ b/packages/core/shared/@lumino/algorithm/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/algorithm'; diff --git a/packages/core/shared/@lumino/algorithm/index.js b/packages/core/shared/@lumino/algorithm/index.js new file mode 100644 index 0000000000000..0984b137ee3ba --- /dev/null +++ b/packages/core/shared/@lumino/algorithm/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/algorithm'); diff --git a/packages/core/shared/@lumino/commands/index.d.ts b/packages/core/shared/@lumino/commands/index.d.ts new file mode 100644 index 0000000000000..cc7f16accf8ef --- /dev/null +++ b/packages/core/shared/@lumino/commands/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/commands'; diff --git a/packages/core/shared/@lumino/commands/index.js b/packages/core/shared/@lumino/commands/index.js new file mode 100644 index 0000000000000..dbd693022cbff --- /dev/null +++ b/packages/core/shared/@lumino/commands/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/commands'); diff --git a/packages/core/shared/@lumino/coreutils/index.d.ts b/packages/core/shared/@lumino/coreutils/index.d.ts new file mode 100644 index 0000000000000..85e2664265e7f --- /dev/null +++ b/packages/core/shared/@lumino/coreutils/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/coreutils'; diff --git a/packages/core/shared/@lumino/coreutils/index.js b/packages/core/shared/@lumino/coreutils/index.js new file mode 100644 index 0000000000000..375092f9087fe --- /dev/null +++ b/packages/core/shared/@lumino/coreutils/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/coreutils'); diff --git a/packages/core/shared/@lumino/domutils/index.d.ts b/packages/core/shared/@lumino/domutils/index.d.ts new file mode 100644 index 0000000000000..6a896aa54b773 --- /dev/null +++ b/packages/core/shared/@lumino/domutils/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/domutils'; diff --git a/packages/core/shared/@lumino/domutils/index.js b/packages/core/shared/@lumino/domutils/index.js new file mode 100644 index 0000000000000..eb656729ed863 --- /dev/null +++ b/packages/core/shared/@lumino/domutils/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/domutils'); diff --git a/packages/core/shared/@lumino/dragdrop/index.d.ts b/packages/core/shared/@lumino/dragdrop/index.d.ts new file mode 100644 index 0000000000000..644f2b6fe4f13 --- /dev/null +++ b/packages/core/shared/@lumino/dragdrop/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/dragdrop'; diff --git a/packages/core/shared/@lumino/dragdrop/index.js b/packages/core/shared/@lumino/dragdrop/index.js new file mode 100644 index 0000000000000..5f914cfbe2858 --- /dev/null +++ b/packages/core/shared/@lumino/dragdrop/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/dragdrop'); diff --git a/packages/core/shared/@lumino/messaging/index.d.ts b/packages/core/shared/@lumino/messaging/index.d.ts new file mode 100644 index 0000000000000..4a6450985779f --- /dev/null +++ b/packages/core/shared/@lumino/messaging/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/messaging'; diff --git a/packages/core/shared/@lumino/messaging/index.js b/packages/core/shared/@lumino/messaging/index.js new file mode 100644 index 0000000000000..c7ce1c7269c7f --- /dev/null +++ b/packages/core/shared/@lumino/messaging/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/messaging'); diff --git a/packages/core/shared/@lumino/properties/index.d.ts b/packages/core/shared/@lumino/properties/index.d.ts new file mode 100644 index 0000000000000..97c4bf8e559dc --- /dev/null +++ b/packages/core/shared/@lumino/properties/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/properties'; diff --git a/packages/core/shared/@lumino/properties/index.js b/packages/core/shared/@lumino/properties/index.js new file mode 100644 index 0000000000000..b4da58af70c4c --- /dev/null +++ b/packages/core/shared/@lumino/properties/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/properties'); diff --git a/packages/core/shared/@lumino/signaling/index.d.ts b/packages/core/shared/@lumino/signaling/index.d.ts new file mode 100644 index 0000000000000..cbeaee128d2de --- /dev/null +++ b/packages/core/shared/@lumino/signaling/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/signaling'; diff --git a/packages/core/shared/@lumino/signaling/index.js b/packages/core/shared/@lumino/signaling/index.js new file mode 100644 index 0000000000000..82c117b4cb878 --- /dev/null +++ b/packages/core/shared/@lumino/signaling/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/signaling'); diff --git a/packages/core/shared/@lumino/virtualdom/index.d.ts b/packages/core/shared/@lumino/virtualdom/index.d.ts new file mode 100644 index 0000000000000..7658440f6694b --- /dev/null +++ b/packages/core/shared/@lumino/virtualdom/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/virtualdom'; diff --git a/packages/core/shared/@lumino/virtualdom/index.js b/packages/core/shared/@lumino/virtualdom/index.js new file mode 100644 index 0000000000000..7b27c8ecef410 --- /dev/null +++ b/packages/core/shared/@lumino/virtualdom/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/virtualdom'); diff --git a/packages/core/shared/@lumino/widgets/index.d.ts b/packages/core/shared/@lumino/widgets/index.d.ts new file mode 100644 index 0000000000000..e5fad1af23796 --- /dev/null +++ b/packages/core/shared/@lumino/widgets/index.d.ts @@ -0,0 +1 @@ +export * from '@lumino/widgets'; diff --git a/packages/core/shared/@lumino/widgets/index.js b/packages/core/shared/@lumino/widgets/index.js new file mode 100644 index 0000000000000..e295371ce1eb7 --- /dev/null +++ b/packages/core/shared/@lumino/widgets/index.js @@ -0,0 +1 @@ +module.exports = require('@lumino/widgets'); diff --git a/packages/core/shared/@phosphor/algorithm/index.d.ts b/packages/core/shared/@phosphor/algorithm/index.d.ts deleted file mode 100644 index 9efacfa84ec28..0000000000000 --- a/packages/core/shared/@phosphor/algorithm/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@phosphor/algorithm'; diff --git a/packages/core/shared/@phosphor/algorithm/index.js b/packages/core/shared/@phosphor/algorithm/index.js deleted file mode 100644 index 933da4a50ae90..0000000000000 --- a/packages/core/shared/@phosphor/algorithm/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@phosphor/algorithm'); diff --git a/packages/core/shared/@phosphor/commands/index.d.ts b/packages/core/shared/@phosphor/commands/index.d.ts deleted file mode 100644 index 3fd8f3f6097c8..0000000000000 --- a/packages/core/shared/@phosphor/commands/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@phosphor/commands'; diff --git a/packages/core/shared/@phosphor/commands/index.js b/packages/core/shared/@phosphor/commands/index.js deleted file mode 100644 index 363437779c5af..0000000000000 --- a/packages/core/shared/@phosphor/commands/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@phosphor/commands'); diff --git a/packages/core/shared/@phosphor/coreutils/index.d.ts b/packages/core/shared/@phosphor/coreutils/index.d.ts deleted file mode 100644 index a3296097054c9..0000000000000 --- a/packages/core/shared/@phosphor/coreutils/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@phosphor/coreutils'; diff --git a/packages/core/shared/@phosphor/coreutils/index.js b/packages/core/shared/@phosphor/coreutils/index.js deleted file mode 100644 index 1e024a732f5b1..0000000000000 --- a/packages/core/shared/@phosphor/coreutils/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@phosphor/coreutils'); diff --git a/packages/core/shared/@phosphor/domutils/index.d.ts b/packages/core/shared/@phosphor/domutils/index.d.ts deleted file mode 100644 index dccdd4e049958..0000000000000 --- a/packages/core/shared/@phosphor/domutils/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@phosphor/domutils'; diff --git a/packages/core/shared/@phosphor/domutils/index.js b/packages/core/shared/@phosphor/domutils/index.js deleted file mode 100644 index 46cfdb0fc69c2..0000000000000 --- a/packages/core/shared/@phosphor/domutils/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@phosphor/domutils'); diff --git a/packages/core/shared/@phosphor/dragdrop/index.d.ts b/packages/core/shared/@phosphor/dragdrop/index.d.ts deleted file mode 100644 index c55e5a3d528b4..0000000000000 --- a/packages/core/shared/@phosphor/dragdrop/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@phosphor/dragdrop'; diff --git a/packages/core/shared/@phosphor/dragdrop/index.js b/packages/core/shared/@phosphor/dragdrop/index.js deleted file mode 100644 index 9023ee3f6faac..0000000000000 --- a/packages/core/shared/@phosphor/dragdrop/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@phosphor/dragdrop'); diff --git a/packages/core/shared/@phosphor/messaging/index.d.ts b/packages/core/shared/@phosphor/messaging/index.d.ts deleted file mode 100644 index 70057b7d1ded2..0000000000000 --- a/packages/core/shared/@phosphor/messaging/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@phosphor/messaging'; diff --git a/packages/core/shared/@phosphor/messaging/index.js b/packages/core/shared/@phosphor/messaging/index.js deleted file mode 100644 index 21dba76379a7c..0000000000000 --- a/packages/core/shared/@phosphor/messaging/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@phosphor/messaging'); diff --git a/packages/core/shared/@phosphor/properties/index.d.ts b/packages/core/shared/@phosphor/properties/index.d.ts deleted file mode 100644 index 2a6bbe1bc6e62..0000000000000 --- a/packages/core/shared/@phosphor/properties/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@phosphor/properties'; diff --git a/packages/core/shared/@phosphor/properties/index.js b/packages/core/shared/@phosphor/properties/index.js deleted file mode 100644 index 6ec7304ff4a29..0000000000000 --- a/packages/core/shared/@phosphor/properties/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@phosphor/properties'); diff --git a/packages/core/shared/@phosphor/signaling/index.d.ts b/packages/core/shared/@phosphor/signaling/index.d.ts deleted file mode 100644 index addc9b7ed5d34..0000000000000 --- a/packages/core/shared/@phosphor/signaling/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@phosphor/signaling'; diff --git a/packages/core/shared/@phosphor/signaling/index.js b/packages/core/shared/@phosphor/signaling/index.js deleted file mode 100644 index e5a6f405891c4..0000000000000 --- a/packages/core/shared/@phosphor/signaling/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@phosphor/signaling'); diff --git a/packages/core/shared/@phosphor/virtualdom/index.d.ts b/packages/core/shared/@phosphor/virtualdom/index.d.ts deleted file mode 100644 index 3812e0a30ae1c..0000000000000 --- a/packages/core/shared/@phosphor/virtualdom/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@phosphor/virtualdom'; diff --git a/packages/core/shared/@phosphor/virtualdom/index.js b/packages/core/shared/@phosphor/virtualdom/index.js deleted file mode 100644 index 7ee6cd8c6955b..0000000000000 --- a/packages/core/shared/@phosphor/virtualdom/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@phosphor/virtualdom'); diff --git a/packages/core/shared/@phosphor/widgets/index.d.ts b/packages/core/shared/@phosphor/widgets/index.d.ts deleted file mode 100644 index 675da0421a86e..0000000000000 --- a/packages/core/shared/@phosphor/widgets/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@phosphor/widgets'; diff --git a/packages/core/shared/@phosphor/widgets/index.js b/packages/core/shared/@phosphor/widgets/index.js deleted file mode 100644 index b9a8778874ea9..0000000000000 --- a/packages/core/shared/@phosphor/widgets/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@phosphor/widgets'); diff --git a/packages/core/src/browser/common-frontend-contribution.ts b/packages/core/src/browser/common-frontend-contribution.ts index a1bb4f383ac31..fcc10814c2437 100644 --- a/packages/core/src/browser/common-frontend-contribution.ts +++ b/packages/core/src/browser/common-frontend-contribution.ts @@ -479,28 +479,30 @@ export class CommonFrontendContribution implements FrontendApplicationContributi this.preferences.ready.then(() => this.setSashProperties()); this.preferences.onPreferenceChanged(e => this.handlePreferenceChange(e, app)); - app.shell.leftPanelHandler.addBottomMenu({ - id: 'settings-menu', - iconClass: codicon('settings-gear'), - title: nls.localizeByDefault(CommonCommands.MANAGE_CATEGORY), - menuPath: MANAGE_MENU, - order: 0, - }); - const accountsMenu: SidebarMenu = { - id: 'accounts-menu', - iconClass: codicon('account'), - title: nls.localizeByDefault('Accounts'), - menuPath: ACCOUNTS_MENU, - order: 1, - onDidBadgeChange: this.authenticationService.onDidUpdateSignInCount - }; - this.authenticationService.onDidRegisterAuthenticationProvider(() => { - app.shell.leftPanelHandler.addBottomMenu(accountsMenu); - }); - this.authenticationService.onDidUnregisterAuthenticationProvider(() => { - if (this.authenticationService.getProviderIds().length === 0) { - app.shell.leftPanelHandler.removeBottomMenu(accountsMenu.id); - } + app.shell.initialized.then(() => { + app.shell.leftPanelHandler.addBottomMenu({ + id: 'settings-menu', + iconClass: codicon('settings-gear'), + title: nls.localizeByDefault(CommonCommands.MANAGE_CATEGORY), + menuPath: MANAGE_MENU, + order: 0, + }); + const accountsMenu: SidebarMenu = { + id: 'accounts-menu', + iconClass: codicon('account'), + title: nls.localizeByDefault('Accounts'), + menuPath: ACCOUNTS_MENU, + order: 1, + onDidBadgeChange: this.authenticationService.onDidUpdateSignInCount + }; + this.authenticationService.onDidRegisterAuthenticationProvider(() => { + app.shell.leftPanelHandler.addBottomMenu(accountsMenu); + }); + this.authenticationService.onDidUnregisterAuthenticationProvider(() => { + if (this.authenticationService.getProviderIds().length === 0) { + app.shell.leftPanelHandler.removeBottomMenu(accountsMenu.id); + } + }); }); } diff --git a/packages/core/src/browser/common-styling-participants.ts b/packages/core/src/browser/common-styling-participants.ts index 7ad9951a393c8..75c3bc12ee89e 100644 --- a/packages/core/src/browser/common-styling-participants.ts +++ b/packages/core/src/browser/common-styling-participants.ts @@ -138,14 +138,14 @@ export class MenuStylingParticipant implements StylingParticipant { if (isHighContrast(theme.type) && focusBorder) { // Menu items collector.addRule(` - .p-Menu .p-Menu-item.p-mod-active { + .lm-Menu .lm-Menu-item.lm-mod-active { outline: 1px solid ${focusBorder}; outline-offset: -1px; } - .p-MenuBar .p-MenuBar-item.p-mod-active { + .lm-MenuBar .lm-MenuBar-item.lm-mod-active { outline: 1px dashed ${focusBorder}; } - .p-MenuBar.p-mod-active .p-MenuBar-item.p-mod-active { + .lm-MenuBar.lm-mod-active .lm-MenuBar-item.lm-mod-active { outline: 1px solid ${focusBorder}; } `); @@ -166,7 +166,7 @@ export class BadgeStylingParticipant implements StylingParticipant { const contrastBorder = theme.getColor('contrastBorder'); if (isHighContrast(theme.type) && contrastBorder) { - collector.addRule(`.p-TabBar .theia-badge-decorator-sidebar { + collector.addRule(`.lm-TabBar .theia-badge-decorator-sidebar { outline: 1px solid ${contrastBorder}; }`); } @@ -182,20 +182,20 @@ export class TabbarStylingParticipant implements StylingParticipant { if (highContrast && focusBorder) { collector.addRule(` - #theia-bottom-content-panel .p-TabBar .p-TabBar-tab, - #theia-main-content-panel .p-TabBar .p-TabBar-tab { + #theia-bottom-content-panel .lm-TabBar .lm-TabBar-tab, + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab { outline-offset: -4px; } - #theia-bottom-content-panel .p-TabBar .p-TabBar-tab.p-mod-current, - #theia-main-content-panel .p-TabBar .p-TabBar-tab.p-mod-current { + #theia-bottom-content-panel .lm-TabBar .lm-TabBar-tab.lm-mod-current, + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab.lm-mod-current { outline: 1px solid ${focusBorder}; } - #theia-bottom-content-panel .p-TabBar:not(.theia-tabBar-active) .p-TabBar-tab.p-mod-current, - #theia-main-content-panel .p-TabBar:not(.theia-tabBar-active) .p-TabBar-tab.p-mod-current { + #theia-bottom-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab.lm-mod-current, + #theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab.lm-mod-current { outline: 1px dotted ${focusBorder}; } - #theia-bottom-content-panel .p-TabBar .p-TabBar-tab:not(.p-mod-current):hover, - #theia-main-content-panel .p-TabBar .p-TabBar-tab:not(.p-mod-current):hover { + #theia-bottom-content-panel .lm-TabBar .lm-TabBar-tab:not(.lm-mod-current):hover, + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab:not(.lm-mod-current):hover { outline: 1px dashed ${focusBorder}; } `); @@ -206,13 +206,13 @@ export class TabbarStylingParticipant implements StylingParticipant { const tabActiveBorder = theme.getColor('tab.activeBorder') || (highContrast && contrastBorder) || 'transparent'; const tabUnfocusedActiveBorder = theme.getColor('tab.unfocusedActiveBorder') || (highContrast && contrastBorder) || 'transparent'; collector.addRule(` - #theia-main-content-panel .p-TabBar .p-TabBar-tab.p-mod-current { + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab.lm-mod-current { color: var(--theia-tab-activeForeground); ${tabActiveBackground ? `background: ${tabActiveBackground};` : ''} ${tabActiveBorderTop ? `border-top: 1px solid ${tabActiveBorderTop};` : ''} border-bottom: 1px solid ${tabActiveBorder}; } - #theia-main-content-panel .p-TabBar:not(.theia-tabBar-active) .p-TabBar-tab.p-mod-current { + #theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab.lm-mod-current { background: var(--theia-tab-unfocusedActiveBackground); color: var(--theia-tab-unfocusedActiveForeground); ${tabUnfocusedActiveBorderTop ? `border-top: 1px solid ${tabUnfocusedActiveBorderTop};` : ''} @@ -227,18 +227,18 @@ export class TabbarStylingParticipant implements StylingParticipant { if (tabActiveModifiedBorder || tabInactiveModifiedBorder) { collector.addRule(` body.theia-editor-highlightModifiedTabs - #theia-main-content-panel .p-TabBar .p-TabBar-tab.theia-mod-dirty { + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab.theia-mod-dirty { border-top: 2px solid ${tabInactiveModifiedBorder}; padding-bottom: 1px; } body.theia-editor-highlightModifiedTabs - #theia-main-content-panel .p-TabBar.theia-tabBar-active .p-TabBar-tab.theia-mod-dirty.p-mod-current { + #theia-main-content-panel .lm-TabBar.theia-tabBar-active .lm-TabBar-tab.theia-mod-dirty.lm-mod-current { border-top: 2px solid ${tabActiveModifiedBorder}; } body.theia-editor-highlightModifiedTabs - #theia-main-content-panel .p-TabBar:not(.theia-tabBar-active) .p-TabBar-tab.theia-mod-dirty:not(.p-mod-current) { + #theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab.theia-mod-dirty:not(.lm-mod-current) { border-top: 2px solid ${tabUnfocusedInactiveModifiedBorder}; } `); @@ -247,12 +247,12 @@ export class TabbarStylingParticipant implements StylingParticipant { // Activity Bar Active Border const activityBarActiveBorder = theme.getColor('activityBar.activeBorder') || 'var(--theia-activityBar-foreground)'; collector.addRule(` - .p-TabBar.theia-app-left .p-TabBar-tab.p-mod-current { + .lm-TabBar.theia-app-left .lm-TabBar-tab.lm-mod-current { border-top-color: transparent; box-shadow: 2px 0 0 ${activityBarActiveBorder} inset; } - .p-TabBar.theia-app-right .p-TabBar-tab.p-mod-current { + .lm-TabBar.theia-app-right .lm-TabBar-tab.lm-mod-current { border-top-color: transparent; box-shadow: -2px 0 0 ${activityBarActiveBorder} inset; } @@ -261,7 +261,7 @@ export class TabbarStylingParticipant implements StylingParticipant { const tabHoverBackground = theme.getColor('tab.hoverBackground'); if (tabHoverBackground) { collector.addRule(` - #theia-main-content-panel .p-TabBar .p-TabBar-tab:hover { + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab:hover { background-color: ${tabHoverBackground}; } `); @@ -270,7 +270,7 @@ export class TabbarStylingParticipant implements StylingParticipant { const tabUnfocusedHoverBackground = theme.getColor('tab.unfocusedHoverBackground'); if (tabUnfocusedHoverBackground) { collector.addRule(` - #theia-main-content-panel .p-TabBar:not(.theia-tabBar-active) .p-TabBar-tab:hover { + #theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab:hover { background-color: ${tabUnfocusedHoverBackground}; } `); @@ -280,7 +280,7 @@ export class TabbarStylingParticipant implements StylingParticipant { const tabHoverForeground = theme.getColor('tab.hoverForeground'); if (tabHoverForeground) { collector.addRule(` - #theia-main-content-panel .p-TabBar .p-TabBar-tab:hover { + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab:hover { color: ${tabHoverForeground}; } `); @@ -289,7 +289,7 @@ export class TabbarStylingParticipant implements StylingParticipant { const tabUnfocusedHoverForeground = theme.getColor('tab.unfocusedHoverForeground'); if (tabUnfocusedHoverForeground) { collector.addRule(` - #theia-main-content-panel .p-TabBar:not(.theia-tabBar-active) .p-TabBar-tab:hover { + #theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab:hover { color: ${tabUnfocusedHoverForeground}; } `); @@ -299,7 +299,7 @@ export class TabbarStylingParticipant implements StylingParticipant { const tabHoverBorder = theme.getColor('tab.hoverBorder'); if (tabHoverBorder) { collector.addRule(` - #theia-main-content-panel .p-TabBar .p-TabBar-tab:hover { + #theia-main-content-panel .lm-TabBar .lm-TabBar-tab:hover { box-shadow: 0 1px 0 ${tabHoverBorder} inset; } `); @@ -308,7 +308,7 @@ export class TabbarStylingParticipant implements StylingParticipant { const tabUnfocusedHoverBorder = theme.getColor('tab.unfocusedHoverBorder'); if (tabUnfocusedHoverBorder) { collector.addRule(` - #theia-main-content-panel .p-TabBar:not(.theia-tabBar-active) .p-TabBar-tab:hover { + #theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab:hover { box-shadow: 0 1px 0 ${tabUnfocusedHoverBorder} inset; } `); diff --git a/packages/core/src/browser/menu/browser-context-menu-renderer.ts b/packages/core/src/browser/menu/browser-context-menu-renderer.ts index 1ae5f1f826878..baa5e28167873 100644 --- a/packages/core/src/browser/menu/browser-context-menu-renderer.ts +++ b/packages/core/src/browser/menu/browser-context-menu-renderer.ts @@ -40,8 +40,7 @@ export class BrowserContextMenuRenderer extends ContextMenuRenderer { if (onHide) { contextMenu.aboutToClose.connect(() => onHide!()); } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - contextMenu.open(x, y, undefined, context); + contextMenu.open(x, y, { host: context?.ownerDocument.body}); return new BrowserContextMenuAccess(contextMenu); } diff --git a/packages/core/src/browser/menu/browser-menu-plugin.ts b/packages/core/src/browser/menu/browser-menu-plugin.ts index d1ceac06b8220..e83567766df5c 100644 --- a/packages/core/src/browser/menu/browser-menu-plugin.ts +++ b/packages/core/src/browser/menu/browser-menu-plugin.ts @@ -15,8 +15,8 @@ // ***************************************************************************** import { injectable, inject } from 'inversify'; -import { MenuBar, Menu as MenuWidget, Widget } from '@phosphor/widgets'; -import { CommandRegistry as PhosphorCommandRegistry } from '@phosphor/commands'; +import { MenuBar, Menu as MenuWidget, Widget } from '@lumino/widgets'; +import { CommandRegistry as LuminoCommandRegistry } from '@lumino/commands'; import { CommandRegistry, environment, DisposableCollection, Disposable, MenuModelRegistry, MAIN_MENU_BAR, MenuPath, MenuNode, MenuCommandExecutor, CompoundMenuNode, CompoundMenuNodeRole, CommandMenuNode @@ -34,6 +34,27 @@ import { PreferenceService } from '../preferences/preference-service'; export abstract class MenuBarWidget extends MenuBar { abstract activateMenu(label: string, ...labels: string[]): Promise; abstract triggerMenuItem(label: string, ...labels: string[]): Promise; + /* + * We override the activeIndex setter to avoid the menu items check + * See https://github.com/jupyterlab/lumino/issues/729 + */ + override set activeIndex(value: number) { + // Adjust the value for an out of range index. + if (value < 0 || value >= Reflect.get(this, '_menus').length) { + value = -1; + } + + // Bail early if the index will not change. + if (Reflect.get(this, '_activeIndex') === value) { + return; + } + + // Update the active index. + Reflect.set(this, '_activeIndex', value); + + // Schedule an update of the items. + this.update(); + } } export interface BrowserMenuOptions extends MenuWidget.IOptions { @@ -272,14 +293,14 @@ export class DynamicMenuWidget extends MenuWidget { }); } - public override open(x: number, y: number, options?: MenuWidget.IOpenOptions, anchor?: HTMLElement): void { + public override open(x: number, y: number, options?: MenuWidget.IOpenOptions): void { const cb = () => { this.restoreFocusedElement(); this.aboutToClose.disconnect(cb); }; this.aboutToClose.connect(cb); this.preserveFocusedElement(); - super.open(x, y, options, anchor); + super.open(x, y, options); } protected updateSubMenus(parent: MenuWidget, menu: CompoundMenuNode, commands: MenuCommandRegistry): void { @@ -415,9 +436,9 @@ export class BrowserMenuBarContribution implements FrontendApplicationContributi } /** - * Stores Theia-specific action menu nodes instead of PhosphorJS commands with their handlers. + * Stores Theia-specific action menu nodes instead of Lumino commands with their handlers. */ -export class MenuCommandRegistry extends PhosphorCommandRegistry { +export class MenuCommandRegistry extends LuminoCommandRegistry { protected actions = new Map(); protected toDispose = new DisposableCollection(); @@ -466,7 +487,7 @@ export class MenuCommandRegistry extends PhosphorCommandRegistry { const unregisterCommand = this.addCommand(id, { execute: () => commandExecutor.executeCommand(menuPath, id, ...args), label: menu.label, - icon: menu.icon, + iconClass: menu.icon, isEnabled: () => enabled, isVisible: () => visible, isToggled: () => toggled @@ -482,7 +503,7 @@ export class MenuCommandRegistry extends PhosphorCommandRegistry { this.addKeyBinding({ command: id, keys, - selector: '.p-Widget' // We have the PhosphorJS dependency anyway. + selector: '.lm-Widget' // We have the Lumino dependency anyway. }); } return Disposable.create(() => unregisterCommand.dispose()); diff --git a/packages/core/src/browser/preferences/injectable-preference-proxy.ts b/packages/core/src/browser/preferences/injectable-preference-proxy.ts index bad458d03020d..ec2ad5922cd72 100644 --- a/packages/core/src/browser/preferences/injectable-preference-proxy.ts +++ b/packages/core/src/browser/preferences/injectable-preference-proxy.ts @@ -19,7 +19,7 @@ import { PreferenceSchema } from '../../common/preferences/preference-schema'; import { Disposable, DisposableCollection, Emitter, Event, isObject, MaybePromise } from '../../common'; import { PreferenceChangeEvent, PreferenceEventEmitter, PreferenceProxy, PreferenceProxyOptions, PreferenceRetrieval } from './preference-proxy'; import { PreferenceChange, PreferenceChangeImpl, PreferenceChanges, PreferenceScope, PreferenceService } from './preference-service'; -import { JSONValue } from '@phosphor/coreutils'; +import { JSONValue } from '@lumino/coreutils'; import { PreferenceProviderDataChange } from './preference-provider'; import { OverridePreferenceName } from './preference-language-override-service'; diff --git a/packages/core/src/browser/preferences/preference-contribution.ts b/packages/core/src/browser/preferences/preference-contribution.ts index a86e3e9236f0e..7cac56759cba5 100644 --- a/packages/core/src/browser/preferences/preference-contribution.ts +++ b/packages/core/src/browser/preferences/preference-contribution.ts @@ -28,7 +28,7 @@ import { bindPreferenceConfigurations, PreferenceConfigurations } from './prefer export { PreferenceSchema, PreferenceSchemaProperties, PreferenceDataSchema, PreferenceItem, PreferenceSchemaProperty, PreferenceDataProperty }; import { isObject, Mutable } from '../../common/types'; import { PreferenceLanguageOverrideService } from './preference-language-override-service'; -import { JSONValue } from '@phosphor/coreutils'; +import { JSONValue } from '@lumino/coreutils'; /* eslint-disable guard-for-in, @typescript-eslint/no-explicit-any */ diff --git a/packages/core/src/browser/preferences/preference-provider.ts b/packages/core/src/browser/preferences/preference-provider.ts index 058dfc2fd6cf3..1fcaea75bb453 100644 --- a/packages/core/src/browser/preferences/preference-provider.ts +++ b/packages/core/src/browser/preferences/preference-provider.ts @@ -18,7 +18,7 @@ import debounce = require('p-debounce'); import { injectable, inject } from 'inversify'; -import { JSONExt, JSONValue } from '@phosphor/coreutils'; +import { JSONExt, JSONValue } from '@lumino/coreutils'; import URI from '../../common/uri'; import { Disposable, DisposableCollection, Emitter, Event, isObject } from '../../common'; import { Deferred } from '../../common/promise-util'; diff --git a/packages/core/src/browser/preferences/preference-service.ts b/packages/core/src/browser/preferences/preference-service.ts index 5947af5d303e3..0c0ed6ae32118 100644 --- a/packages/core/src/browser/preferences/preference-service.ts +++ b/packages/core/src/browser/preferences/preference-service.ts @@ -24,7 +24,7 @@ import { PreferenceSchemaProvider } from './preference-contribution'; import URI from '../../common/uri'; import { PreferenceScope } from './preference-scope'; import { PreferenceConfigurations } from './preference-configurations'; -import { JSONExt, JSONValue } from '@phosphor/coreutils/lib/json'; +import { JSONExt, JSONValue } from '@lumino/coreutils'; import { OverridePreferenceName, PreferenceLanguageOverrideService } from './preference-language-override-service'; export { PreferenceScope }; diff --git a/packages/core/src/browser/preferences/preference-validation-service.spec.ts b/packages/core/src/browser/preferences/preference-validation-service.spec.ts index e064e6ed8127f..13946a41ae9f9 100644 --- a/packages/core/src/browser/preferences/preference-validation-service.spec.ts +++ b/packages/core/src/browser/preferences/preference-validation-service.spec.ts @@ -19,7 +19,7 @@ import { PreferenceValidationService } from './preference-validation-service'; import { PreferenceItem, PreferenceSchemaProvider } from './preference-contribution'; import { PreferenceLanguageOverrideService } from './preference-language-override-service'; import * as assert from 'assert'; -import { JSONValue } from '@phosphor/coreutils'; +import { JSONValue } from '@lumino/coreutils'; import { IJSONSchema, JsonType } from '../../common/json-schema'; /* eslint-disable no-null/no-null */ diff --git a/packages/core/src/browser/preferences/preference-validation-service.ts b/packages/core/src/browser/preferences/preference-validation-service.ts index 4726e53e60a86..e696350fe9f9e 100644 --- a/packages/core/src/browser/preferences/preference-validation-service.ts +++ b/packages/core/src/browser/preferences/preference-validation-service.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { PreferenceItem } from '../../common/preferences/preference-schema'; -import { JSONObject, JSONValue } from '../../../shared/@phosphor/coreutils'; +import { JSONObject, JSONValue } from '../../../shared/@lumino/coreutils'; import { PreferenceSchemaProvider } from './preference-contribution'; import { PreferenceLanguageOverrideService } from './preference-language-override-service'; import { inject, injectable } from '../../../shared/inversify'; diff --git a/packages/core/src/browser/saveable.ts b/packages/core/src/browser/saveable.ts index fff0ae99a6297..4d59e7c6825e2 100644 --- a/packages/core/src/browser/saveable.ts +++ b/packages/core/src/browser/saveable.ts @@ -14,8 +14,8 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { Widget } from '@phosphor/widgets'; -import { Message } from '@phosphor/messaging'; +import { Widget } from '@lumino/widgets'; +import { Message } from '@lumino/messaging'; import { Emitter, Event } from '../common/event'; import { MaybePromise } from '../common/types'; import { Key } from './keyboard/keys'; diff --git a/packages/core/src/browser/shell/application-shell-mouse-tracker.ts b/packages/core/src/browser/shell/application-shell-mouse-tracker.ts index 0dfd317cdf4d6..89a703b25a1c3 100644 --- a/packages/core/src/browser/shell/application-shell-mouse-tracker.ts +++ b/packages/core/src/browser/shell/application-shell-mouse-tracker.ts @@ -19,7 +19,7 @@ import { ApplicationShell } from './application-shell'; import { injectable, inject } from 'inversify'; import { DisposableCollection, Disposable } from '../../common/disposable'; import { Emitter, Event } from '../../common/event'; -import { FocusTracker, PanelLayout, SplitPanel } from '@phosphor/widgets'; +import { FocusTracker, PanelLayout, SplitPanel } from '@lumino/widgets'; import { addEventListener, Widget } from '../widgets'; /** * Contribution that tracks `mouseup` and `mousedown` events. @@ -44,7 +44,7 @@ export class ApplicationShellMouseTracker implements FrontendApplicationContribu protected readonly mousedownListener: (e: MouseEvent) => void = e => this.mousedownEmitter.fire(e); onStart(): void { - // Here we need to attach a `mousedown` listener to the `TabBar`s, `DockPanel`s and the `SidePanel`s. Otherwise, Phosphor handles the event and stops the propagation. + // Here we need to attach a `mousedown` listener to the `TabBar`s, `DockPanel`s and the `SidePanel`s. Otherwise, Lumino handles the event and stops the propagation. // Track the `mousedown` on the `TabBar` for the currently active widget. this.applicationShell.onDidChangeActiveWidget((args: FocusTracker.IChangedArgs) => { this.toDisposeOnActiveChange.dispose(); @@ -68,7 +68,7 @@ export class ApplicationShellMouseTracker implements FrontendApplicationContribu this.toDispose.pushAll([mainPanel, bottomPanel, leftPanelHandler.dockPanel, rightPanelHandler.dockPanel] .map(panel => addEventListener(panel.node, 'mousedown', this.mousedownListener, true))); - // The `mouseup` event has to be tracked on the `document`. Phosphor attaches to there. + // The `mouseup` event has to be tracked on the `document`. Lumino attaches to there. document.addEventListener('mouseup', this.mouseupListener, true); // Make sure it is disposed in the end. diff --git a/packages/core/src/browser/shell/application-shell.ts b/packages/core/src/browser/shell/application-shell.ts index b13081abadb88..dfb548ac18aff 100644 --- a/packages/core/src/browser/shell/application-shell.ts +++ b/packages/core/src/browser/shell/application-shell.ts @@ -15,13 +15,13 @@ // ***************************************************************************** import { injectable, inject, optional, postConstruct } from 'inversify'; -import { ArrayExt, find, toArray, each } from '@phosphor/algorithm'; +import { ArrayExt, find, toArray, each } from '@lumino/algorithm'; import { BoxLayout, BoxPanel, DockLayout, DockPanel, FocusTracker, Layout, Panel, SplitLayout, SplitPanel, TabBar, Widget, Title -} from '@phosphor/widgets'; -import { Message } from '@phosphor/messaging'; -import { IDragEvent } from '@phosphor/dragdrop'; +} from '@lumino/widgets'; +import { Message } from '@lumino/messaging'; +import { Drag } from '@lumino/dragdrop'; import { RecursivePartial, Event as CommonEvent, DisposableCollection, Disposable, environment, isObject } from '../../common'; import { animationFrame } from '../browser'; import { Saveable, SaveableWidget, SaveOptions } from '../saveable'; @@ -169,7 +169,7 @@ interface WidgetDragState { leftExpanded: boolean; rightExpanded: boolean; bottomExpanded: boolean; - lastDragOver?: IDragEvent; + lastDragOver?: Drag.Event; leaveTimeout?: number; } @@ -261,6 +261,9 @@ export class ApplicationShell extends Widget { return this._mainPanelRenderer; } + private setInitialized: () => void; + initialized: Promise = new Promise(resolve => { this.setInitialized = resolve; }); + /** * Construct a new application shell. */ @@ -319,6 +322,7 @@ export class ApplicationShell extends Widget { }); } }); + this.setInitialized(); } protected initializeShell(): void { @@ -382,39 +386,39 @@ export class ApplicationShell extends Widget { } protected override onBeforeAttach(msg: Message): void { - document.addEventListener('p-dragenter', this, true); - document.addEventListener('p-dragover', this, true); - document.addEventListener('p-dragleave', this, true); - document.addEventListener('p-drop', this, true); + document.addEventListener('lm-dragenter', this, true); + document.addEventListener('lm-dragover', this, true); + document.addEventListener('lm-dragleave', this, true); + document.addEventListener('lm-drop', this, true); } protected override onAfterDetach(msg: Message): void { - document.removeEventListener('p-dragenter', this, true); - document.removeEventListener('p-dragover', this, true); - document.removeEventListener('p-dragleave', this, true); - document.removeEventListener('p-drop', this, true); + document.removeEventListener('lm-dragenter', this, true); + document.removeEventListener('lm-dragover', this, true); + document.removeEventListener('lm-dragleave', this, true); + document.removeEventListener('lm-drop', this, true); } handleEvent(event: Event): void { switch (event.type) { - case 'p-dragenter': - this.onDragEnter(event as IDragEvent); + case 'lm-dragenter': + this.onDragEnter(event as Drag.Event); break; - case 'p-dragover': - this.onDragOver(event as IDragEvent); + case 'lm-dragover': + this.onDragOver(event as Drag.Event); break; - case 'p-drop': - this.onDrop(event as IDragEvent); + case 'lm-drop': + this.onDrop(event as Drag.Event); break; - case 'p-dragleave': - this.onDragLeave(event as IDragEvent); + case 'lm-dragleave': + this.onDragLeave(event as Drag.Event); break; } } - protected onDragEnter({ mimeData }: IDragEvent): void { + protected onDragEnter({ mimeData }: Drag.Event): void { if (!this.dragState) { - if (mimeData && mimeData.hasData('application/vnd.phosphor.widget-factory')) { + if (mimeData && mimeData.hasData('application/vnd.lumino.widget-factory')) { // The drag contains a widget, so we'll track it and expand side panels as needed this.dragState = { startTime: performance.now(), @@ -426,7 +430,7 @@ export class ApplicationShell extends Widget { } } - protected onDragOver(event: IDragEvent): void { + protected onDragOver(event: Drag.Event): void { const state = this.dragState; if (state) { state.lastDragOver = event; @@ -495,7 +499,7 @@ export class ApplicationShell extends Widget { } } - protected onDrop(event: IDragEvent): void { + protected onDrop(event: Drag.Event): void { const state = this.dragState; if (state) { if (state.leaveTimeout) { @@ -517,7 +521,7 @@ export class ApplicationShell extends Widget { } } - protected onDragLeave(event: IDragEvent): void { + protected onDragLeave(event: Drag.Event): void { const state = this.dragState; if (state) { state.lastDragOver = undefined; @@ -590,7 +594,7 @@ export class ApplicationShell extends Widget { dockPanel.node.addEventListener('dblclick', event => { const el = event.target as Element; - if (el.id === MAIN_AREA_ID || el.classList.contains('p-TabBar-content')) { + if (el.id === MAIN_AREA_ID || el.classList.contains('lm-TabBar-content')) { this.onDidDoubleClickMainAreaEmitter.fire(); } }); @@ -647,7 +651,7 @@ export class ApplicationShell extends Widget { } this.refreshBottomPanelToggleButton(); }, this); - dockPanel.node.addEventListener('p-dragenter', event => { + dockPanel.node.addEventListener('lm-dragenter', event => { // Make sure that the main panel hides its overlay when the bottom panel is expanded this.mainPanel.overlay.hide(0); }); @@ -780,7 +784,7 @@ export class ApplicationShell extends Widget { const index = parent.widgets.indexOf(this.bottomPanel) - 1; if (index >= 0) { const handle = parent.handles[index]; - if (!handle.classList.contains('p-mod-hidden')) { + if (!handle.classList.contains('lm-mod-hidden')) { const parentHeight = parent.node.clientHeight; return parentHeight - handle.offsetTop; } @@ -1021,7 +1025,7 @@ export class ApplicationShell extends Widget { */ findWidgetForElement(element: HTMLElement): Widget | undefined { let widgetNode: HTMLElement | null = element; - while (widgetNode && !widgetNode.classList.contains('p-Widget')) { + while (widgetNode && !widgetNode.classList.contains('lm-Widget')) { widgetNode = widgetNode.parentElement; } if (widgetNode) { @@ -1051,7 +1055,7 @@ export class ApplicationShell extends Widget { if (event?.target instanceof HTMLElement) { const tabNode = event.target; - const titleIndex = Array.from(tabBar.contentNode.getElementsByClassName('p-TabBar-tab')) + const titleIndex = Array.from(tabBar.contentNode.getElementsByClassName('lm-TabBar-tab')) .findIndex(node => node.contains(tabNode)); if (titleIndex !== -1) { @@ -1182,7 +1186,7 @@ export class ApplicationShell extends Widget { panel.markAsCurrent(widget!.title); } // Add checks to ensure that the 'sash' for left panel is displayed correctly - if (newValue.node.className === 'p-Widget theia-view-container p-DockPanel-widget') { + if (newValue.node.className === 'lm-Widget theia-view-container lm-DockPanel-widget') { // Set the z-index so elements with `position: fixed` contained in the active widget are displayed correctly this.setZIndex(newValue.node, '1'); } diff --git a/packages/core/src/browser/shell/shell-layout-restorer.ts b/packages/core/src/browser/shell/shell-layout-restorer.ts index 3cefbb35c74f7..c2bdb22024659 100644 --- a/packages/core/src/browser/shell/shell-layout-restorer.ts +++ b/packages/core/src/browser/shell/shell-layout-restorer.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { injectable, inject, named } from 'inversify'; -import { Widget } from '@phosphor/widgets'; +import { Widget } from '@lumino/widgets'; import { FrontendApplication } from '../frontend-application'; import { WidgetManager, WidgetConstructionOptions } from '../widget-manager'; import { StorageService } from '../storage-service'; diff --git a/packages/core/src/browser/shell/side-panel-handler.ts b/packages/core/src/browser/shell/side-panel-handler.ts index ec38f8f2201ff..9b1875d5cf7d1 100644 --- a/packages/core/src/browser/shell/side-panel-handler.ts +++ b/packages/core/src/browser/shell/side-panel-handler.ts @@ -15,11 +15,11 @@ // ***************************************************************************** import { injectable, inject } from 'inversify'; -import { find, map, toArray, some } from '@phosphor/algorithm'; -import { TabBar, Widget, DockPanel, Title, Panel, BoxPanel, BoxLayout, SplitPanel, PanelLayout } from '@phosphor/widgets'; -import { MimeData } from '@phosphor/coreutils'; -import { Drag } from '@phosphor/dragdrop'; -import { AttachedProperty } from '@phosphor/properties'; +import { find, map, toArray, some } from '@lumino/algorithm'; +import { TabBar, Widget, DockPanel, Title, Panel, BoxPanel, BoxLayout, SplitPanel, PanelLayout } from '@lumino/widgets'; +import { MimeData } from '@lumino/coreutils'; +import { Drag } from '@lumino/dragdrop'; +import { AttachedProperty } from '@lumino/properties'; import { TabBarRendererFactory, TabBarRenderer, SHELL_TABBAR_CONTEXT_MENU, SideTabBar } from './tab-bars'; import { SidebarMenuWidget, SidebarMenu, SidebarBottomMenuWidgetFactory, SidebarTopMenuWidgetFactory } from './sidebar-menu-widget'; import { SplitPositionHandler, SplitPositionOptions } from './split-panels'; @@ -556,12 +556,12 @@ export class SidePanelHandler { const index = parent.widgets.indexOf(this.container); if (this.side === 'left') { const handle = parent.handles[index]; - if (!handle.classList.contains('p-mod-hidden')) { + if (!handle.classList.contains('lm-mod-hidden')) { return handle.offsetLeft; } } else if (this.side === 'right') { const handle = parent.handles[index - 1]; - if (!handle.classList.contains('p-mod-hidden')) { + if (!handle.classList.contains('lm-mod-hidden')) { const parentWidth = parent.node.clientWidth; return parentWidth - handle.offsetLeft; } @@ -632,13 +632,13 @@ export class SidePanelHandler { const clonedTab = tab.cloneNode(true) as HTMLElement; clonedTab.style.width = ''; clonedTab.style.height = ''; - const label = clonedTab.getElementsByClassName('p-TabBar-tabLabel')[0] as HTMLElement; + const label = clonedTab.getElementsByClassName('lm-TabBar-tabLabel')[0] as HTMLElement; label.style.width = ''; label.style.height = ''; // Create and start a drag to move the selected tab to another panel const mimeData = new MimeData(); - mimeData.setData('application/vnd.phosphor.widget-factory', () => title.owner); + mimeData.setData('application/vnd.lumino.widget-factory', () => title.owner); const drag = new Drag({ mimeData, dragImage: clonedTab, @@ -646,10 +646,10 @@ export class SidePanelHandler { supportedActions: 'move', }); - tab.classList.add('p-mod-hidden'); + tab.classList.add('lm-mod-hidden'); drag.start(clientX, clientY).then(() => { // The promise is resolved when the drag has ended - tab.classList.remove('p-mod-hidden'); + tab.classList.remove('lm-mod-hidden'); }); } diff --git a/packages/core/src/browser/shell/side-panel-toolbar.ts b/packages/core/src/browser/shell/side-panel-toolbar.ts index 089f3ca693dee..6186288be48f3 100644 --- a/packages/core/src/browser/shell/side-panel-toolbar.ts +++ b/packages/core/src/browser/shell/side-panel-toolbar.ts @@ -14,9 +14,9 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { Widget, Title } from '@phosphor/widgets'; +import { Widget, Title } from '@lumino/widgets'; import { TabBarToolbar, TabBarToolbarRegistry, TabBarToolbarFactory } from './tab-bar-toolbar'; -import { Message } from '@phosphor/messaging'; +import { Message } from '@lumino/messaging'; import { BaseWidget } from '../widgets'; import { Emitter } from '../../common/event'; import { ContextMenuAccess, Anchor } from '../context-menu-renderer'; diff --git a/packages/core/src/browser/shell/split-panels.ts b/packages/core/src/browser/shell/split-panels.ts index d9f59bdf4a97a..6b71aa1f5a4f7 100644 --- a/packages/core/src/browser/shell/split-panels.ts +++ b/packages/core/src/browser/shell/split-panels.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { injectable } from 'inversify'; -import { SplitPanel, SplitLayout, Widget } from '@phosphor/widgets'; +import { SplitPanel, SplitLayout, Widget } from '@lumino/widgets'; export interface SplitPositionOptions { /** The side of the side panel that shall be resized. */ diff --git a/packages/core/src/browser/shell/tab-bar-decorator.ts b/packages/core/src/browser/shell/tab-bar-decorator.ts index 7b9d6a9756e9a..bf2a149222bf2 100644 --- a/packages/core/src/browser/shell/tab-bar-decorator.ts +++ b/packages/core/src/browser/shell/tab-bar-decorator.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import debounce = require('lodash.debounce'); -import { Title, Widget } from '@phosphor/widgets'; +import { Title, Widget } from '@lumino/widgets'; import { inject, injectable, named } from 'inversify'; import { ContributionProvider, Emitter, Event } from '../../common'; import { ColorRegistry } from '../color-registry'; diff --git a/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.tsx b/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.tsx index e5c65095477b0..cecde8308b063 100644 --- a/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.tsx +++ b/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.tsx @@ -436,7 +436,7 @@ export namespace TabBarToolbar { export namespace Styles { - export const TAB_BAR_TOOLBAR = 'p-TabBar-toolbar'; + export const TAB_BAR_TOOLBAR = 'lm-TabBar-toolbar'; export const TAB_BAR_TOOLBAR_ITEM = 'item'; } diff --git a/packages/core/src/browser/shell/tab-bars.spec.ts b/packages/core/src/browser/shell/tab-bars.spec.ts index 91e5de7eca81f..c9f6247bae7a9 100644 --- a/packages/core/src/browser/shell/tab-bars.spec.ts +++ b/packages/core/src/browser/shell/tab-bars.spec.ts @@ -18,7 +18,7 @@ import { enableJSDOM } from '../test/jsdom'; let disableJSDOM = enableJSDOM(); import { expect } from 'chai'; -import { Title, Widget } from '@phosphor/widgets'; +import { Title, Widget } from '@lumino/widgets'; import { TabBarRenderer } from './tab-bars'; disableJSDOM(); diff --git a/packages/core/src/browser/shell/tab-bars.ts b/packages/core/src/browser/shell/tab-bars.ts index 13980be53718f..25fde46fb641d 100644 --- a/packages/core/src/browser/shell/tab-bars.ts +++ b/packages/core/src/browser/shell/tab-bars.ts @@ -15,14 +15,14 @@ // ***************************************************************************** import PerfectScrollbar from 'perfect-scrollbar'; -import { TabBar, Title, Widget } from '@phosphor/widgets'; -import { VirtualElement, h, VirtualDOM, ElementInlineStyle } from '@phosphor/virtualdom'; +import { TabBar, Title, Widget } from '@lumino/widgets'; +import { VirtualElement, h, VirtualDOM, ElementInlineStyle } from '@lumino/virtualdom'; import { Disposable, DisposableCollection, MenuPath, notEmpty, SelectionService, CommandService, nls, ArrayUtils } from '../../common'; import { ContextMenuRenderer } from '../context-menu-renderer'; -import { Signal, Slot } from '@phosphor/signaling'; -import { Message, MessageLoop } from '@phosphor/messaging'; -import { ArrayExt } from '@phosphor/algorithm'; -import { ElementExt } from '@phosphor/domutils'; +import { Signal, Slot } from '@lumino/signaling'; +import { Message, MessageLoop } from '@lumino/messaging'; +import { ArrayExt } from '@lumino/algorithm'; +import { ElementExt } from '@lumino/domutils'; import { TabBarToolbarRegistry, TabBarToolbar } from './tab-bar-toolbar'; import { TheiaDockPanel, MAIN_AREA_ID, BOTTOM_AREA_ID } from './theia-dock-panel'; import { WidgetDecoration } from '../widget-decoration'; @@ -30,7 +30,7 @@ import { TabBarDecoratorService } from './tab-bar-decorator'; import { IconThemeService } from '../icon-theme-service'; import { BreadcrumbsRenderer, BreadcrumbsRendererFactory } from '../breadcrumbs/breadcrumbs-renderer'; import { NavigatableWidget } from '../navigatable-types'; -import { IDragEvent } from '@phosphor/dragdrop'; +import { Drag } from '@lumino/dragdrop'; import { LOCKED_CLASS, PINNED_CLASS } from '../widgets/widget'; import { CorePreferences } from '../core-preferences'; import { HoverService } from '../hover-service'; @@ -195,7 +195,7 @@ export class TabBarRenderer extends TabBar.Renderer { this.renderLock(data, isInSidePanel) ), h.div({ - className: 'p-TabBar-tabCloseIcon action-label', + className: 'lm-TabBar-tabCloseIcon action-label', title: closeIconTitle, onclick: this.handleCloseClickEvent }) @@ -205,7 +205,7 @@ export class TabBarRenderer extends TabBar.Renderer { override createTabClass(data: SideBarRenderData): string { let tabClass = super.createTabClass(data); if (!(data.visible ?? true)) { - tabClass += ' p-mod-invisible'; + tabClass += ' lm-mod-invisible'; } return tabClass; } @@ -280,16 +280,16 @@ export class TabBarRenderer extends TabBar.Renderer { // No need to check for duplicate labels if the tab is rendered in the side panel (title is not displayed), // or if there are less than two files in the tab bar. if (isInSidePanel || (this.tabBar && this.tabBar.titles.length < 2)) { - return h.div({ className: 'p-TabBar-tabLabel', style }, data.title.label); + return h.div({ className: 'lm-TabBar-tabLabel', style }, data.title.label); } const originalToDisplayedMap = this.findDuplicateLabels([...this.tabBar!.titles]); const labelDetails: string | undefined = originalToDisplayedMap.get(data.title.caption); if (labelDetails) { - return h.div({ className: 'p-TabBar-tabLabelWrapper' }, - h.div({ className: 'p-TabBar-tabLabel', style }, data.title.label), - h.div({ className: 'p-TabBar-tabLabelDetails', style }, labelDetails)); + return h.div({ className: 'lm-TabBar-tabLabelWrapper' }, + h.div({ className: 'lm-TabBar-tabLabel', style }, data.title.label), + h.div({ className: 'lm-TabBar-tabLabelDetails', style }, labelDetails)); } - return h.div({ className: 'p-TabBar-tabLabel', style }, data.title.label); + return h.div({ className: 'lm-TabBar-tabLabel', style }, data.title.label); } protected renderTailDecorations(renderData: SideBarRenderData, isInSidePanel?: boolean): VirtualElement[] { @@ -314,7 +314,7 @@ export class TabBarRenderer extends TabBar.Renderer { return decorationsToRender.map((decoration, index) => { const { tooltip, data, fontData, color, icon, iconClass } = decoration; const iconToRender = icon ?? iconClass; - const className = ['p-TabBar-tail', 'flex'].join(' '); + const className = ['lm-TabBar-tail', 'flex'].join(' '); const style = fontData ? fontData : color ? { color } : undefined; const content = (data ? data : iconToRender ? h.span({ className: this.getIconClass(iconToRender, iconToRender === 'circle' ? [WidgetDecoration.Styles.DECORATOR_SIZE_CLASS] : []) }) @@ -336,7 +336,7 @@ export class TabBarRenderer extends TabBar.Renderer { renderLock(data: SideBarRenderData, isInSidePanel?: boolean): VirtualElement { return !isInSidePanel && data.title.className.includes(LOCKED_CLASS) - ? h.div({ className: 'p-TabBar-tabLock' }) + ? h.div({ className: 'lm-TabBar-tabLock' }) : h.div({}); } @@ -569,7 +569,7 @@ export class TabBarRenderer extends TabBar.Renderer { visualPreviewDiv.append(clonedNode); const visualPreview = visualPreviewDiv.children.item(visualPreviewDiv.children.length - 1); if (visualPreview instanceof HTMLElement) { - visualPreview.classList.remove('p-mod-hidden'); + visualPreview.classList.remove('lm-mod-hidden'); visualPreview.classList.add('enhanced-preview'); visualPreview.id = `preview:${widget.id}`; @@ -636,7 +636,7 @@ export class TabBarRenderer extends TabBar.Renderer { event.preventDefault(); let widget: Widget | undefined = undefined; if (this.tabBar) { - const titleIndex = Array.from(this.tabBar.contentNode.getElementsByClassName('p-TabBar-tab')) + const titleIndex = Array.from(this.tabBar.contentNode.getElementsByClassName('lm-TabBar-tab')) .findIndex(node => node.contains(event.currentTarget as HTMLElement)); if (titleIndex !== -1) { widget = this.tabBar.titles[titleIndex].owner; @@ -686,6 +686,10 @@ export class TabBarRenderer extends TabBar.Renderer { } +export interface TabBarPrivateMethods { + _releaseMouse(): void; +} + /** * A specialized tab bar for the main and bottom areas. */ @@ -730,8 +734,25 @@ export class ScrollableTabBar extends TabBar { this.toDispose.dispose(); } + protected override onBeforeAttach(msg: Message): void { + this.contentNode.addEventListener('pointerdown', this); + this.contentNode.addEventListener('dblclick', this); + this.contentNode.addEventListener('keydown', this); + } + + protected override onAfterDetach(msg: Message): void { + this.contentNode.removeEventListener('pointerdown', this); + this.contentNode.removeEventListener('dblclick', this); + this.contentNode.removeEventListener('keydown', this); + this.doReleaseMouse(); + } + + protected doReleaseMouse(): void { + (this as unknown as TabBarPrivateMethods)._releaseMouse(); + } + /** - * Restructures the DOM defined in PhosphorJS. + * Restructures the DOM defined in Lumino. * * By default the tabs (`li`) are contained in the `this.contentNode` (`ul`) which is wrapped in a `div` (`this.node`). * Instead of this structure, we add a container for the `this.contentNode` and for the toolbar. @@ -740,7 +761,7 @@ export class ScrollableTabBar extends TabBar { protected rewireDOM(): void { const contentNode = this.node.getElementsByClassName(ScrollableTabBar.Styles.TAB_BAR_CONTENT)[0]; if (!contentNode) { - throw new Error("'this.node' does not have the content as a direct child with class name 'p-TabBar-content'."); + throw new Error(`'this.node' does not have the content as a direct child with class name '${ScrollableTabBar.Styles.TAB_BAR_CONTENT}'.`); } this.node.removeChild(contentNode); this.contentContainer = document.createElement('div'); @@ -805,14 +826,14 @@ export class ScrollableTabBar extends TabBar { if (this.orientation === 'horizontal') { let availableWidth = this.scrollbarHost.clientWidth; let effectiveWidth = availableWidth; - if (!this.openTabsContainer.classList.contains('p-mod-hidden')) { + if (!this.openTabsContainer.classList.contains('lm-mod-hidden')) { availableWidth += this.openTabsContainer.getBoundingClientRect().width; } if (this.dynamicTabOptions.minimumTabSize * this.titles.length <= availableWidth) { effectiveWidth += this.openTabsContainer.getBoundingClientRect().width; - this.openTabsContainer.classList.add('p-mod-hidden'); + this.openTabsContainer.classList.add('lm-mod-hidden'); } else { - this.openTabsContainer.classList.remove('p-mod-hidden'); + this.openTabsContainer.classList.remove('lm-mod-hidden'); } this.tabSize = Math.max(Math.min(effectiveWidth / this.titles.length, this.dynamicTabOptions.defaultTabSize), this.dynamicTabOptions.minimumTabSize); @@ -820,7 +841,7 @@ export class ScrollableTabBar extends TabBar { } this.node.classList.add('dynamic-tabs'); } else { - this.openTabsContainer.classList.add('p-mod-hidden'); + this.openTabsContainer.classList.add('lm-mod-hidden'); this.node.classList.remove('dynamic-tabs'); } for (let i = 0, n = this.titles.length; i < n; ++i) { @@ -907,7 +928,7 @@ export class ScrollableTabBar extends TabBar { */ // @ts-expect-error TS2611 `TabBar.contentNode` is declared as `readonly contentNode` but is implemented as a getter. get contentNode(): HTMLUListElement { - return this.tabBarContainer.getElementsByClassName(ToolbarAwareTabBar.Styles.TAB_BAR_CONTENT)[0] as HTMLUListElement; + return this.node.getElementsByClassName(ToolbarAwareTabBar.Styles.TAB_BAR_CONTENT)[0] as HTMLUListElement; } /** @@ -930,8 +951,8 @@ export namespace ScrollableTabBar { } export namespace Styles { - export const TAB_BAR_CONTENT = 'p-TabBar-content'; - export const TAB_BAR_CONTENT_CONTAINER = 'p-TabBar-content-container'; + export const TAB_BAR_CONTENT = 'lm-TabBar-content'; + export const TAB_BAR_CONTENT_CONTAINER = 'lm-TabBar-content-container'; } } @@ -1037,7 +1058,7 @@ export class ToolbarAwareTabBar extends ScrollableTabBar { } /** - * Restructures the DOM defined in PhosphorJS. + * Restructures the DOM defined in Lumino. * * By default the tabs (`li`) are contained in the `this.contentNode` (`ul`) which is wrapped in a `div` (`this.node`). * Instead of this structure, we add a container for the `this.contentNode` and for the toolbar. @@ -1115,18 +1136,18 @@ export class SideTabBar extends ScrollableTabBar { protected override onAfterAttach(msg: Message): void { this.updateTabs(); - this.node.addEventListener('p-dragenter', this); - this.node.addEventListener('p-dragover', this); - this.node.addEventListener('p-dragleave', this); - document.addEventListener('p-drop', this); + this.node.addEventListener('lm-dragenter', this); + this.node.addEventListener('lm-dragover', this); + this.node.addEventListener('lm-dragleave', this); + document.addEventListener('lm-drop', this); } protected override onAfterDetach(msg: Message): void { super.onAfterDetach(msg); - this.node.removeEventListener('p-dragenter', this); - this.node.removeEventListener('p-dragover', this); - this.node.removeEventListener('p-dragleave', this); - document.removeEventListener('p-drop', this); + this.node.removeEventListener('lm-dragenter', this); + this.node.removeEventListener('lm-dragover', this); + this.node.removeEventListener('lm-dragleave', this); + document.removeEventListener('lm-drop', this); } protected override onUpdateRequest(msg: Message): void { @@ -1189,13 +1210,13 @@ export class SideTabBar extends ScrollableTabBar { paddingBottom: parseFloat(tabStyle.paddingBottom!) }; // Extract label size from the DOM - const labelElements = hiddenTab.getElementsByClassName('p-TabBar-tabLabel'); + const labelElements = hiddenTab.getElementsByClassName('lm-TabBar-tabLabel'); if (labelElements.length === 1) { const label = labelElements[0]; rd.labelSize = { width: label.clientWidth, height: label.clientHeight }; } // Extract icon size from the DOM - const iconElements = hiddenTab.getElementsByClassName('p-TabBar-tabIcon'); + const iconElements = hiddenTab.getElementsByClassName('lm-TabBar-tabIcon'); if (iconElements.length === 1) { const icon = iconElements[0]; rd.iconSize = { width: icon.clientWidth, height: icon.clientHeight }; @@ -1242,7 +1263,7 @@ export class SideTabBar extends ScrollableTabBar { */ protected hideOverflowingTabs(): number { const availableHeight = this.node.clientHeight; - const invisibleClass = 'p-mod-invisible'; + const invisibleClass = 'lm-mod-invisible'; let startIndex = -1; const n = this.contentNode.children.length; for (let i = 0; i < n; i++) { @@ -1305,25 +1326,25 @@ export class SideTabBar extends ScrollableTabBar { */ override handleEvent(event: Event): void { switch (event.type) { - case 'mousedown': - this.onMouseDown(event as MouseEvent); + case 'pointerdown': + this.onMouseDown(event as PointerEvent); super.handleEvent(event); break; - case 'mouseup': + case 'pointerup': super.handleEvent(event); - this.onMouseUp(event as MouseEvent); + this.onMouseUp(event as PointerEvent); break; case 'mousemove': - this.onMouseMove(event as MouseEvent); + this.onMouseMove(event as PointerEvent); super.handleEvent(event); break; - case 'p-dragenter': - this.onDragEnter(event as IDragEvent); + case 'lm-dragenter': + this.onDragEnter(event as Drag.Event); break; - case 'p-dragover': - this.onDragOver(event as IDragEvent); + case 'lm-dragover': + this.onDragOver(event as Drag.Event); break; - case 'p-dragleave': case 'p-drop': + case 'lm-dragleave': case 'lm-drop': this.cancelViewContainerDND(); break; default: @@ -1399,9 +1420,9 @@ export class SideTabBar extends ScrollableTabBar { /** * Handles `viewContainerPart` drag enter. */ - protected onDragEnter = (event: IDragEvent) => { + protected onDragEnter = (event: Drag.Event) => { this.cancelViewContainerDND(); - if (event.mimeData.getData('application/vnd.phosphor.view-container-factory')) { + if (event.mimeData.getData('application/vnd.lumino.view-container-factory')) { event.preventDefault(); event.stopPropagation(); } @@ -1411,8 +1432,8 @@ export class SideTabBar extends ScrollableTabBar { * Handle `viewContainerPart` drag over, * Defines the appropriate `dropAction` and opens the tab on which the mouse stands on for more than 800 ms. */ - protected onDragOver = (event: IDragEvent) => { - const factory = event.mimeData.getData('application/vnd.phosphor.view-container-factory'); + protected onDragOver = (event: Drag.Event) => { + const factory = event.mimeData.getData('application/vnd.lumino.view-container-factory'); const widget = factory && factory(); if (!widget) { event.dropAction = 'none'; diff --git a/packages/core/src/browser/shell/theia-dock-panel.ts b/packages/core/src/browser/shell/theia-dock-panel.ts index 13bc989e6ce91..4a6b345dd070d 100644 --- a/packages/core/src/browser/shell/theia-dock-panel.ts +++ b/packages/core/src/browser/shell/theia-dock-panel.ts @@ -14,9 +14,9 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { find, toArray } from '@phosphor/algorithm'; -import { TabBar, Widget, DockPanel, Title, DockLayout } from '@phosphor/widgets'; -import { Signal } from '@phosphor/signaling'; +import { find, toArray } from '@lumino/algorithm'; +import { TabBar, Widget, DockPanel, Title, DockLayout } from '@lumino/widgets'; +import { Signal } from '@lumino/signaling'; import { Disposable, DisposableCollection } from '../../common/disposable'; import { UnsafeWidgetUtilities } from '../widgets'; import { CorePreferences } from '../core-preferences'; diff --git a/packages/core/src/browser/shell/view-column-service.ts b/packages/core/src/browser/shell/view-column-service.ts index 16db95bc190d8..2d0dbb52f0b9a 100644 --- a/packages/core/src/browser/shell/view-column-service.ts +++ b/packages/core/src/browser/shell/view-column-service.ts @@ -17,8 +17,8 @@ import { injectable, inject } from 'inversify'; import { Emitter, Event } from '../../common/event'; import { ApplicationShell } from './application-shell'; -import { toArray } from '@phosphor/algorithm'; -import { TabBar, Widget } from '@phosphor/widgets'; +import { toArray } from '@lumino/algorithm'; +import { TabBar, Widget } from '@lumino/widgets'; @injectable() export class ViewColumnService { diff --git a/packages/core/src/browser/shell/view-contribution.ts b/packages/core/src/browser/shell/view-contribution.ts index e2bcb17a41a2b..9ee3539d7a69d 100644 --- a/packages/core/src/browser/shell/view-contribution.ts +++ b/packages/core/src/browser/shell/view-contribution.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { injectable, inject, interfaces, optional, unmanaged } from 'inversify'; -import { Widget } from '@phosphor/widgets'; +import { Widget } from '@lumino/widgets'; import { MenuModelRegistry, Command, CommandContribution, MenuContribution, CommandRegistry, nls diff --git a/packages/core/src/browser/style/dialog.css b/packages/core/src/browser/style/dialog.css index b8b99f0dda9fe..e7412638d528e 100644 --- a/packages/core/src/browser/style/dialog.css +++ b/packages/core/src/browser/style/dialog.css @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 ********************************************************************************/ -.p-Widget.dialogOverlay { +.lm-Widget.dialogOverlay { z-index: 5000; display: flex; flex-direction: column; @@ -29,7 +29,7 @@ font-size: var(--theia-ui-font-size1); padding: 2px; } -.p-Widget.dialogOverlay .dialogBlock { +.lm-Widget.dialogOverlay .dialogBlock { display: flex; flex-direction: column; min-width: 400px; @@ -40,7 +40,7 @@ overflow: hidden; box-shadow: 0 0px 8px var(--theia-widget-shadow); } -.p-Widget.dialogOverlay .dialogTitle { +.lm-Widget.dialogOverlay .dialogTitle { display: flex; flex-direction: row; flex-wrap: nowrap; @@ -54,11 +54,11 @@ min-height: 24px; } -.p-Widget.dialogOverlay .dialogTitle i.closeButton { +.lm-Widget.dialogOverlay .dialogTitle i.closeButton { cursor: pointer; } -.p-Widget.dialogOverlay .dialogContent { +.lm-Widget.dialogOverlay .dialogContent { display: flex; flex-direction: column; align-items: stretch; @@ -69,7 +69,7 @@ overflow-y: auto; } -.p-Widget.dialogOverlay .dialogControl { +.lm-Widget.dialogOverlay .dialogControl { padding: calc(var(--theia-ui-padding) * 2); display: flex; flex-direction: row; @@ -79,24 +79,24 @@ min-height: 21px; } -.p-Widget.dialogOverlay.hidden { +.lm-Widget.dialogOverlay.hidden { display: none; } -.p-Widget.dialogOverlay.dialogErrorMessage { +.lm-Widget.dialogOverlay.dialogErrorMessage { display: none; } -.p-Widget.dialogOverlay .error { +.lm-Widget.dialogOverlay .error { color: var(--theia-inputValidation-errorForeground); } -.p-Widget.dialogOverlay .error.main { +.lm-Widget.dialogOverlay .error.main { color: var(--theia-inputValidation-errorForeground); border-color: var(--theia-inputValidation-errorBorder); } -.p-Widget.dialogOverlay .error > .theia-button.main { +.lm-Widget.dialogOverlay .error > .theia-button.main { background-color: var(--theia-inputValidation-errorBackground); color: var(--theia-inputValidation-errorForeground); } -.p-Widget.dialogOverlay .error > .dialogErrorMessage { +.lm-Widget.dialogOverlay .error > .dialogErrorMessage { margin-top: calc(var(--theia-ui-padding) * 3); font-size: var(--theia-ui-font-size1); display: block; diff --git a/packages/core/src/browser/style/dockpanel.css b/packages/core/src/browser/style/dockpanel.css index 048d8bbc5c966..58eff88ed744a 100644 --- a/packages/core/src/browser/style/dockpanel.css +++ b/packages/core/src/browser/style/dockpanel.css @@ -14,48 +14,48 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 ********************************************************************************/ -.p-DockPanel.p-SplitPanel-child { +.lm-DockPanel.lm-SplitPanel-child { padding: 0px; } -.p-DockPanel-widget { +.lm-DockPanel-widget { min-width: 100px; min-height: 100px; } -.p-DockPanel-handle[data-orientation="vertical"] { +.lm-DockPanel-handle[data-orientation="vertical"] { min-height: var(--theia-border-width); z-index: 3; } -.p-DockPanel-handle[data-orientation="horizontal"] { +.lm-DockPanel-handle[data-orientation="horizontal"] { min-width: var(--theia-border-width); } -.p-DockPanel-handle[data-orientation="horizontal"]::after { +.lm-DockPanel-handle[data-orientation="horizontal"]::after { min-width: var(--theia-sash-width); transform: translateX(0%); left: calc(-1 * var(--theia-sash-width) / 2); } -.p-DockPanel-handle[data-orientation="vertical"]::after { +.lm-DockPanel-handle[data-orientation="vertical"]::after { min-height: var(--theia-sash-width); width: 100%; transform: translateY(0%); top: calc(-1 * var(--theia-sash-width) / 2); } -.p-DockPanel-handle:hover::after { +.lm-DockPanel-handle:hover::after { background-color: var(--theia-sash-hoverBorder); transition-delay: var(--theia-sash-hoverDelay); } -.p-DockPanel-handle:active::after { +.lm-DockPanel-handle:active::after { background-color: var(--theia-sash-activeBorder); transition-delay: 0s !important; } -.p-DockPanel-overlay { +.lm-DockPanel-overlay { background: var(--theia-editorGroup-dropBackground); border: var(--theia-border-width) dashed var(--theia-contrastActiveBorder); transition-property: top, left, right, bottom; @@ -63,14 +63,14 @@ transition-timing-function: ease; } -.p-DockPanel-overlay.p-mod-root-top, -.p-DockPanel-overlay.p-mod-root-left, -.p-DockPanel-overlay.p-mod-root-right, -.p-DockPanel-overlay.p-mod-root-bottom, -.p-DockPanel-overlay.p-mod-root-center { +.lm-DockPanel-overlay.lm-mod-root-top, +.lm-DockPanel-overlay.lm-mod-root-left, +.lm-DockPanel-overlay.lm-mod-root-right, +.lm-DockPanel-overlay.lm-mod-root-bottom, +.lm-DockPanel-overlay.lm-mod-root-center { border-width: 2px; } -.p-DockPanel-overlay.p-mod-root-bottom { +.lm-DockPanel-overlay.lm-mod-root-bottom { background: var(--theia-panel-dropBackground); } diff --git a/packages/core/src/browser/style/index.css b/packages/core/src/browser/style/index.css index 3a69dc7c2c1c6..63161f578a801 100644 --- a/packages/core/src/browser/style/index.css +++ b/packages/core/src/browser/style/index.css @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 ********************************************************************************/ -@import url("~@phosphor/widgets/style/index.css"); +@import url("~@lumino/widgets/style/index.css"); @import url("~font-awesome/css/font-awesome.min.css"); /*----------------------------------------------------------------------------- @@ -219,11 +219,11 @@ blockquote { font-weight: 700; } -.p-Widget { +.lm-Widget { font-size: var(--theia-ui-font-size1); } -.p-Widget.p-mod-hidden { +.lm-Widget.lm-mod-hidden { display: none !important; } diff --git a/packages/core/src/browser/style/menus.css b/packages/core/src/browser/style/menus.css index 4cb8eb2051651..d3ef7cdf58f05 100644 --- a/packages/core/src/browser/style/menus.css +++ b/packages/core/src/browser/style/menus.css @@ -28,39 +28,39 @@ | MenuBar |----------------------------------------------------------------------------*/ -.p-Widget.p-MenuBar { +.lm-Widget.lm-MenuBar { display: flex; align-items: center; padding-left: 5px; font-size: var(--theia-ui-font-size1); } -.p-MenuBar-menu { +.lm-MenuBar-menu { transform: translateY(calc(-2 * var(--theia-border-width))); } -.p-MenuBar-content { +.lm-MenuBar-content { display: flex; align-items: center; } -.p-MenuBar-item { +.lm-MenuBar-item { padding: 0px 8px; line-height: var(--theia-content-line-height); border-radius: 4px; } -.p-MenuBar-item .p-MenuBar-itemLabel { +.lm-MenuBar-item .lm-MenuBar-itemLabel { white-space: pre; } -.p-MenuBar-item.p-mod-active { +.lm-MenuBar-item.lm-mod-active { background: var(--theia-menubar-selectionBackground); color: var(--theia-menubar-selectionForeground); opacity: 1; } -.p-MenuBar.p-mod-active .p-MenuBar-item.p-mod-active { +.lm-MenuBar.lm-mod-active .lm-MenuBar-item.lm-mod-active { z-index: calc(var(--theia-menu-z-index) - 1); background: var(--theia-menubar-selectionBackground); border-left: var(--theia-border-width) solid @@ -69,11 +69,11 @@ var(--theia-menubar-selectionBorder); } -.p-MenuBar-item.p-mod-disabled { +.lm-MenuBar-item.lm-mod-disabled { opacity: var(--theia-mod-disabled-opacity); } -.p-MenuBar-item.p-type-separator { +.lm-MenuBar-item.lm-type-separator { margin: 2px; padding: 0; border: none; @@ -81,7 +81,7 @@ var(--theia-menu-separatorBackground); } -.p-MenuBar-itemMnemonic { +.lm-MenuBar-itemMnemonic { text-decoration: underline; } @@ -102,7 +102,7 @@ | Menu |----------------------------------------------------------------------------*/ -.p-Menu { +.lm-Menu { z-index: var(--theia-menu-z-index); padding: 4px; background: var(--theia-menu-background); @@ -113,11 +113,11 @@ border-radius: 5px; } -.p-Menu:focus { +.lm-Menu:focus { outline: none; } -.p-Menu-item { +.lm-Menu-item { min-height: var(--theia-private-menu-item-height); max-height: var(--theia-private-menu-item-height); padding: 0px; @@ -129,7 +129,7 @@ overflow: hidden; } -.p-Menu-item.p-mod-active { +.lm-Menu-item.lm-mod-active { color: var(--theia-menu-selectionForeground); border: thin solid var(--theia-menu-selectionBorder); opacity: 1; @@ -141,54 +141,54 @@ * So we apply it to its first and last child */ -.p-Menu-item.p-mod-active > div { +.lm-Menu-item.lm-mod-active > div { background: var(--theia-menu-selectionBackground); } -.p-Menu-item.p-mod-active > div:first-child { +.lm-Menu-item.lm-mod-active > div:first-child { border-top-left-radius: 4px; border-bottom-left-radius: 4px; } -.p-Menu-item.p-mod-active > div:last-child { +.lm-Menu-item.lm-mod-active > div:last-child { border-top-right-radius: 4px; border-bottom-right-radius: 4px; } -.p-Menu-item.p-mod-disabled { +.lm-Menu-item.lm-mod-disabled { opacity: var(--theia-mod-disabled-opacity); } -.p-Menu-itemIcon { +.lm-Menu-itemIcon { width: 21px; padding: 0px 2px 0px 4px; height: var(--theia-private-menu-item-height); } -.p-Menu-itemLabel { +.lm-Menu-itemLabel { padding: 0px 32px 0px 2px; } -.p-Menu-itemMnemonic { +.lm-Menu-itemMnemonic { text-decoration: underline; } -.p-Menu-itemShortcut { +.lm-Menu-itemShortcut { padding: 0px; } -.p-Menu-itemSubmenuIcon { +.lm-Menu-itemSubmenuIcon { width: var(--theia-icon-size); padding: 0px 10px 0px 0px; } -.p-Menu-item[data-type="separator"] > div { +.lm-Menu-item[data-type="separator"] > div { padding: 0; height: 9px; opacity: 0.36; } -.p-Menu-item[data-type="separator"] > div::after { +.lm-Menu-item[data-type="separator"] > div::after { content: ""; display: block; position: relative; @@ -197,16 +197,16 @@ var(--theia-menu-separatorBackground); } -.p-Menu-item[data-type="separator"] > div:first-child:after { +.lm-Menu-item[data-type="separator"] > div:first-child:after { margin-left: -4px; } -.p-Menu-item[data-type="separator"] > div:last-child::after { +.lm-Menu-item[data-type="separator"] > div:last-child::after { margin-right: -4px; } -.p-Menu-itemIcon::before, -.p-Menu-itemSubmenuIcon::before { +.lm-Menu-itemIcon::before, +.lm-Menu-itemSubmenuIcon::before { font: normal normal normal 16px/1 codicon; display: inline-block; text-decoration: none; @@ -220,11 +220,11 @@ transform: translateY(20%); } -.p-Menu-item.p-mod-toggled > .p-Menu-itemIcon::before { +.lm-Menu-item.lm-mod-toggled > .lm-Menu-itemIcon::before { content: "\eab2"; transform: scale(0.8) translateY(20%); } -.p-Menu-item[data-type="submenu"] > .p-Menu-itemSubmenuIcon::before { +.lm-Menu-item[data-type="submenu"] > .lm-Menu-itemSubmenuIcon::before { content: "\eab6"; } diff --git a/packages/core/src/browser/style/sidepanel.css b/packages/core/src/browser/style/sidepanel.css index 64d5a59532a3f..548d27b461e60 100644 --- a/packages/core/src/browser/style/sidepanel.css +++ b/packages/core/src/browser/style/sidepanel.css @@ -32,7 +32,7 @@ | SideBars (left and right) |----------------------------------------------------------------------------*/ -.p-TabBar.theia-app-sides { +.lm-TabBar.theia-app-sides { display: block; color: var(--theia-activityBar-inactiveForeground); background: var(--theia-activityBar-background); @@ -41,15 +41,15 @@ max-width: var(--theia-private-sidebar-tab-width); } -.p-TabBar-content { +.lm-TabBar-content { gap: 4px 0px; } -.p-TabBar.theia-app-sides .p-TabBar-content { +.lm-TabBar.theia-app-sides .lm-TabBar-content { z-index: 1; } -.p-TabBar.theia-app-sides .p-TabBar-tab { +.lm-TabBar.theia-app-sides .lm-TabBar-tab { position: relative; background: var(--theia-activityBar-background); flex-direction: column; @@ -59,8 +59,8 @@ cursor: pointer; } -.p-TabBar.theia-app-sides .p-TabBar-tab.p-mod-current, -.p-TabBar.theia-app-sides .p-TabBar-tab:hover { +.lm-TabBar.theia-app-sides .lm-TabBar-tab.lm-mod-current, +.lm-TabBar.theia-app-sides .lm-TabBar-tab:hover { color: var(--theia-activityBar-foreground); background-color: var(--theia-activityBar-activeBackground); min-height: var(--theia-private-sidebar-tab-height); @@ -68,23 +68,23 @@ border-top: none; } -.p-TabBar.theia-app-left .p-TabBar-tab.p-mod-current { +.lm-TabBar.theia-app-left .lm-TabBar-tab.lm-mod-current { border-top-color: transparent; box-shadow: 2px 0 0 var(--theia-activityBar-activeBorder) inset; } -.p-TabBar.theia-app-right .p-TabBar-tab.p-mod-current { +.lm-TabBar.theia-app-right .lm-TabBar-tab.lm-mod-current { border-top-color: transparent; box-shadow: -2px 0 0 var(--theia-activityBar-activeBorder) inset; } -.p-TabBar.theia-app-sides .p-TabBar-tabLabel, -.p-TabBar.theia-app-sides .p-TabBar-tabCloseIcon { +.lm-TabBar.theia-app-sides .lm-TabBar-tabLabel, +.lm-TabBar.theia-app-sides .lm-TabBar-tabCloseIcon { display: none; } /* inactive common icons */ -.p-TabBar.theia-app-sides .p-TabBar-tabIcon { +.lm-TabBar.theia-app-sides .lm-TabBar-tabIcon { display: flex; align-items: center; justify-content: center; @@ -104,38 +104,38 @@ } /* inactive legacy/plugin icons */ -.p-TabBar.theia-app-sides .p-TabBar-tabIcon:not(.codicon) { +.lm-TabBar.theia-app-sides .lm-TabBar-tabIcon:not(.codicon) { background: var(--theia-activityBar-inactiveForeground); } /* inactive file icons */ -.p-TabBar.theia-app-sides .file-icon.p-TabBar-tabIcon { +.lm-TabBar.theia-app-sides .file-icon.lm-TabBar-tabIcon { background: inherit !important; } /* inactive font-awesome icons */ -.p-TabBar.theia-app-sides .fa.p-TabBar-tabIcon { +.lm-TabBar.theia-app-sides .fa.lm-TabBar-tabIcon { background: none !important; } /* active icons */ -.p-TabBar.theia-app-sides .p-TabBar-tabIcon:hover, -.p-TabBar.theia-app-sides .p-mod-current .p-TabBar-tabIcon { +.lm-TabBar.theia-app-sides .lm-TabBar-tabIcon:hover, +.lm-TabBar.theia-app-sides .lm-mod-current .lm-TabBar-tabIcon { color: var(--theia-activityBar-foreground); } /* active legacy/plugin icons */ -.p-TabBar.theia-app-sides .p-TabBar-tabIcon:not(.codicon):hover, -.p-TabBar.theia-app-sides .p-mod-current .p-TabBar-tabIcon:not(.codicon) { +.lm-TabBar.theia-app-sides .lm-TabBar-tabIcon:not(.codicon):hover, +.lm-TabBar.theia-app-sides .lm-mod-current .lm-TabBar-tabIcon:not(.codicon) { background-color: var(--theia-activityBar-foreground); } -.p-TabBar.theia-app-left .p-TabBar-tabLabel { +.lm-TabBar.theia-app-left .lm-TabBar-tabLabel { transform-origin: top left 0; transform: rotate(-90deg) translateX(-100%); } -.p-TabBar.theia-app-right .p-TabBar-tabLabel { +.lm-TabBar.theia-app-right .lm-TabBar-tabLabel { transform-origin: top left 0; transform: rotate(90deg) translateY(-50%); } @@ -145,12 +145,12 @@ max-width: var(--theia-private-sidebar-tab-width); } -#theia-left-content-panel > .p-Panel { +#theia-left-content-panel > .lm-Panel { border-right: var(--theia-panel-border-width) solid var(--theia-activityBar-border); } -#theia-right-content-panel > .p-Panel { +#theia-right-content-panel > .lm-Panel { border-left: var(--theia-panel-border-width) solid var(--theia-activityBar-border); } @@ -159,8 +159,8 @@ background-color: var(--theia-sideBar-background); } -.p-Widget.theia-side-panel .p-Widget, -.p-Widget .theia-sidepanel-toolbar { +.lm-Widget.theia-side-panel .lm-Widget, +.lm-Widget .theia-sidepanel-toolbar { color: var(--theia-sideBar-foreground); } @@ -180,17 +180,17 @@ flex-shrink: 0; } -.p-Widget.theia-sidebar-menu { +.lm-Widget.theia-sidebar-menu { background-color: var(--theia-activityBar-background); display: flex; flex-direction: column-reverse; } -.p-Widget .theia-sidebar-menu-item { +.lm-Widget .theia-sidebar-menu-item { cursor: pointer; } -.p-Widget.theia-sidebar-menu i { +.lm-Widget.theia-sidebar-menu i { padding: var(--theia-private-sidebar-tab-padding-top-and-bottom) var(--theia-private-sidebar-tab-padding-left-and-right); display: flex; @@ -209,7 +209,7 @@ font-size: 16px; } -.p-SplitPanel-handle.sash-hidden { +.lm-SplitPanel-handle.sash-hidden { visibility: hidden; } @@ -217,12 +217,12 @@ | Perfect scrollbar |----------------------------------------------------------------------------*/ -.p-TabBar.theia-app-sides > .ps__rail-y { +.lm-TabBar.theia-app-sides > .ps__rail-y { width: var(--theia-private-sidebar-scrollbar-rail-width); z-index: 1000; } -#theia-app-shell .p-TabBar.theia-app-sides > .ps__rail-y > .ps__thumb-y { +#theia-app-shell .lm-TabBar.theia-app-sides > .ps__rail-y > .ps__thumb-y { width: var(--theia-private-sidebar-scrollbar-width); right: calc( ( @@ -232,13 +232,13 @@ ); } -.p-TabBar.theia-app-sides > .ps__rail-y:hover, -.p-TabBar.theia-app-sides > .ps__rail-y:focus { +.lm-TabBar.theia-app-sides > .ps__rail-y:hover, +.lm-TabBar.theia-app-sides > .ps__rail-y:focus { width: var(--theia-private-sidebar-scrollbar-rail-width); } -.p-TabBar.theia-app-sides > .ps__rail-y:hover > .ps__thumb-y, -.p-TabBar.theia-app-sides > .ps__rail-y:focus > .ps__thumb-y { +.lm-TabBar.theia-app-sides > .ps__rail-y:hover > .ps__thumb-y, +.lm-TabBar.theia-app-sides > .ps__rail-y:focus > .ps__thumb-y { width: var(--theia-private-sidebar-scrollbar-width); right: calc( ( @@ -260,39 +260,39 @@ border-color: var(--theia-panelInput-border); } -#theia-bottom-content-panel .p-DockPanel-handle[data-orientation="horizontal"] { +#theia-bottom-content-panel .lm-DockPanel-handle[data-orientation="horizontal"] { border-left: var(--theia-border-width) solid var(--theia-panel-border); } -#theia-bottom-content-panel .p-TabBar { +#theia-bottom-content-panel .lm-TabBar { border-top: var(--theia-border-width) solid var(--theia-panel-border); background: inherit; } -#theia-bottom-content-panel .p-TabBar-tab { +#theia-bottom-content-panel .lm-TabBar-tab { background: inherit; } -#theia-bottom-content-panel .p-TabBar-tab:not(.p-mod-current) { +#theia-bottom-content-panel .lm-TabBar-tab:not(.lm-mod-current) { color: var(--theia-panelTitle-inactiveForeground); } -#theia-bottom-content-panel .p-TabBar-tab.p-mod-current { +#theia-bottom-content-panel .lm-TabBar-tab.lm-mod-current { color: var(--theia-panelTitle-activeForeground); box-shadow: 0 var(--theia-border-width) 0 var(--theia-panelTitle-activeBorder) inset; } #theia-bottom-content-panel - .p-TabBar:not(.theia-tabBar-active) - .p-TabBar-tab + .lm-TabBar:not(.theia-tabBar-active) + .lm-TabBar-tab .theia-tab-icon-label { color: var(--theia-tab-unfocusedInactiveForeground); } #theia-bottom-content-panel - .p-TabBar:not(.theia-tabBar-active) - .p-TabBar-tab.p-mod-current + .lm-TabBar:not(.theia-tabBar-active) + .lm-TabBar-tab.lm-mod-current .theia-tab-icon-label { color: var(--theia-tab-unfocusedActiveForeground); } @@ -308,15 +308,15 @@ padding-inline-start: 0px; } -.p-TabBar.theia-app-sides > .theia-TabBar-hidden-content .p-TabBar-tab { +.lm-TabBar.theia-app-sides > .theia-TabBar-hidden-content .lm-TabBar-tab { line-height: var(--theia-private-sidebar-tab-width); } -.p-TabBar.theia-app-left > .theia-TabBar-hidden-content .p-TabBar-tabLabel { +.lm-TabBar.theia-app-left > .theia-TabBar-hidden-content .lm-TabBar-tabLabel { transform: none; } -.p-TabBar.theia-app-right > .theia-TabBar-hidden-content .p-TabBar-tabLabel { +.lm-TabBar.theia-app-right > .theia-TabBar-hidden-content .lm-TabBar-tabLabel { transform: none; } @@ -344,11 +344,11 @@ min-width: 1rem; } -.theia-sidepanel-toolbar .p-TabBar-toolbar .item { +.theia-sidepanel-toolbar .lm-TabBar-toolbar .item { color: var(--theia-icon-foreground); } -.theia-sidepanel-toolbar .p-TabBar-toolbar .item > div { +.theia-sidepanel-toolbar .lm-TabBar-toolbar .item > div { height: 18px; width: 18px; background-repeat: no-repeat; diff --git a/packages/core/src/browser/style/split-widget.css b/packages/core/src/browser/style/split-widget.css index 2b18734fb2bea..db23ecabd52b2 100644 --- a/packages/core/src/browser/style/split-widget.css +++ b/packages/core/src/browser/style/split-widget.css @@ -14,25 +14,25 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 ********************************************************************************/ -.theia-split-widget > .p-SplitPanel { +.theia-split-widget > .lm-SplitPanel { height: 100%; width: 100%; outline: none; } -.theia-split-widget > .p-SplitPanel > .p-SplitPanel-child { +.theia-split-widget > .lm-SplitPanel > .lm-SplitPanel-child { min-width: 50px; min-height: var(--theia-content-line-height); } -.theia-split-widget > .p-SplitPanel > .p-SplitPanel-handle { +.theia-split-widget > .lm-SplitPanel > .lm-SplitPanel-handle { box-sizing: border-box; } -.theia-split-widget > .p-SplitPanel[data-orientation="horizontal"] > .p-SplitPanel-handle { +.theia-split-widget > .lm-SplitPanel[data-orientation="horizontal"] > .lm-SplitPanel-handle { border-left: var(--theia-border-width) solid var(--theia-sideBarSectionHeader-border); } -.theia-split-widget > .p-SplitPanel[data-orientation="vertical"] > .p-SplitPanel-handle { +.theia-split-widget > .lm-SplitPanel[data-orientation="vertical"] > .lm-SplitPanel-handle { border-top: var(--theia-border-width) solid var(--theia-sideBarSectionHeader-border); } diff --git a/packages/core/src/browser/style/tabs.css b/packages/core/src/browser/style/tabs.css index 661030977fa90..9f3ca3f01eb33 100644 --- a/packages/core/src/browser/style/tabs.css +++ b/packages/core/src/browser/style/tabs.css @@ -17,19 +17,19 @@ | General tab bar style |----------------------------------------------------------------------------*/ -.p-TabBar { +.lm-TabBar { font-size: var(--theia-ui-font-size1); } -.p-TabBar[data-orientation="horizontal"] { +.lm-TabBar[data-orientation="horizontal"] { min-height: var(--theia-horizontal-toolbar-height); } -.p-TabBar .p-TabBar-content { +.lm-TabBar .lm-TabBar-content { cursor: pointer; } -.p-TabBar[data-orientation="horizontal"] .p-TabBar-tab { +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-tab { flex: none; height: var(--theia-horizontal-toolbar-height); min-width: 35px; @@ -39,21 +39,21 @@ overflow: hidden; } -.p-TabBar[data-orientation="vertical"] .p-TabBar-tab { +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-tab { border-top: var(--theia-dragover-tab-border-width) solid transparent !important; border-bottom: var(--theia-dragover-tab-border-width) solid transparent !important; } -.p-TabBar[data-orientation="vertical"] .p-TabBar-tab.drop-target-top { +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-tab.drop-target-top { border-top-color: var(--theia-activityBar-activeBorder) !important; } -.p-TabBar[data-orientation="vertical"] .p-TabBar-tab.drop-target-bottom { +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-tab.drop-target-bottom { border-bottom-color: var(--theia-activityBar-activeBorder) !important; } -.p-TabBar[data-orientation="horizontal"] .p-TabBar-tab .theia-tab-icon-label, -.p-TabBar-tab.p-mod-drag-image .theia-tab-icon-label { +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-tab .theia-tab-icon-label, +.lm-TabBar-tab.lm-mod-drag-image .theia-tab-icon-label { display: flex; line-height: var(--theia-content-line-height); align-items: center; @@ -64,19 +64,19 @@ |----------------------------------------------------------------------------*/ #theia-main-content-panel, -#theia-main-content-panel .p-Widget.p-DockPanel-widget { +#theia-main-content-panel .lm-Widget.lm-DockPanel-widget { background: var(--theia-editor-background); } -#theia-main-content-panel .p-DockPanel-handle[data-orientation="horizontal"] { +#theia-main-content-panel .lm-DockPanel-handle[data-orientation="horizontal"] { border-left: var(--theia-border-width) solid var(--theia-editorGroup-border); } -#theia-main-content-panel .p-DockPanel-handle[data-orientation="vertical"]+.p-TabBar { +#theia-main-content-panel .lm-DockPanel-handle[data-orientation="vertical"]+.lm-TabBar { border-top: var(--theia-border-width) solid var(--theia-editorGroup-border); } -#theia-main-content-panel .p-TabBar .p-TabBar-tab { +#theia-main-content-panel .lm-TabBar .lm-TabBar-tab { border-right: 1px solid var(--theia-tab-border); border-top: 1px solid transparent; border-bottom: 1px solid transparent; @@ -84,15 +84,15 @@ color: var(--theia-tab-inactiveForeground); } -#theia-main-content-panel .p-TabBar:not(.theia-tabBar-active) .p-TabBar-tab { +#theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-tab { color: var(--theia-tab-unfocusedInactiveForeground); } -.p-TabBar.theia-app-centers { +.lm-TabBar.theia-app-centers { background: var(--theia-editorGroupHeader-tabsBackground); } -.p-TabBar.theia-app-centers::after { +.lm-TabBar.theia-app-centers::after { content: ""; position: absolute; bottom: 0; @@ -103,14 +103,14 @@ height: 1px; } -.p-TabBar.theia-app-centers .p-TabBar-tabIcon, -.p-TabBar.theia-app-centers .p-TabBar-tabLabel, -.p-TabBar.theia-app-centers .p-TabBar-tabLabelDetails, -.p-TabBar.theia-app-centers .p-TabBar-tabCloseIcon { +.lm-TabBar.theia-app-centers .lm-TabBar-tabIcon, +.lm-TabBar.theia-app-centers .lm-TabBar-tabLabel, +.lm-TabBar.theia-app-centers .lm-TabBar-tabLabelDetails, +.lm-TabBar.theia-app-centers .lm-TabBar-tabCloseIcon { display: inline-block; } -.p-TabBar.theia-app-centers .p-TabBar-tabLabelDetails { +.lm-TabBar.theia-app-centers .lm-TabBar-tabLabelDetails { margin-left: 5px; color: var(--theia-descriptionForeground); flex: 1 1 auto; @@ -118,17 +118,17 @@ white-space: nowrap; } -.p-TabBar-tail { +.lm-TabBar-tail { padding-left: 5px; text-align: center; justify-content: center; } -.p-TabBar.theia-app-centers .p-TabBar-tabLabelWrapper { +.lm-TabBar.theia-app-centers .lm-TabBar-tabLabelWrapper { display: flex; } -.p-TabBar-tab-secondary-label { +.lm-TabBar-tab-secondary-label { color: var(--theia-settings-headerForeground); cursor: pointer; font-size: var(--theia-ui-font-size0); @@ -147,8 +147,8 @@ padding: 2px 14px 0 0; } -.p-TabBar .p-TabBar-tabIcon, -.p-TabBar-tab.p-mod-drag-image .p-TabBar-tabIcon { +.lm-TabBar .lm-TabBar-tabIcon, +.lm-TabBar-tab.lm-mod-drag-image .lm-TabBar-tabIcon { width: 15px; line-height: 1.7; font-size: 12px; @@ -157,8 +157,8 @@ } /* common icons */ -.p-TabBar.theia-app-centers .p-TabBar-tabIcon, -.p-TabBar-tab.p-mod-drag-image .p-TabBar-tabIcon { +.lm-TabBar.theia-app-centers .lm-TabBar-tabIcon, +.lm-TabBar-tab.lm-mod-drag-image .lm-TabBar-tabIcon { min-height: 14px; background-size: 13px; background-position-y: 3px; @@ -170,24 +170,24 @@ padding-right: 8px; } -.p-TabBar.theia-app-centers .p-TabBar-tabIcon[class*="plugin-icon-"], -.p-TabBar-tab.p-mod-drag-image .p-TabBar-tabIcon[class*="plugin-icon-"] { +.lm-TabBar.theia-app-centers .lm-TabBar-tabIcon[class*="plugin-icon-"], +.lm-TabBar-tab.lm-mod-drag-image .lm-TabBar-tabIcon[class*="plugin-icon-"] { background: none; height: var(--theia-icon-size); } -.p-TabBar.theia-app-centers .p-TabBar-tabIcon[class*="plugin-icon-"]::before, -.p-TabBar-tab.p-mod-drag-image .p-TabBar-tabIcon[class*="plugin-icon-"]::before { +.lm-TabBar.theia-app-centers .lm-TabBar-tabIcon[class*="plugin-icon-"]::before, +.lm-TabBar-tab.lm-mod-drag-image .lm-TabBar-tabIcon[class*="plugin-icon-"]::before { display: inline-block; } /* codicons */ -.p-TabBar.theia-app-centers .p-TabBar-tabIcon.codicon, -.p-TabBar-tab.p-mod-drag-image .p-TabBar-tabIcon.codicon { +.lm-TabBar.theia-app-centers .lm-TabBar-tabIcon.codicon, +.lm-TabBar-tab.lm-mod-drag-image .lm-TabBar-tabIcon.codicon { background: none; } -.p-TabBar-tabLock:after { +.lm-TabBar-tabLock:after { content: "\ebe7"; opacity: 0.75; margin-left: 4px; @@ -200,26 +200,26 @@ } /* file icons */ -.p-TabBar[data-orientation="horizontal"] .p-TabBar-tabIcon.file-icon, -.p-TabBar-tab.p-mod-drag-image .p-TabBar-tabIcon.file-icon { +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-tabIcon.file-icon, +.lm-TabBar-tab.lm-mod-drag-image .lm-TabBar-tabIcon.file-icon { background: none; padding-bottom: 0px; min-height: 20px; } -.p-TabBar[data-orientation="horizontal"] .p-TabBar-tabIcon.fa, -.p-TabBar-tab.p-mod-drag-image .p-TabBar-tabIcon.fa { +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-tabIcon.fa, +.lm-TabBar-tab.lm-mod-drag-image .lm-TabBar-tabIcon.fa { background: none; min-height: 0; height: inherit; } -.p-TabBar[data-orientation="vertical"] .p-TabBar-tab.p-mod-invisible { +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-tab.lm-mod-invisible { visibility: hidden; } -.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable>.p-TabBar-tabCloseIcon, -.p-TabBar.theia-app-centers .p-TabBar-tab.theia-mod-pinned>.p-TabBar-tabCloseIcon { +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable>.lm-TabBar-tabCloseIcon, +.lm-TabBar.theia-app-centers .lm-TabBar-tab.theia-mod-pinned>.lm-TabBar-tabCloseIcon { padding: 2px; margin-top: 2px; margin-left: 4px; @@ -237,47 +237,47 @@ -ms-user-select: none; } -.p-TabBar.theia-app-centers.dynamic-tabs .p-TabBar-tab.p-mod-closable>.p-TabBar-tabCloseIcon, -.p-TabBar.theia-app-centers.dynamic-tabs .p-TabBar-tab.theia-mod-pinned>.p-TabBar-tabCloseIcon { +.lm-TabBar.theia-app-centers.dynamic-tabs .lm-TabBar-tab.lm-mod-closable>.lm-TabBar-tabCloseIcon, +.lm-TabBar.theia-app-centers.dynamic-tabs .lm-TabBar-tab.theia-mod-pinned>.lm-TabBar-tabCloseIcon { /* hide close icon for dynamic tabs strategy*/ display: none; } -.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-current>.p-TabBar-tabCloseIcon, -.p-TabBar.theia-app-centers .p-TabBar-tab:hover.p-mod-closable>.p-TabBar-tabCloseIcon, -.p-TabBar.theia-app-centers .p-TabBar-tab:hover.theia-mod-pinned>.p-TabBar-tabCloseIcon { +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-current>.lm-TabBar-tabCloseIcon, +.lm-TabBar.theia-app-centers .lm-TabBar-tab:hover.lm-mod-closable>.lm-TabBar-tabCloseIcon, +.lm-TabBar.theia-app-centers .lm-TabBar-tab:hover.theia-mod-pinned>.lm-TabBar-tabCloseIcon { display: inline-block; } -.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable>.p-TabBar-tabCloseIcon:hover { +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable>.lm-TabBar-tabCloseIcon:hover { border-radius: 5px; background-color: rgba(50%, 50%, 50%, 0.2); } -.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable, -.p-TabBar.theia-app-centers .p-TabBar-tab.theia-mod-pinned { +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable, +.lm-TabBar.theia-app-centers .lm-TabBar-tab.theia-mod-pinned { padding-right: 4px; } -.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable:not(.theia-mod-dirty):hover>.p-TabBar-tabCloseIcon:before, -.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable:not(.theia-mod-dirty).p-TabBar-tab.p-mod-current>.p-TabBar-tabCloseIcon:before, -.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable.theia-mod-dirty>.p-TabBar-tabCloseIcon:hover:before { +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable:not(.theia-mod-dirty):hover>.lm-TabBar-tabCloseIcon:before, +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable:not(.theia-mod-dirty).lm-TabBar-tab.lm-mod-current>.lm-TabBar-tabCloseIcon:before, +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable.theia-mod-dirty>.lm-TabBar-tabCloseIcon:hover:before { content: "\ea76"; } -.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable.theia-mod-dirty>.p-TabBar-tabCloseIcon:before { +.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable.theia-mod-dirty>.lm-TabBar-tabCloseIcon:before { content: "\ea71"; } -.p-TabBar.theia-app-centers .p-TabBar-tab.theia-mod-pinned>.p-TabBar-tabCloseIcon:before { +.lm-TabBar.theia-app-centers .lm-TabBar-tab.theia-mod-pinned>.lm-TabBar-tabCloseIcon:before { content: "\eba0"; } -.p-TabBar.theia-app-centers .p-TabBar-tab.theia-mod-pinned.theia-mod-dirty>.p-TabBar-tabCloseIcon:before { +.lm-TabBar.theia-app-centers .lm-TabBar-tab.theia-mod-pinned.theia-mod-dirty>.lm-TabBar-tabCloseIcon:before { content: "\ebb2"; } -.p-TabBar-tabIcon.no-icon { +.lm-TabBar-tabIcon.no-icon { display: none !important; } @@ -297,7 +297,7 @@ text-align: center; } -.p-TabBar .theia-badge-decorator-horizontal { +.lm-TabBar .theia-badge-decorator-horizontal { background-color: var(--theia-badge-background); border-radius: 20px; box-sizing: border-box; @@ -316,38 +316,32 @@ | Perfect scrollbar |----------------------------------------------------------------------------*/ -.p-TabBar[data-orientation="horizontal"] .p-TabBar-content-container>.ps__rail-x { +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-content-container>.ps__rail-x { height: var(--theia-private-horizontal-tab-scrollbar-rail-height); z-index: 1000; } -.p-TabBar[data-orientation="horizontal"] .p-TabBar-content-container>.ps__rail-x>.ps__thumb-x { +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-content-container>.ps__rail-x>.ps__thumb-x { height: var(--theia-private-horizontal-tab-scrollbar-height) !important; bottom: calc((var(--theia-private-horizontal-tab-scrollbar-rail-height) - var(--theia-private-horizontal-tab-scrollbar-height)) / 2); } -.p-TabBar[data-orientation="horizontal"] .p-TabBar-content-container>.ps__rail-x:hover, -.p-TabBar[data-orientation="horizontal"] .p-TabBar-content-container>.ps__rail-x:focus { +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-content-container>.ps__rail-x:hover, +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-content-container>.ps__rail-x:focus { height: var(--theia-private-horizontal-tab-scrollbar-rail-height) !important; } -.p-TabBar[data-orientation="horizontal"] .p-TabBar-content-container>.ps__rail-x:hover>.ps__thumb-x, -.p-TabBar[data-orientation="horizontal"] .p-TabBar-content-container>.ps__rail-x:focus>.ps__thumb-x { - height: calc(var(--theia-private-horizontal-tab-scrollbar-height) / 2) !important; - bottom: calc((var(--theia-private-horizontal-tab-scrollbar-rail-height) - var(--theia-private-horizontal-tab-scrollbar-height)) / 2); -} - -.p-TabBar[data-orientation="vertical"] .p-TabBar-content-container>.ps__rail-y { +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-content-container>.ps__rail-y { width: var(--theia-private-horizontal-tab-scrollbar-rail-height); z-index: 1000; } -.p-TabBar[data-orientation="vertical"] .p-TabBar-content-container>.ps__rail-y>.ps__thumb-y { +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-content-container>.ps__rail-y>.ps__thumb-y { width: var(--theia-private-horizontal-tab-scrollbar-height) !important; right: calc((var(--theia-private-horizontal-tab-scrollbar-rail-height) - var(--theia-private-horizontal-tab-scrollbar-height)) / 2); } -.p-TabBar[data-orientation="vertical"] .p-TabBar-content-container { +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-content-container { display: block; } @@ -355,7 +349,7 @@ | Dragged tabs |----------------------------------------------------------------------------*/ -.p-TabBar-tab.p-mod-drag-image { +.lm-TabBar-tab.lm-mod-drag-image { transform: translateX(-40%) translateY(-58%); opacity: 0.8; line-height: var(--theia-private-horizontal-tab-height); @@ -374,7 +368,7 @@ | Tab-bar toolbar |----------------------------------------------------------------------------*/ -.p-TabBar-toolbar { +.lm-TabBar-toolbar { z-index: var(--theia-tabbar-toolbar-z-index); /* Due to the scrollbar (`z-index: 1000;`) it has a greater `z-index`. */ display: flex; @@ -384,14 +378,14 @@ margin-right: 4px; } -.p-TabBar-content-container { +.lm-TabBar-content-container { display: flex; flex: 1; position: relative; /* This is necessary for perfect-scrollbar */ } -.p-TabBar-toolbar .item { +.lm-TabBar-toolbar .item { opacity: var(--theia-mod-disabled-opacity); cursor: default; display: flex; @@ -400,54 +394,54 @@ align-items: centery; } -.p-TabBar-toolbar .item>div { +.lm-TabBar-toolbar .item>div { height: 100%; } -.p-TabBar-toolbar .item.enabled { +.lm-TabBar-toolbar .item.enabled { opacity: 1; cursor: pointer; } -.p-TabBar-toolbar :not(.item.enabled) .action-label { +.lm-TabBar-toolbar :not(.item.enabled) .action-label { background: transparent; cursor: default; } -.p-TabBar-toolbar .item.toggled { +.lm-TabBar-toolbar .item.toggled { border: var(--theia-border-width) var(--theia-inputOption-activeBorder) solid; background-color: var(--theia-inputOption-activeBackground); } -.p-TabBar-toolbar .item>div { +.lm-TabBar-toolbar .item>div { line-height: calc(var(--theia-icon-size) + 2px); height: calc(var(--theia-icon-size) + 2px); background-repeat: no-repeat; line-height: 18px; } -.p-TabBar-toolbar .item>div.no-icon { +.lm-TabBar-toolbar .item>div.no-icon { /* Make room for a text label instead of an icon. */ width: 100%; } -.p-TabBar-toolbar .item .collapse-all { +.lm-TabBar-toolbar .item .collapse-all { background: var(--theia-icon-collapse-all) no-repeat; } -.p-TabBar-toolbar .item .close { +.lm-TabBar-toolbar .item .close { background: var(--theia-icon-collapse-all) no-repeat; } -.p-TabBar-toolbar .item .clear-all { +.lm-TabBar-toolbar .item .clear-all { background: var(--theia-icon-clear) no-repeat; } -.p-TabBar-toolbar .item .refresh { +.lm-TabBar-toolbar .item .refresh { background: var(--theia-icon-refresh) no-repeat; } -.p-TabBar-toolbar .item .cancel { +.lm-TabBar-toolbar .item .cancel { background: var(--theia-icon-close) no-repeat; } @@ -455,12 +449,12 @@ * The chevron for the pop-up menu indication is shrunk and * stuffed in the bottom-right corner. */ -.p-TabBar-toolbar .item.menu .chevron { +.lm-TabBar-toolbar .item.menu .chevron { font-size: 8px; vertical-align: bottom; } -#theia-main-content-panel .p-TabBar:not(.theia-tabBar-active) .p-TabBar-toolbar { +#theia-main-content-panel .lm-TabBar:not(.theia-tabBar-active) .lm-TabBar-toolbar { display: none; } @@ -468,32 +462,32 @@ min-width: 100%; } -.p-TabBar.theia-tabBar-multirow[data-orientation="horizontal"] { +.lm-TabBar.theia-tabBar-multirow[data-orientation="horizontal"] { min-height: calc(var(--theia-breadcrumbs-height) + var(--theia-horizontal-toolbar-height)); flex-direction: column; } -.p-TabBar[data-orientation="horizontal"] .theia-tabBar-tab-row { +.lm-TabBar[data-orientation="horizontal"] .theia-tabBar-tab-row { display: flex; flex-flow: row nowrap; min-width: 100%; } -.p-TabBar[data-orientation="vertical"] .theia-tabBar-tab-row { +.lm-TabBar[data-orientation="vertical"] .theia-tabBar-tab-row { display: flex; flex-flow: column nowrap; height: 100%; } -.p-TabBar[data-orientation="horizontal"] .p-TabBar-content { +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-content { flex-direction: row; } -.p-TabBar[data-orientation="vertical"] .p-TabBar-content { +.lm-TabBar[data-orientation="vertical"] .lm-TabBar-content { flex-direction: column; } -.p-TabBar.theia-app-centers[data-orientation="horizontal"].dynamic-tabs .p-TabBar-tabLabel { +.lm-TabBar.theia-app-centers[data-orientation="horizontal"].dynamic-tabs .lm-TabBar-tabLabel { /* fade out text with dynamic tabs strategy */ mask-image: linear-gradient(to left, rgba(0, 0, 0, 0.3), @@ -504,7 +498,7 @@ flex: 1; } -.p-TabBar[data-orientation="horizontal"] .p-TabBar-tab .theia-tab-icon-label { +.lm-TabBar[data-orientation="horizontal"] .lm-TabBar-tab .theia-tab-icon-label { flex: 1; overflow: hidden; } @@ -559,6 +553,6 @@ align-items: center; } -.theia-tabBar-open-tabs.p-mod-hidden { +.theia-tabBar-open-tabs.lm-mod-hidden { display: none; -} \ No newline at end of file +} diff --git a/packages/core/src/browser/style/view-container.css b/packages/core/src/browser/style/view-container.css index 59a9f9b5bd7e6..6b1614f101dca 100644 --- a/packages/core/src/browser/style/view-container.css +++ b/packages/core/src/browser/style/view-container.css @@ -27,36 +27,36 @@ flex-direction: column; } -.theia-view-container > .p-SplitPanel { +.theia-view-container > .lm-SplitPanel { height: 100%; width: 100%; } -.theia-view-container > .p-SplitPanel > .p-SplitPanel-child { +.theia-view-container > .lm-SplitPanel > .lm-SplitPanel-child { min-width: 50px; min-height: var(--theia-content-line-height); } -.theia-view-container > .p-SplitPanel > .p-SplitPanel-handle::after { +.theia-view-container > .lm-SplitPanel > .lm-SplitPanel-handle::after { min-height: 2px; min-width: 2px; } -.p-SplitPanel > .p-SplitPanel-handle:hover::after { +.lm-SplitPanel > .lm-SplitPanel-handle:hover::after { background-color: var(--theia-sash-hoverBorder); transition-delay: var(--theia-sash-hoverDelay); } -.p-SplitPanel > .p-SplitPanel-handle:active::after { +.lm-SplitPanel > .lm-SplitPanel-handle:active::after { background-color: var(--theia-sash-activeBorder); transition-delay: 0s !important; } -.p-SplitPanel[data-orientation="horizontal"] > .p-SplitPanel-handle::after { +.lm-SplitPanel[data-orientation="horizontal"] > .lm-SplitPanel-handle::after { min-width: var(--theia-sash-width); } -.p-SplitPanel[data-orientation="vertical"] > .p-SplitPanel-handle::after { +.lm-SplitPanel[data-orientation="vertical"] > .lm-SplitPanel-handle::after { min-height: var(--theia-sash-width); } @@ -75,11 +75,11 @@ font-weight: 700; } -.p-Widget > .theia-view-container-part-header { +.lm-Widget > .theia-view-container-part-header { box-shadow: 0 1px 0 var(--theia-sideBarSectionHeader-border) inset; } -.p-Widget.p-first-visible > .theia-view-container-part-header { +.lm-Widget.lm-first-visible > .theia-view-container-part-header { box-shadow: none; } @@ -88,7 +88,7 @@ } .theia-view-container - > .p-SplitPanel[data-orientation="horizontal"] + > .lm-SplitPanel[data-orientation="horizontal"] .part > .theia-header .theia-ExpansionToggle::before { @@ -97,7 +97,7 @@ } .theia-view-container - > .p-SplitPanel[data-orientation="horizontal"] + > .lm-SplitPanel[data-orientation="horizontal"] .part > .theia-header .theia-ExpansionToggle { @@ -162,7 +162,7 @@ padding: 0 var(--theia-ui-padding) 0 var(--theia-ui-padding); } -.p-TabBar-toolbar.theia-view-container-part-title { +.lm-TabBar-toolbar.theia-view-container-part-title { overflow: visible !important; padding: 0px; padding-right: calc(var(--theia-ui-padding) * 2 / 3); @@ -173,10 +173,10 @@ } .theia-view-container-part-title.menu-open, -.p-Widget.part:not(.collapsed):hover +.lm-Widget.part:not(.collapsed):hover .theia-view-container-part-header .theia-view-container-part-title, -.p-Widget.part:not(.collapsed):focus-within +.lm-Widget.part:not(.collapsed):focus-within .theia-view-container-part-header .theia-view-container-part-title { display: flex; diff --git a/packages/core/src/browser/tree/tree-widget.tsx b/packages/core/src/browser/tree/tree-widget.tsx index 9888aae99874b..29768bb6cdaf7 100644 --- a/packages/core/src/browser/tree/tree-widget.tsx +++ b/packages/core/src/browser/tree/tree-widget.tsx @@ -15,7 +15,7 @@ // ***************************************************************************** import { injectable, inject, postConstruct } from 'inversify'; -import { Message } from '@phosphor/messaging'; +import { Message } from '@lumino/messaging'; import { Disposable, MenuPath, SelectionService } from '../../common'; import { Key, KeyCode, KeyModifier } from '../keyboard/keys'; import { ContextMenuRenderer } from '../context-menu-renderer'; @@ -36,7 +36,7 @@ import { Virtuoso, VirtuosoHandle } from 'react-virtuoso'; import { TopDownTreeIterator } from './tree-iterator'; import { SearchBox, SearchBoxFactory, SearchBoxProps } from './search-box'; import { TreeSearch } from './tree-search'; -import { ElementExt } from '@phosphor/domutils'; +import { ElementExt } from '@lumino/domutils'; import { TreeWidgetSelection } from './tree-widget-selection'; import { MaybePromise } from '../../common/types'; import { LabelProvider } from '../label-provider'; diff --git a/packages/core/src/browser/view-container.ts b/packages/core/src/browser/view-container.ts index ef39d86d12980..a3bec0e543f15 100644 --- a/packages/core/src/browser/view-container.ts +++ b/packages/core/src/browser/view-container.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { interfaces, injectable, inject, postConstruct } from 'inversify'; -import { IIterator, toArray, find, some, every, map, ArrayExt } from '@phosphor/algorithm'; +import { find, some, every, map, ArrayExt } from '@lumino/algorithm'; import { Widget, EXPANSION_TOGGLE_CLASS, COLLAPSED_CLASS, CODICON_TREE_ITEM_CLASSES, MessageLoop, Message, SplitPanel, BaseWidget, addEventListener, SplitLayout, LayoutItem, PanelLayout, addKeyListener, waitForRevealed, UnsafeWidgetUtilities, DockPanel, PINNED_CLASS @@ -34,9 +34,9 @@ import { isEmpty, isObject, nls } from '../common'; import { WidgetManager } from './widget-manager'; import { Key } from './keys'; import { ProgressBarFactory } from './progress-bar-factory'; -import { Drag, IDragEvent } from '@phosphor/dragdrop'; -import { MimeData } from '@phosphor/coreutils'; -import { ElementExt } from '@phosphor/domutils'; +import { Drag } from '@lumino/dragdrop'; +import { MimeData } from '@lumino/coreutils'; +import { ElementExt } from '@lumino/domutils'; import { TabBarDecoratorService } from './shell/tab-bar-decorator'; export interface ViewContainerTitleOptions { @@ -220,7 +220,7 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica } protected updateSplitterVisibility(): void { - const className = 'p-first-visible'; + const className = 'lm-first-visible'; let firstFound = false; for (const part of this.getParts()) { if (!part.isHidden && !firstFound) { @@ -713,47 +713,47 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica protected override onBeforeAttach(msg: Message): void { super.onBeforeAttach(msg); - this.node.addEventListener('p-dragenter', this, true); - this.node.addEventListener('p-dragover', this, true); - this.node.addEventListener('p-dragleave', this, true); - this.node.addEventListener('p-drop', this, true); + this.node.addEventListener('lm-dragenter', this, true); + this.node.addEventListener('lm-dragover', this, true); + this.node.addEventListener('lm-dragleave', this, true); + this.node.addEventListener('lm-drop', this, true); } protected override onAfterDetach(msg: Message): void { super.onAfterDetach(msg); - this.node.removeEventListener('p-dragenter', this, true); - this.node.removeEventListener('p-dragover', this, true); - this.node.removeEventListener('p-dragleave', this, true); - this.node.removeEventListener('p-drop', this, true); + this.node.removeEventListener('lm-dragenter', this, true); + this.node.removeEventListener('lm-dragover', this, true); + this.node.removeEventListener('lm-dragleave', this, true); + this.node.removeEventListener('lm-drop', this, true); } handleEvent(event: Event): void { switch (event.type) { - case 'p-dragenter': - this.handleDragEnter(event as IDragEvent); + case 'lm-dragenter': + this.handleDragEnter(event as Drag.Event); break; - case 'p-dragover': - this.handleDragOver(event as IDragEvent); + case 'lm-dragover': + this.handleDragOver(event as Drag.Event); break; - case 'p-dragleave': - this.handleDragLeave(event as IDragEvent); + case 'lm-dragleave': + this.handleDragLeave(event as Drag.Event); break; - case 'p-drop': - this.handleDrop(event as IDragEvent); + case 'lm-drop': + this.handleDrop(event as Drag.Event); break; } } - handleDragEnter(event: IDragEvent): void { - if (event.mimeData.hasData('application/vnd.phosphor.view-container-factory')) { + handleDragEnter(event: Drag.Event): void { + if (event.mimeData.hasData('application/vnd.lumino.view-container-factory')) { event.preventDefault(); event.stopPropagation(); } } toDisposeOnDragEnd = new DisposableCollection(); - handleDragOver(event: IDragEvent): void { - const factory = event.mimeData.getData('application/vnd.phosphor.view-container-factory'); + handleDragOver(event: Drag.Event): void { + const factory = event.mimeData.getData('application/vnd.lumino.view-container-factory'); const widget = factory && factory(); if (!(widget instanceof ViewContainerPart)) { return; @@ -797,17 +797,17 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica event.dropAction = event.proposedAction; }; - handleDragLeave(event: IDragEvent): void { + handleDragLeave(event: Drag.Event): void { this.toDisposeOnDragEnd.dispose(); - if (event.mimeData.hasData('application/vnd.phosphor.view-container-factory')) { + if (event.mimeData.hasData('application/vnd.lumino.view-container-factory')) { event.preventDefault(); event.stopPropagation(); } }; - handleDrop(event: IDragEvent): void { + handleDrop(event: Drag.Event): void { this.toDisposeOnDragEnd.dispose(); - const factory = event.mimeData.getData('application/vnd.phosphor.view-container-factory'); + const factory = event.mimeData.getData('application/vnd.lumino.view-container-factory'); const draggedPart = factory && factory(); if (!(draggedPart instanceof ViewContainerPart)) { event.dropAction = 'none'; @@ -834,7 +834,7 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica event => { event.preventDefault(); const mimeData = new MimeData(); - mimeData.setData('application/vnd.phosphor.view-container-factory', () => part); + mimeData.setData('application/vnd.lumino.view-container-factory', () => part); const clonedHeader = part.headerElement.cloneNode(true) as HTMLElement; clonedHeader.style.width = part.node.style.width; clonedHeader.style.opacity = '0.6'; @@ -844,7 +844,7 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica proposedAction: 'move', supportedActions: 'move' }); - part.node.classList.add('p-mod-hidden'); + part.node.classList.add('lm-mod-hidden'); drag.start(event.clientX, event.clientY).then(dropAction => { // The promise is resolved when the drag has ended if (dropAction === 'move' && part.currentViewContainerId !== this.id) { @@ -852,7 +852,7 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica this.lastVisibleState = this.doStoreState(); } }); - setTimeout(() => { part.node.classList.remove('p-mod-hidden'); }, 0); + setTimeout(() => { part.node.classList.remove('lm-mod-hidden'); }, 0); }, false)); } @@ -1364,13 +1364,13 @@ export class ViewContainerLayout extends SplitLayout { return (this as any)._items as Array; } - override iter(): IIterator { + iter(): IterableIterator { return map(this.items, item => item.widget); } // @ts-expect-error TS2611 `SplitLayout.widgets` is declared as `readonly widgets` but is implemented as a getter. get widgets(): ViewContainerPart[] { - return toArray(this.iter()); + return Array.from(this.iter()); } override attachWidget(index: number, widget: ViewContainerPart): void { diff --git a/packages/core/src/browser/widget-manager.spec.ts b/packages/core/src/browser/widget-manager.spec.ts index a8de2d9dffc13..2d361fe17c3f6 100644 --- a/packages/core/src/browser/widget-manager.spec.ts +++ b/packages/core/src/browser/widget-manager.spec.ts @@ -20,7 +20,7 @@ let disableJsDom = enableJSDOM(); import { Container, ContainerModule } from 'inversify'; import { expect } from 'chai'; import { WidgetManager, WidgetFactory } from './widget-manager'; -import { Widget } from '@phosphor/widgets'; +import { Widget } from '@lumino/widgets'; import { ILogger } from '../common/logger'; import { MockLogger } from '../common/test/mock-logger'; import { bindContributionProvider } from '../common'; diff --git a/packages/core/src/browser/widget-manager.ts b/packages/core/src/browser/widget-manager.ts index 960131b2c1379..a0a3e7dfa5b30 100644 --- a/packages/core/src/browser/widget-manager.ts +++ b/packages/core/src/browser/widget-manager.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { inject, named, injectable } from 'inversify'; -import { Widget } from '@phosphor/widgets'; +import { Widget } from '@lumino/widgets'; import { ILogger, Emitter, Event, ContributionProvider, MaybePromise, WaitUntilEvent } from '../common'; import stableJsonStringify = require('fast-json-stable-stringify'); diff --git a/packages/core/src/browser/widgets/react-widget.tsx b/packages/core/src/browser/widgets/react-widget.tsx index 38fe93ce26f6b..5467c7e73d7c5 100644 --- a/packages/core/src/browser/widgets/react-widget.tsx +++ b/packages/core/src/browser/widgets/react-widget.tsx @@ -18,7 +18,7 @@ import * as React from 'react'; import { injectable, unmanaged } from 'inversify'; import { Disposable } from '../../common'; import { BaseWidget, Message } from './widget'; -import { Widget } from '@phosphor/widgets'; +import { Widget } from '@lumino/widgets'; import { createRoot, Root } from 'react-dom/client'; @injectable() diff --git a/packages/core/src/browser/widgets/widget.ts b/packages/core/src/browser/widgets/widget.ts index 74223001670bd..126c2b2414a54 100644 --- a/packages/core/src/browser/widgets/widget.ts +++ b/packages/core/src/browser/widgets/widget.ts @@ -17,20 +17,20 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { injectable, decorate, unmanaged } from 'inversify'; -import { Title, Widget } from '@phosphor/widgets'; -import { Message, MessageLoop } from '@phosphor/messaging'; +import { Title, Widget } from '@lumino/widgets'; +import { Message, MessageLoop } from '@lumino/messaging'; import { Emitter, Event, Disposable, DisposableCollection, MaybePromise, isObject } from '../../common'; import { KeyCode, KeysOrKeyCodes } from '../keyboard/keys'; import PerfectScrollbar from 'perfect-scrollbar'; import { PreviewableWidget } from '../widgets/previewable-widget'; -import { Slot } from '@phosphor/signaling'; +import { Slot } from '@lumino/signaling'; decorate(injectable(), Widget); decorate(unmanaged(), Widget, 0); -export * from '@phosphor/widgets'; -export * from '@phosphor/messaging'; +export * from '@lumino/widgets'; +export * from '@lumino/messaging'; export const ACTION_ITEM = 'action-label'; @@ -62,8 +62,8 @@ export const DEFAULT_SCROLL_OPTIONS: PerfectScrollbar.Options = { }; /** - * At a number of places in the code, we have effectively reimplemented Phosphor's Widget.attach and Widget.detach, - * but omitted the checks that Phosphor expects to be performed for those operations. That is a bad idea, because it + * At a number of places in the code, we have effectively reimplemented Lumino's Widget.attach and Widget.detach, + * but omitted the checks that Lumino expects to be performed for those operations. That is a bad idea, because it * means that we are telling widgets that they are attached or detached when not all the conditions that should apply * do apply. We should explicitly mark those locations so that we know where we should go fix them later. */ diff --git a/packages/core/src/common/json-schema.ts b/packages/core/src/common/json-schema.ts index 04cb90e30e814..a8da194ca2bf9 100644 --- a/packages/core/src/common/json-schema.ts +++ b/packages/core/src/common/json-schema.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { JSONValue } from '@phosphor/coreutils'; +import { JSONValue } from '@lumino/coreutils'; export type JsonType = 'string' | 'array' | 'number' | 'integer' | 'object' | 'boolean' | 'null'; diff --git a/packages/core/src/common/preferences/preference-schema.ts b/packages/core/src/common/preferences/preference-schema.ts index 436a9f82a1d38..f47f7d80fdd13 100644 --- a/packages/core/src/common/preferences/preference-schema.ts +++ b/packages/core/src/common/preferences/preference-schema.ts @@ -16,7 +16,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { JSONValue } from '@phosphor/coreutils'; +import { JSONValue } from '@lumino/coreutils'; import { IJSONSchema } from '../json-schema'; import { PreferenceScope } from './preference-scope'; import { isObject, isString } from '../types'; diff --git a/packages/core/src/electron-browser/menu/electron-menu-contribution.ts b/packages/core/src/electron-browser/menu/electron-menu-contribution.ts index 9023dc2612021..e5e0ab15e81b5 100644 --- a/packages/core/src/electron-browser/menu/electron-menu-contribution.ts +++ b/packages/core/src/electron-browser/menu/electron-menu-contribution.ts @@ -185,16 +185,16 @@ export class ElectronMenuContribution extends BrowserMenuBarContribution impleme /** * Hides the `theia-top-panel` depending on the selected `titleBarStyle`. * The `theia-top-panel` is used as the container of the main, application menu-bar for the - * browser. Native Electron has it's own. + * browser. Native Electron has its own. * By default, this method is called on application `onStart`. */ protected hideTopPanel(app: FrontendApplication): void { const itr = app.shell.children(); let child = itr.next(); - while (child) { + while (!child.done) { // Top panel for the menu contribution is not required for native Electron title bar. - if (child.id === 'theia-top-panel') { - child.setHidden(this.titleBarStyle !== 'custom'); + if (child.value.id === 'theia-top-panel') { + child.value.setHidden(this.titleBarStyle !== 'custom'); break; } else { child = itr.next(); diff --git a/packages/debug/src/browser/breakpoint/breakpoint-marker.ts b/packages/debug/src/browser/breakpoint/breakpoint-marker.ts index 4a65d55379963..c78431c53ad86 100644 --- a/packages/debug/src/browser/breakpoint/breakpoint-marker.ts +++ b/packages/debug/src/browser/breakpoint/breakpoint-marker.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { UUID } from '@theia/core/shared/@phosphor/coreutils'; +import { UUID } from '@theia/core/shared/@lumino/coreutils'; import { Marker } from '@theia/markers/lib/common/marker'; import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol'; import { isObject, isString, URI } from '@theia/core/lib/common'; diff --git a/packages/debug/src/browser/editor/debug-hover-widget.ts b/packages/debug/src/browser/editor/debug-hover-widget.ts index 9c0276a407af7..5246f980d6ba6 100644 --- a/packages/debug/src/browser/editor/debug-hover-widget.ts +++ b/packages/debug/src/browser/editor/debug-hover-widget.ts @@ -16,8 +16,8 @@ import debounce = require('@theia/core/shared/lodash.debounce'); -import { Widget } from '@theia/core/shared/@phosphor/widgets'; -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Widget } from '@theia/core/shared/@lumino/widgets'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import { injectable, postConstruct, inject, Container, interfaces } from '@theia/core/shared/inversify'; import { Key } from '@theia/core/lib/browser'; import { SourceTreeWidget } from '@theia/core/lib/browser/source-tree'; diff --git a/packages/debug/src/node/debug-adapter-session-manager.ts b/packages/debug/src/node/debug-adapter-session-manager.ts index 4f5501b120038..d3709d13a68f6 100644 --- a/packages/debug/src/node/debug-adapter-session-manager.ts +++ b/packages/debug/src/node/debug-adapter-session-manager.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { UUID } from '@theia/core/shared/@phosphor/coreutils'; +import { UUID } from '@theia/core/shared/@lumino/coreutils'; import { injectable, inject } from '@theia/core/shared/inversify'; import { MessagingService } from '@theia/core/lib/node/messaging/messaging-service'; diff --git a/packages/editor-preview/src/browser/style/editor-preview-widget.css b/packages/editor-preview/src/browser/style/editor-preview-widget.css index 16cf4abeda1d4..2ed3170ee696b 100644 --- a/packages/editor-preview/src/browser/style/editor-preview-widget.css +++ b/packages/editor-preview/src/browser/style/editor-preview-widget.css @@ -18,6 +18,6 @@ height: 100%; } -.theia-editor-preview-title-unpinned .p-TabBar-tabLabel { +.theia-editor-preview-title-unpinned .lm-TabBar-tabLabel { font-style: italic; } diff --git a/packages/editor/src/browser/editor-widget.ts b/packages/editor/src/browser/editor-widget.ts index bba055996c5a4..27b7878b8b3ef 100644 --- a/packages/editor/src/browser/editor-widget.ts +++ b/packages/editor/src/browser/editor-widget.ts @@ -17,7 +17,7 @@ import { Disposable, SelectionService, Event, UNTITLED_SCHEME, DisposableCollection } from '@theia/core/lib/common'; import { Widget, BaseWidget, Message, Saveable, SaveableSource, Navigatable, StatefulWidget, lock, TabBar, DockPanel, unlock, ExtractableWidget } from '@theia/core/lib/browser'; import URI from '@theia/core/lib/common/uri'; -import { find } from '@theia/core/shared/@phosphor/algorithm'; +import { find } from '@theia/core/shared/@lumino/algorithm'; import { TextEditor } from './editor'; export class EditorWidget extends BaseWidget implements SaveableSource, Navigatable, StatefulWidget, ExtractableWidget { diff --git a/packages/filesystem/src/browser/file-dialog/file-dialog.ts b/packages/filesystem/src/browser/file-dialog/file-dialog.ts index ab9ece4eb044b..5988d44f3402b 100644 --- a/packages/filesystem/src/browser/file-dialog/file-dialog.ts +++ b/packages/filesystem/src/browser/file-dialog/file-dialog.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'; -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import { Disposable, MaybeArray, nls } from '@theia/core/lib/common'; import { AbstractDialog, DialogProps, setEnabled, createIconButton, Widget, codiconArray, Key, LabelProvider } from '@theia/core/lib/browser'; import { FileStatNode } from '../file-tree'; @@ -24,7 +24,7 @@ import { FileDialogModel } from './file-dialog-model'; import { FileDialogWidget } from './file-dialog-widget'; import { FileDialogTreeFiltersRenderer, FileDialogTreeFilters, FileDialogTreeFiltersRendererFactory } from './file-dialog-tree-filters-renderer'; import URI from '@theia/core/lib/common/uri'; -import { Panel } from '@theia/core/shared/@phosphor/widgets'; +import { Panel } from '@theia/core/shared/@lumino/widgets'; import * as DOMPurify from '@theia/core/shared/dompurify'; import { FileDialogHiddenFilesToggleRenderer, HiddenFilesToggleRendererFactory } from './file-dialog-hidden-files-renderer'; diff --git a/packages/filesystem/src/browser/style/file-icons.css b/packages/filesystem/src/browser/style/file-icons.css index efbc614c3a457..182d4718f6e88 100644 --- a/packages/filesystem/src/browser/style/file-icons.css +++ b/packages/filesystem/src/browser/style/file-icons.css @@ -27,7 +27,7 @@ font-size: calc(var(--theia-content-font-size) * 0.8); } -.p-TabBar-tabIcon.theia-file-icons-js.file-icon { +.lm-TabBar-tabIcon.theia-file-icons-js.file-icon { padding-left: 1px !important; padding-right: 3px !important; } diff --git a/packages/git/src/browser/history/git-commit-detail-widget.tsx b/packages/git/src/browser/history/git-commit-detail-widget.tsx index 3f04cf7bea56b..e5ec03f1c44d5 100644 --- a/packages/git/src/browser/history/git-commit-detail-widget.tsx +++ b/packages/git/src/browser/history/git-commit-detail-widget.tsx @@ -16,7 +16,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'; import { BaseWidget, Widget, StatefulWidget, Panel, PanelLayout, MessageLoop, codicon diff --git a/packages/git/src/browser/history/git-opener-in-secondary-area.ts b/packages/git/src/browser/history/git-opener-in-secondary-area.ts index aedf12fab2cbe..b679798ef8181 100644 --- a/packages/git/src/browser/history/git-opener-in-secondary-area.ts +++ b/packages/git/src/browser/history/git-opener-in-secondary-area.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { inject, injectable } from '@theia/core/shared/inversify'; -import { Widget } from '@theia/core/shared/@phosphor/widgets'; +import { Widget } from '@theia/core/shared/@lumino/widgets'; import { EditorManager } from '@theia/editor/lib/browser/editor-manager'; import { GitResourceOpener } from '../diff/git-resource-opener'; import URI from '@theia/core/lib/common/uri'; diff --git a/packages/markers/src/browser/problem/problem-tabbar-decorator.ts b/packages/markers/src/browser/problem/problem-tabbar-decorator.ts index 577f7bc71522b..f354a373a6b83 100644 --- a/packages/markers/src/browser/problem/problem-tabbar-decorator.ts +++ b/packages/markers/src/browser/problem/problem-tabbar-decorator.ts @@ -17,7 +17,7 @@ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; import { Diagnostic, DiagnosticSeverity } from '@theia/core/shared/vscode-languageserver-protocol'; import { Event, Emitter } from '@theia/core/lib/common/event'; -import { Title, Widget } from '@theia/core/shared/@phosphor/widgets'; +import { Title, Widget } from '@theia/core/shared/@lumino/widgets'; import { WidgetDecoration } from '@theia/core/lib/browser/widget-decoration'; import { TabBarDecorator } from '@theia/core/lib/browser/shell/tab-bar-decorator'; import { Marker } from '../../common/marker'; diff --git a/packages/memory-inspector/src/browser/wrapper-widgets/memory-layout-widget.tsx b/packages/memory-inspector/src/browser/wrapper-widgets/memory-layout-widget.tsx index b37aee0da1ba3..bdb4d463f5df2 100644 --- a/packages/memory-inspector/src/browser/wrapper-widgets/memory-layout-widget.tsx +++ b/packages/memory-inspector/src/browser/wrapper-widgets/memory-layout-widget.tsx @@ -97,8 +97,8 @@ export class MemoryLayoutWidget extends Panel implements Disposable, Application protected dockPanelHoldsWidgets(): boolean { const iter = this.dockPanel.tabBars(); let tabBar = iter.next(); - while (tabBar) { - if (tabBar.titles.length) { + while (!tabBar.done) { + if (tabBar.value.titles.length) { return true; } tabBar = iter.next(); @@ -135,14 +135,8 @@ export class MemoryLayoutWidget extends Panel implements Disposable, Application } getTrackableWidgets(): Widget[] { - const children: Widget[] = []; const childIterator = this.dockPanel.children(); - let currentChild = childIterator.next(); - while (currentChild) { - children.push(currentChild); - currentChild = childIterator.next(); - } - return children; + return Array.from(childIterator); } activateWidget(id: string): Widget | undefined { diff --git a/packages/metrics/src/browser/metrics-frontend-application-contribution.ts b/packages/metrics/src/browser/metrics-frontend-application-contribution.ts index 177ad53f37ad6..f36318e98feef 100644 --- a/packages/metrics/src/browser/metrics-frontend-application-contribution.ts +++ b/packages/metrics/src/browser/metrics-frontend-application-contribution.ts @@ -16,7 +16,7 @@ import { inject, injectable } from '@theia/core/shared/inversify'; import { FrontendApplicationContribution } from '@theia/core/lib/browser'; import { ILogger, LogLevel, MeasurementResult, Stopwatch } from '@theia/core'; -import { UUID } from '@theia/core/shared/@phosphor/coreutils'; +import { UUID } from '@theia/core/shared/@lumino/coreutils'; import { MeasurementNotificationService } from '../common'; @injectable() diff --git a/packages/mini-browser/src/browser/mini-browser-content.ts b/packages/mini-browser/src/browser/mini-browser-content.ts index ab402e906d79a..54ed060c0b559 100644 --- a/packages/mini-browser/src/browser/mini-browser-content.ts +++ b/packages/mini-browser/src/browser/mini-browser-content.ts @@ -16,7 +16,7 @@ import * as PDFObject from 'pdfobject'; import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import URI from '@theia/core/lib/common/uri'; import { ILogger } from '@theia/core/lib/common/logger'; import { Emitter } from '@theia/core/lib/common/event'; diff --git a/packages/mini-browser/src/browser/mini-browser-open-handler.ts b/packages/mini-browser/src/browser/mini-browser-open-handler.ts index 969a78b24a589..761843e90e051 100644 --- a/packages/mini-browser/src/browser/mini-browser-open-handler.ts +++ b/packages/mini-browser/src/browser/mini-browser-open-handler.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { Widget } from '@theia/core/shared/@phosphor/widgets'; +import { Widget } from '@theia/core/shared/@lumino/widgets'; import { injectable, inject, optional } from '@theia/core/shared/inversify'; import URI from '@theia/core/lib/common/uri'; import { MaybePromise } from '@theia/core/lib/common/types'; @@ -75,10 +75,10 @@ export class MiniBrowserOpenHandler extends NavigatableWidgetOpenHandler = new Map(); diff --git a/packages/mini-browser/src/browser/mini-browser.ts b/packages/mini-browser/src/browser/mini-browser.ts index 9e8fc0c6cac21..171b511aef72a 100644 --- a/packages/mini-browser/src/browser/mini-browser.ts +++ b/packages/mini-browser/src/browser/mini-browser.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import URI from '@theia/core/lib/common/uri'; import { NavigatableWidget, StatefulWidget } from '@theia/core/lib/browser'; import { DisposableCollection } from '@theia/core/lib/common/disposable'; diff --git a/packages/monaco/src/browser/monaco-context-menu.ts b/packages/monaco/src/browser/monaco-context-menu.ts index ad4f7239de0d2..c1d93e5f8764e 100644 --- a/packages/monaco/src/browser/monaco-context-menu.ts +++ b/packages/monaco/src/browser/monaco-context-menu.ts @@ -18,8 +18,8 @@ import { injectable, inject } from '@theia/core/shared/inversify'; import { MenuPath } from '@theia/core/lib/common/menu'; import { EDITOR_CONTEXT_MENU } from '@theia/editor/lib/browser'; import { Anchor, ContextMenuRenderer, Coordinate } from '@theia/core/lib/browser'; -import { Menu } from '@theia/core/shared/@phosphor/widgets'; -import { CommandRegistry } from '@theia/core/shared/@phosphor/commands'; +import { Menu } from '@theia/core/shared/@lumino/widgets'; +import { CommandRegistry } from '@theia/core/shared/@lumino/commands'; import { IContextMenuService } from '@theia/monaco-editor-core/esm/vs/platform/contextview/browser/contextView'; import { IContextMenuDelegate } from '@theia/monaco-editor-core/esm/vs/base/browser/contextmenu'; import { MenuItemAction } from '@theia/monaco-editor-core/esm/vs/platform/actions/common/actions'; diff --git a/packages/monaco/src/browser/monaco-editor.ts b/packages/monaco/src/browser/monaco-editor.ts index 069e5ae66b4cf..0ae01dd37270b 100644 --- a/packages/monaco/src/browser/monaco-editor.ts +++ b/packages/monaco/src/browser/monaco-editor.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { injectable, inject, unmanaged } from '@theia/core/shared/inversify'; -import { ElementExt } from '@theia/core/shared/@phosphor/domutils'; +import { ElementExt } from '@theia/core/shared/@lumino/domutils'; import URI from '@theia/core/lib/common/uri'; import { ContextKeyService } from '@theia/core/lib/browser/context-key-service'; import { DisposableCollection, Disposable, Emitter, Event, nullToUndefined, MaybeNull } from '@theia/core/lib/common'; diff --git a/packages/monaco/src/browser/simple-monaco-editor.ts b/packages/monaco/src/browser/simple-monaco-editor.ts index 5c862b81fba94..7c15fbe79f4c2 100644 --- a/packages/monaco/src/browser/simple-monaco-editor.ts +++ b/packages/monaco/src/browser/simple-monaco-editor.ts @@ -24,7 +24,7 @@ import { Disposable, DisposableCollection, Emitter, TextDocumentContentChangeDel import { MonacoEditorModel } from './monaco-editor-model'; import { Dimension, EditorMouseEvent, MouseTarget, Position, TextDocumentChangeEvent } from '@theia/editor/lib/browser'; import * as monaco from '@theia/monaco-editor-core'; -import { ElementExt } from '@theia/core/shared/@phosphor/domutils'; +import { ElementExt } from '@theia/core/shared/@lumino/domutils'; import { Selection } from '@theia/editor/lib/browser/editor'; import { SelectionDirection } from '@theia/monaco-editor-core/esm/vs/editor/common/core/selection'; diff --git a/packages/monaco/src/browser/style/index.css b/packages/monaco/src/browser/style/index.css index d03b5b4043382..4bf8df142a609 100644 --- a/packages/monaco/src/browser/style/index.css +++ b/packages/monaco/src/browser/style/index.css @@ -13,7 +13,7 @@ /* * set z-index to 0, so tabs are not above overlay widgets */ -.p-TabBar.theia-app-centers { +.lm-TabBar.theia-app-centers { z-index: 0; display: flex; } diff --git a/packages/navigator/src/browser/navigator-widget.tsx b/packages/navigator/src/browser/navigator-widget.tsx index e8d2b0a9f6cb7..7350e4b567415 100644 --- a/packages/navigator/src/browser/navigator-widget.tsx +++ b/packages/navigator/src/browser/navigator-widget.tsx @@ -15,7 +15,7 @@ // ***************************************************************************** import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'; -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import URI from '@theia/core/lib/common/uri'; import { CommandService } from '@theia/core/lib/common'; import { Key, TreeModel, ContextMenuRenderer, ExpandableTreeNode, TreeProps, TreeNode } from '@theia/core/lib/browser'; diff --git a/packages/navigator/src/browser/style/index.css b/packages/navigator/src/browser/style/index.css index f298d89fe663a..b3a848243fdeb 100644 --- a/packages/navigator/src/browser/style/index.css +++ b/packages/navigator/src/browser/style/index.css @@ -36,7 +36,7 @@ text-align: center; } -.p-Widget .open-workspace-button { +.lm-Widget .open-workspace-button { padding: 4px 12px; width: calc(100% - var(--theia-ui-padding) * 4); margin-left: 0; diff --git a/packages/outline-view/src/browser/outline-view-service.ts b/packages/outline-view/src/browser/outline-view-service.ts index dd2f58465a0f7..8d80849586ffe 100644 --- a/packages/outline-view/src/browser/outline-view-service.ts +++ b/packages/outline-view/src/browser/outline-view-service.ts @@ -18,7 +18,7 @@ import { injectable, inject } from '@theia/core/shared/inversify'; import { Event, Emitter, DisposableCollection } from '@theia/core'; import { WidgetFactory } from '@theia/core/lib/browser'; import { OutlineViewWidget, OutlineViewWidgetFactory, OutlineSymbolInformationNode } from './outline-view-widget'; -import { Widget } from '@theia/core/shared/@phosphor/widgets'; +import { Widget } from '@theia/core/shared/@lumino/widgets'; @injectable() export class OutlineViewService implements WidgetFactory { diff --git a/packages/outline-view/src/browser/outline-view-widget.tsx b/packages/outline-view/src/browser/outline-view-widget.tsx index 8e9d2c4820c52..2030b4488871f 100644 --- a/packages/outline-view/src/browser/outline-view-widget.tsx +++ b/packages/outline-view/src/browser/outline-view-widget.tsx @@ -28,7 +28,7 @@ import { codicon } from '@theia/core/lib/browser'; import { OutlineViewTreeModel } from './outline-view-tree-model'; -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import { Emitter, Event, isObject, Mutable, UriSelection } from '@theia/core'; import * as React from '@theia/core/shared/react'; import { Range } from '@theia/core/shared/vscode-languageserver-protocol'; diff --git a/packages/output/src/browser/output-widget.ts b/packages/output/src/browser/output-widget.ts index 21a5762bd7008..a0b6d8c6096b8 100644 --- a/packages/output/src/browser/output-widget.ts +++ b/packages/output/src/browser/output-widget.ts @@ -16,7 +16,7 @@ import '../../src/browser/style/output.css'; import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; -import { toArray } from '@theia/core/shared/@phosphor/algorithm'; +import { toArray } from '@theia/core/shared/@lumino/algorithm'; import { EditorWidget } from '@theia/editor/lib/browser'; import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor'; import { SelectionService } from '@theia/core/lib/common/selection-service'; diff --git a/packages/plugin-dev/src/browser/hosted-plugin-controller.ts b/packages/plugin-dev/src/browser/hosted-plugin-controller.ts index e9dcca59e9be9..dacd656c4e736 100644 --- a/packages/plugin-dev/src/browser/hosted-plugin-controller.ts +++ b/packages/plugin-dev/src/browser/hosted-plugin-controller.ts @@ -18,8 +18,8 @@ import { injectable, inject } from '@theia/core/shared/inversify'; import { StatusBar } from '@theia/core/lib/browser/status-bar/status-bar'; import { StatusBarAlignment, StatusBarEntry, FrontendApplicationContribution, PreferenceServiceImpl, PreferenceChange, codicon } from '@theia/core/lib/browser'; import { MessageService } from '@theia/core/lib/common'; -import { CommandRegistry } from '@theia/core/shared/@phosphor/commands'; -import { Menu } from '@theia/core/shared/@phosphor/widgets'; +import { CommandRegistry } from '@theia/core/shared/@lumino/commands'; +import { Menu } from '@theia/core/shared/@lumino/widgets'; import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state'; import { ConnectionStatusService, ConnectionStatus } from '@theia/core/lib/browser/connection-status-service'; import { PluginDevServer } from '../common/plugin-dev-protocol'; @@ -305,7 +305,7 @@ export class HostedPluginController implements FrontendApplicationContribution { protected addCommandsForRunningPlugin(commands: CommandRegistry, menu: Menu): void { commands.addCommand(HostedPluginCommands.STOP.id, { label: nls.localize('theia/plugin-dev/stopInstance', 'Stop Instance'), - icon: codicon('debug-stop'), + iconClass: codicon('debug-stop'), execute: () => setTimeout(() => this.hostedPluginManagerClient.stop(), 100) }); @@ -316,7 +316,7 @@ export class HostedPluginController implements FrontendApplicationContribution { commands.addCommand(HostedPluginCommands.RESTART.id, { label: nls.localize('theia/plugin-dev/restartInstance', 'Restart Instance'), - icon: codicon('debug-restart'), + iconClass: codicon('debug-restart'), execute: () => setTimeout(() => this.hostedPluginManagerClient.restart(), 100) }); @@ -332,7 +332,7 @@ export class HostedPluginController implements FrontendApplicationContribution { protected addCommandsForStoppedPlugin(commands: CommandRegistry, menu: Menu): void { commands.addCommand(HostedPluginCommands.START.id, { label: nls.localize('theia/plugin-dev/startInstance', 'Start Instance'), - icon: codicon('play'), + iconClass: codicon('play'), execute: () => setTimeout(() => this.hostedPluginManagerClient.start(), 100) }); @@ -343,7 +343,7 @@ export class HostedPluginController implements FrontendApplicationContribution { commands.addCommand(HostedPluginCommands.DEBUG.id, { label: nls.localize('theia/plugin-dev/debugInstance', 'Debug Instance'), - icon: codicon('debug'), + iconClass: codicon('debug'), execute: () => setTimeout(() => this.hostedPluginManagerClient.debug(), 100) }); diff --git a/packages/plugin-ext/src/main/browser/custom-editors/custom-editor-widget.ts b/packages/plugin-ext/src/main/browser/custom-editors/custom-editor-widget.ts index ac804199fc89b..91a51fb5feeff 100644 --- a/packages/plugin-ext/src/main/browser/custom-editors/custom-editor-widget.ts +++ b/packages/plugin-ext/src/main/browser/custom-editors/custom-editor-widget.ts @@ -29,7 +29,6 @@ export class CustomEditorWidget extends WebviewWidget implements CustomEditorWid static override FACTORY_ID = 'plugin-custom-editor'; static readonly SIDE_BY_SIDE_FACTORY_ID = CustomEditorWidget.FACTORY_ID + '.side-by-side'; - override id: string; resource: URI; protected _modelRef: Reference = { object: undefined, dispose: () => { } }; diff --git a/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts b/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts index 356e1b441ff79..8d25e648ddd5d 100644 --- a/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts +++ b/packages/plugin-ext/src/main/browser/dialogs/modal-notification.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** import { injectable } from '@theia/core/shared/inversify'; -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import { codiconArray, Key } from '@theia/core/lib/browser'; import { AbstractDialog } from '@theia/core/lib/browser/dialogs'; import '../../../../src/main/browser/dialogs/style/modal-notification.css'; diff --git a/packages/plugin-ext/src/main/browser/plugin-ext-widget.tsx b/packages/plugin-ext/src/main/browser/plugin-ext-widget.tsx index be17fc1966b40..815ddc2acc731 100644 --- a/packages/plugin-ext/src/main/browser/plugin-ext-widget.tsx +++ b/packages/plugin-ext/src/main/browser/plugin-ext-widget.tsx @@ -16,7 +16,7 @@ import * as React from '@theia/core/shared/react'; import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'; -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import { PluginMetadata } from '../../common/plugin-protocol'; import { ReactWidget } from '@theia/core/lib/browser/widgets/react-widget'; import { AlertMessage } from '@theia/core/lib/browser/widgets/alert-message'; diff --git a/packages/plugin-ext/src/main/browser/style/index.css b/packages/plugin-ext/src/main/browser/style/index.css index a8ba00ae4400d..71f7cd5f20470 100644 --- a/packages/plugin-ext/src/main/browser/style/index.css +++ b/packages/plugin-ext/src/main/browser/style/index.css @@ -62,16 +62,16 @@ display: inline-block; } -.p-TabBar.theia-app-sides .theia-plugin-file-icon, -.p-TabBar.theia-app-sides .theia-plugin-file-icon::before, -.p-TabBar.theia-app-sides .theia-plugin-folder-icon, -.p-TabBar.theia-app-sides .theia-plugin-folder-icon::before, -.p-TabBar.theia-app-sides .theia-plugin-folder-expanded-icon, -.p-TabBar.theia-app-sides .theia-plugin-folder-expanded-icon::before, -.p-TabBar.theia-app-sides .theia-plugin-root-folder-icon, -.p-TabBar.theia-app-sides .theia-plugin-root-folder-icon::before, -.p-TabBar.theia-app-sides .theia-plugin-root-folder-expanded-icon, -.p-TabBar.theia-app-sides .theia-plugin-root-folder-expanded-icon::before { +.lm-TabBar.theia-app-sides .theia-plugin-file-icon, +.lm-TabBar.theia-app-sides .theia-plugin-file-icon::before, +.lm-TabBar.theia-app-sides .theia-plugin-folder-icon, +.lm-TabBar.theia-app-sides .theia-plugin-folder-icon::before, +.lm-TabBar.theia-app-sides .theia-plugin-folder-expanded-icon, +.lm-TabBar.theia-app-sides .theia-plugin-folder-expanded-icon::before, +.lm-TabBar.theia-app-sides .theia-plugin-root-folder-icon, +.lm-TabBar.theia-app-sides .theia-plugin-root-folder-icon::before, +.lm-TabBar.theia-app-sides .theia-plugin-root-folder-expanded-icon, +.lm-TabBar.theia-app-sides .theia-plugin-root-folder-expanded-icon::before { padding: 0px !important; width: var(--theia-private-sidebar-icon-size) !important; height: var(--theia-private-sidebar-icon-size) !important; diff --git a/packages/plugin-ext/src/main/browser/style/webview.css b/packages/plugin-ext/src/main/browser/style/webview.css index 41db9cf7d7488..654bc965a1196 100644 --- a/packages/plugin-ext/src/main/browser/style/webview.css +++ b/packages/plugin-ext/src/main/browser/style/webview.css @@ -14,7 +14,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 ********************************************************************************/ -.theia-webview.p-mod-hidden { +.theia-webview.lm-mod-hidden { visibility: hidden; display: flex !important; } @@ -48,7 +48,7 @@ content: ""; } -.p-TabBar.theia-app-sides .theia-webview-icon::before { +.lm-TabBar.theia-app-sides .theia-webview-icon::before { width: var(--theia-private-sidebar-icon-size); height: var(--theia-private-sidebar-icon-size); background-size: contain; diff --git a/packages/plugin-ext/src/main/browser/tabs/tabs-main.ts b/packages/plugin-ext/src/main/browser/tabs/tabs-main.ts index 6d95564e771ee..a01fb22d5d1c6 100644 --- a/packages/plugin-ext/src/main/browser/tabs/tabs-main.ts +++ b/packages/plugin-ext/src/main/browser/tabs/tabs-main.ts @@ -68,7 +68,7 @@ export class TabsMainImpl implements TabsMain, Disposable { this.createTabsModel(); const tabBars = this.applicationShell.mainPanel.tabBars(); - for (let tabBar: TabBar | undefined; tabBar = tabBars.next();) { + for (const tabBar of tabBars) { this.attachListenersToTabBar(tabBar); } diff --git a/packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts b/packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts index 58dcd9457acd2..707038c991465 100644 --- a/packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts +++ b/packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts @@ -235,9 +235,11 @@ export class PluginViewRegistry implements FrontendApplicationContribution { }); }; - hookDockPanelKey(this.shell.leftPanelHandler.dockPanel, this.viewContextKeys.activeViewlet); - hookDockPanelKey(this.shell.rightPanelHandler.dockPanel, this.viewContextKeys.activeAuxiliary); - hookDockPanelKey(this.shell.bottomPanel, this.viewContextKeys.activePanel); + this.shell.initialized.then(() => { + hookDockPanelKey(this.shell.leftPanelHandler.dockPanel, this.viewContextKeys.activeViewlet); + hookDockPanelKey(this.shell.rightPanelHandler.dockPanel, this.viewContextKeys.activeAuxiliary); + hookDockPanelKey(this.shell.bottomPanel, this.viewContextKeys.activePanel); + }); } protected async updateViewWelcomeVisibility(viewId: string): Promise { diff --git a/packages/plugin-ext/src/main/browser/view/plugin-view-widget.ts b/packages/plugin-ext/src/main/browser/view/plugin-view-widget.ts index a7c755d6516d5..cea05dc03c42b 100644 --- a/packages/plugin-ext/src/main/browser/view/plugin-view-widget.ts +++ b/packages/plugin-ext/src/main/browser/view/plugin-view-widget.ts @@ -15,11 +15,11 @@ // ***************************************************************************** import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'; -import { Panel, Widget } from '@theia/core/shared/@phosphor/widgets'; +import { Panel, Widget } from '@theia/core/shared/@lumino/widgets'; import { MenuModelRegistry } from '@theia/core/lib/common/menu'; import { CommandRegistry } from '@theia/core/lib/common/command'; import { StatefulWidget } from '@theia/core/lib/browser/shell/shell-layout-restorer'; -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import { TreeViewWidget } from './tree-view-widget'; import { BadgeWidget, DescriptionWidget, DynamicToolbarWidget } from '@theia/core/lib/browser/view-container'; import { DisposableCollection, Emitter, Event } from '@theia/core/lib/common'; diff --git a/packages/plugin-ext/src/main/browser/webview/webview.ts b/packages/plugin-ext/src/main/browser/webview/webview.ts index 9ed8585bfc91d..af7b8a8222e23 100644 --- a/packages/plugin-ext/src/main/browser/webview/webview.ts +++ b/packages/plugin-ext/src/main/browser/webview/webview.ts @@ -21,7 +21,7 @@ // copied and modified from https://github.com/microsoft/vscode/blob/ba40bd16433d5a817bfae15f3b4350e18f144af4/src/vs/workbench/contrib/webview/browser/webviewElement.ts# import * as mime from 'mime'; -import { JSONExt } from '@theia/core/shared/@phosphor/coreutils'; +import { JSONExt } from '@theia/core/shared/@lumino/coreutils'; import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'; import { WebviewPanelOptions, WebviewPortMapping } from '@theia/plugin'; import { BaseWidget, Message } from '@theia/core/lib/browser/widgets/widget'; diff --git a/packages/plugin-ext/src/main/browser/webviews-main.ts b/packages/plugin-ext/src/main/browser/webviews-main.ts index c282979ec12d6..ce1871a2cccc6 100644 --- a/packages/plugin-ext/src/main/browser/webviews-main.ts +++ b/packages/plugin-ext/src/main/browser/webviews-main.ts @@ -25,7 +25,7 @@ import { WebviewWidget, WebviewWidgetIdentifier } from './webview/webview'; import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable'; import { ViewColumnService } from '@theia/core/lib/browser/shell/view-column-service'; import { WidgetManager } from '@theia/core/lib/browser/widget-manager'; -import { JSONExt } from '@theia/core/shared/@phosphor/coreutils'; +import { JSONExt } from '@theia/core/shared/@lumino/coreutils'; import { Mutable } from '@theia/core/lib/common/types'; import { HostedPluginSupport } from '../../hosted/browser/hosted-plugin'; import { IconUrl } from '../../common/plugin-protocol'; diff --git a/packages/plugin-ext/src/plugin/status-bar/status-bar-item.ts b/packages/plugin-ext/src/plugin/status-bar/status-bar-item.ts index 3c126e6eb9330..74f7ab3ca1906 100644 --- a/packages/plugin-ext/src/plugin/status-bar/status-bar-item.ts +++ b/packages/plugin-ext/src/plugin/status-bar/status-bar-item.ts @@ -16,7 +16,7 @@ import * as theia from '@theia/plugin'; import { ThemeColor, StatusBarAlignment } from '../types-impl'; import { StatusBarMessageRegistryMain } from '../../common/plugin-api-rpc'; -import { UUID } from '@theia/core/shared/@phosphor/coreutils'; +import { UUID } from '@theia/core/shared/@lumino/coreutils'; export class StatusBarItemImpl implements theia.StatusBarItem { diff --git a/packages/plugin-ext/src/plugin/tasks/tasks.ts b/packages/plugin-ext/src/plugin/tasks/tasks.ts index 4aecc67a3e51d..e393fa4d5a326 100644 --- a/packages/plugin-ext/src/plugin/tasks/tasks.ts +++ b/packages/plugin-ext/src/plugin/tasks/tasks.ts @@ -28,7 +28,7 @@ import { RPCProtocol } from '../../common/rpc-protocol'; import { TaskProviderAdapter } from './task-provider'; import { Emitter, Event } from '@theia/core/lib/common/event'; import { TerminalServiceExtImpl } from '../terminal-ext'; -import { UUID } from '@theia/core/shared/@phosphor/coreutils'; +import { UUID } from '@theia/core/shared/@lumino/coreutils'; import { CancellationToken } from '@theia/core/lib/common/cancellation'; type ExecutionCallback = (resolvedDefinition: theia.TaskDefinition) => Thenable; diff --git a/packages/plugin-ext/src/plugin/terminal-ext.ts b/packages/plugin-ext/src/plugin/terminal-ext.ts index ba849bc9fb305..568fd2021cfb5 100644 --- a/packages/plugin-ext/src/plugin/terminal-ext.ts +++ b/packages/plugin-ext/src/plugin/terminal-ext.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { UUID } from '@theia/core/shared/@phosphor/coreutils'; +import { UUID } from '@theia/core/shared/@lumino/coreutils'; import { inject, injectable } from '@theia/core/shared/inversify'; import { TerminalServiceExt, TerminalServiceMain, PLUGIN_RPC_CONTEXT, Plugin, TerminalOptions } from '../common/plugin-api-rpc'; import { RPCProtocol } from '../common/rpc-protocol'; diff --git a/packages/plugin-ext/src/plugin/types-impl.ts b/packages/plugin-ext/src/plugin/types-impl.ts index 0e48a1c876e0a..b9804d5ad3495 100644 --- a/packages/plugin-ext/src/plugin/types-impl.ts +++ b/packages/plugin-ext/src/plugin/types-impl.ts @@ -21,7 +21,7 @@ /* eslint-disable no-null/no-null */ -import { UUID } from '@theia/core/shared/@phosphor/coreutils'; +import { UUID } from '@theia/core/shared/@lumino/coreutils'; import { illegalArgument } from '../common/errors'; import type * as theia from '@theia/plugin'; import { URI as CodeURI, UriComponents } from '@theia/core/shared/vscode-uri'; diff --git a/packages/preferences/src/browser/style/index.css b/packages/preferences/src/browser/style/index.css index dd598700451c9..64b0ac5596f67 100644 --- a/packages/preferences/src/browser/style/index.css +++ b/packages/preferences/src/browser/style/index.css @@ -14,11 +14,11 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 ********************************************************************************/ -#preferences_container_widget .p-SplitPanel-handle { +#preferences_container_widget .lm-SplitPanel-handle { border-right: var(--theia-border-width) solid var(--theia-editorGroup-border); } -#preferences_container_widget .p-TabBar-tabIcon { +#preferences_container_widget .lm-TabBar-tabIcon { align-items: center; display: flex; line-height: var(--theia-content-line-height) !important; @@ -78,7 +78,7 @@ .theia-settings-container .preferences-tabbar-widget .preferences-scope-tab - .p-TabBar-tabIcon:not(.preferences-folder-dropdown-icon) { + .lm-TabBar-tabIcon:not(.preferences-folder-dropdown-icon) { display: none; } @@ -96,10 +96,6 @@ #theia-main-content-panel .theia-settings-container .tabbar-underline { width: 100%; position: absolute; - top: calc( - var(--theia-private-horizontal-tab-height) + - var(--theia-private-horizontal-tab-scrollbar-rail-height) / 2 - 1px - ); border-top: 1px solid var(--theia-tab-unfocusedInactiveForeground); z-index: -1; } @@ -121,7 +117,7 @@ #theia-main-content-panel .theia-settings-container #preferences-scope-tab-bar - .preferences-scope-tab.p-mod-current { + .preferences-scope-tab.lm-mod-current { color: var(--theia-panelTitle-activeForeground); border-bottom: var(--theia-border-width) solid var(--theia-panelTitle-activeBorder); @@ -130,7 +126,7 @@ #theia-main-content-panel .theia-settings-container #preferences-scope-tab-bar - .preferences-scope-tab.p-mod-current:not(.theia-mod-active) { + .preferences-scope-tab.lm-mod-current:not(.theia-mod-active) { border-top: unset; } @@ -138,7 +134,7 @@ .theia-settings-container #preferences-scope-tab-bar .preferences-scope-tab.preferences-folder-tab - .p-TabBar-tabLabel::after { + .lm-TabBar-tabLabel::after { content: "Folder"; padding-left: 4px; font-size: 0.8em; diff --git a/packages/preferences/src/browser/util/preference-types.ts b/packages/preferences/src/browser/util/preference-types.ts index bf4a81521548c..58adcb95bbd31 100644 --- a/packages/preferences/src/browser/util/preference-types.ts +++ b/packages/preferences/src/browser/util/preference-types.ts @@ -24,7 +24,7 @@ import { CommonCommands, } from '@theia/core/lib/browser'; import { Command, MenuPath } from '@theia/core'; -import { JSONValue } from '@theia/core/shared/@phosphor/coreutils'; +import { JSONValue } from '@theia/core/shared/@lumino/coreutils'; import { JsonType } from '@theia/core/lib/common/json-schema'; export namespace Preference { diff --git a/packages/preferences/src/browser/views/components/preference-json-input.ts b/packages/preferences/src/browser/views/components/preference-json-input.ts index 4839100b93155..44094f5cc3b9d 100644 --- a/packages/preferences/src/browser/views/components/preference-json-input.ts +++ b/packages/preferences/src/browser/views/components/preference-json-input.ts @@ -18,7 +18,7 @@ import { PreferenceLeafNodeRenderer, PreferenceNodeRenderer } from './preference import { injectable, inject, interfaces } from '@theia/core/shared/inversify'; import { CommandService, nls } from '@theia/core/lib/common'; import { Preference, PreferencesCommands } from '../../util/preference-types'; -import { JSONValue } from '@theia/core/shared/@phosphor/coreutils'; +import { JSONValue } from '@theia/core/shared/@lumino/coreutils'; import { PreferenceLeafNodeRendererContribution } from './preference-node-renderer-creator'; @injectable() diff --git a/packages/preferences/src/browser/views/components/preference-node-renderer.ts b/packages/preferences/src/browser/views/components/preference-node-renderer.ts index 35fff31db55ef..62ef3eca42bbf 100644 --- a/packages/preferences/src/browser/views/components/preference-node-renderer.ts +++ b/packages/preferences/src/browser/views/components/preference-node-renderer.ts @@ -23,7 +23,7 @@ import { Preference, PreferenceMenus } from '../../util/preference-types'; import { PreferenceTreeLabelProvider } from '../../util/preference-tree-label-provider'; import { PreferencesScopeTabBar } from '../preference-scope-tabbar-widget'; import { Disposable, nls } from '@theia/core/lib/common'; -import { JSONValue } from '@theia/core/shared/@phosphor/coreutils'; +import { JSONValue } from '@theia/core/shared/@lumino/coreutils'; import debounce = require('@theia/core/shared/lodash.debounce'); import { PreferenceTreeModel } from '../../preference-tree-model'; import { PreferencesSearchbarWidget } from '../preference-searchbar-widget'; diff --git a/packages/preferences/src/browser/views/components/preference-select-input.ts b/packages/preferences/src/browser/views/components/preference-select-input.ts index 81a806a2f7bc0..384d91005157d 100644 --- a/packages/preferences/src/browser/views/components/preference-select-input.ts +++ b/packages/preferences/src/browser/views/components/preference-select-input.ts @@ -16,7 +16,7 @@ import { PreferenceLeafNodeRenderer, PreferenceNodeRenderer } from './preference-node-renderer'; import { injectable, interfaces } from '@theia/core/shared/inversify'; -import { JSONValue } from '@theia/core/shared/@phosphor/coreutils'; +import { JSONValue } from '@theia/core/shared/@lumino/coreutils'; import { PreferenceProvider } from '@theia/core/lib/browser/preferences/preference-provider'; import { SelectComponent, SelectOption } from '@theia/core/lib/browser/widgets/select-component'; import { Preference } from '../../util/preference-types'; diff --git a/packages/preferences/src/browser/views/preference-scope-tabbar-widget.tsx b/packages/preferences/src/browser/views/preference-scope-tabbar-widget.tsx index 34744ec87de61..2aab5fbb97c97 100644 --- a/packages/preferences/src/browser/views/preference-scope-tabbar-widget.tsx +++ b/packages/preferences/src/browser/views/preference-scope-tabbar-widget.tsx @@ -15,7 +15,7 @@ // ***************************************************************************** import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; -import { TabBar, Widget, Title } from '@theia/core/shared/@phosphor/widgets'; +import { TabBar, Widget, Title } from '@theia/core/shared/@lumino/widgets'; import { PreferenceScope, Message, ContextMenuRenderer, LabelProvider, StatefulWidget, codicon } from '@theia/core/lib/browser'; import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service'; import URI from '@theia/core/lib/common/uri'; diff --git a/packages/preview/src/browser/preview-contribution.ts b/packages/preview/src/browser/preview-contribution.ts index 048af03188dbf..95779d182bc78 100644 --- a/packages/preview/src/browser/preview-contribution.ts +++ b/packages/preview/src/browser/preview-contribution.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { injectable, inject } from '@theia/core/shared/inversify'; -import { Widget } from '@theia/core/shared/@phosphor/widgets'; +import { Widget } from '@theia/core/shared/@lumino/widgets'; import { FrontendApplicationContribution, WidgetOpenerOptions, NavigatableWidgetOpenHandler, codicon } from '@theia/core/lib/browser'; import { EditorManager, TextEditor, EditorWidget, EditorContextMenu } from '@theia/editor/lib/browser'; import { DisposableCollection, CommandContribution, CommandRegistry, Command, MenuContribution, MenuModelRegistry, Disposable } from '@theia/core/lib/common'; diff --git a/packages/property-view/src/browser/property-view-widget.tsx b/packages/property-view/src/browser/property-view-widget.tsx index 75666dc5cce4c..382fc90ae3164 100644 --- a/packages/property-view/src/browser/property-view-widget.tsx +++ b/packages/property-view/src/browser/property-view-widget.tsx @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import { Disposable, SelectionService } from '@theia/core'; import { BaseWidget, codicon, MessageLoop, Widget } from '@theia/core/lib/browser/widgets/widget'; import { DisposableCollection } from '@theia/core/lib/common/disposable'; diff --git a/packages/scm-extra/src/browser/history/scm-history-widget.tsx b/packages/scm-extra/src/browser/history/scm-history-widget.tsx index 3e09781c98f7a..d730054cb9af4 100644 --- a/packages/scm-extra/src/browser/history/scm-history-widget.tsx +++ b/packages/scm-extra/src/browser/history/scm-history-widget.tsx @@ -18,7 +18,7 @@ import { injectable, inject, postConstruct } from '@theia/core/shared/inversify' import { DisposableCollection } from '@theia/core'; import { OpenerService, open, StatefulWidget, SELECTED_CLASS, WidgetManager, ApplicationShell, codicon } from '@theia/core/lib/browser'; import { CancellationTokenSource } from '@theia/core/lib/common/cancellation'; -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import { Virtuoso, VirtuosoHandle } from '@theia/core/shared/react-virtuoso'; import URI from '@theia/core/lib/common/uri'; import { ScmFileChange, ScmFileChangeNode } from '../scm-file-change-node'; diff --git a/packages/scm-extra/src/browser/scm-navigable-list-widget.tsx b/packages/scm-extra/src/browser/scm-navigable-list-widget.tsx index 893324d9cca0c..21981fe62b8e3 100644 --- a/packages/scm-extra/src/browser/scm-navigable-list-widget.tsx +++ b/packages/scm-extra/src/browser/scm-navigable-list-widget.tsx @@ -18,8 +18,8 @@ import { SELECTED_CLASS, Key, Widget } from '@theia/core/lib/browser'; import { ScmService } from '@theia/scm/lib/browser/scm-service'; import URI from '@theia/core/lib/common/uri'; import { LabelProvider } from '@theia/core/lib/browser/label-provider'; -import { Message } from '@theia/core/shared/@phosphor/messaging'; -import { ElementExt } from '@theia/core/shared/@phosphor/domutils'; +import { Message } from '@theia/core/shared/@lumino/messaging'; +import { ElementExt } from '@theia/core/shared/@lumino/domutils'; import { inject, injectable } from '@theia/core/shared/inversify'; import { ReactWidget } from '@theia/core/lib/browser/widgets/react-widget'; import * as React from '@theia/core/shared/react'; diff --git a/packages/scm/src/browser/scm-commit-widget.tsx b/packages/scm/src/browser/scm-commit-widget.tsx index 71fadca0f286a..4297905d6b22d 100644 --- a/packages/scm/src/browser/scm-commit-widget.tsx +++ b/packages/scm/src/browser/scm-commit-widget.tsx @@ -16,7 +16,7 @@ import { injectable, inject } from '@theia/core/shared/inversify'; import { DisposableCollection } from '@theia/core'; -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import * as React from '@theia/core/shared/react'; import TextareaAutosize from 'react-autosize-textarea'; import { ScmInput, ScmInputIssueType } from './scm-input'; diff --git a/packages/scm/src/browser/scm-input.ts b/packages/scm/src/browser/scm-input.ts index c9c8be7f01384..a1fe24d9a6a25 100644 --- a/packages/scm/src/browser/scm-input.ts +++ b/packages/scm/src/browser/scm-input.ts @@ -18,7 +18,7 @@ import * as debounce from 'p-debounce'; import { Disposable, DisposableCollection, Emitter } from '@theia/core/lib/common'; -import { JSONExt, JSONObject } from '@theia/core/shared/@phosphor/coreutils'; +import { JSONExt, JSONObject } from '@theia/core/shared/@lumino/coreutils'; export interface ScmInputIssue { message: string; diff --git a/packages/scm/src/browser/scm-widget.tsx b/packages/scm/src/browser/scm-widget.tsx index 58dbea305f15f..3a645c5f8c367 100644 --- a/packages/scm/src/browser/scm-widget.tsx +++ b/packages/scm/src/browser/scm-widget.tsx @@ -16,7 +16,7 @@ /* eslint-disable no-null/no-null, @typescript-eslint/no-explicit-any */ -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'; import { DisposableCollection } from '@theia/core/lib/common/disposable'; import { diff --git a/packages/search-in-workspace/src/browser/components/search-in-workspace-textarea.tsx b/packages/search-in-workspace/src/browser/components/search-in-workspace-textarea.tsx index 812c46ebad243..c544087c2e875 100644 --- a/packages/search-in-workspace/src/browser/components/search-in-workspace-textarea.tsx +++ b/packages/search-in-workspace/src/browser/components/search-in-workspace-textarea.tsx @@ -28,7 +28,7 @@ type TextareaAttributes = React.TextareaHTMLAttributes; export class SearchInWorkspaceTextArea extends React.Component { static LIMIT = 100; - private textarea = React.createRef(); + textarea = React.createRef(); constructor(props: TextareaAttributes) { super(props); diff --git a/packages/search-in-workspace/src/browser/search-in-workspace-widget.tsx b/packages/search-in-workspace/src/browser/search-in-workspace-widget.tsx index 78b69f66dfa11..2188e3589f19f 100644 --- a/packages/search-in-workspace/src/browser/search-in-workspace-widget.tsx +++ b/packages/search-in-workspace/src/browser/search-in-workspace-widget.tsx @@ -71,6 +71,9 @@ export class SearchInWorkspaceWidget extends BaseWidget implements StatefulWidge private includeRef = React.createRef(); private excludeRef = React.createRef(); + private refsAreSet: Promise = new Promise(resolve => this.resolveRefsAreSet = resolve); + private resolveRefsAreSet: () => void; + protected _showReplaceField = false; protected get showReplaceField(): boolean { return this._showReplaceField; @@ -346,18 +349,19 @@ export class SearchInWorkspaceWidget extends BaseWidget implements StatefulWidge this.focusInputField(); } - protected focusInputField(): void { - const f = document.getElementById('search-input-field'); - if (f) { - (f as HTMLInputElement).focus(); - (f as HTMLInputElement).select(); + protected async focusInputField(): Promise { + // Wait until React rendering is sufficiently progressed before trying to focus the input field. + await this.refsAreSet; + if (this.searchRef.current?.textarea.current) { + this.searchRef.current.textarea.current.focus(); + this.searchRef.current.textarea.current.select(); } } protected renderSearchHeader(): React.ReactNode { const searchAndReplaceContainer = this.renderSearchAndReplace(); const searchDetails = this.renderSearchDetails(); - return
{searchAndReplaceContainer}{searchDetails}
; + return
this.resolveRefsAreSet()}>{searchAndReplaceContainer}{searchDetails}
; } protected renderSearchAndReplace(): React.ReactNode { diff --git a/packages/task/src/browser/task-definition-registry.ts b/packages/task/src/browser/task-definition-registry.ts index 57ef3c539c421..b4de50d998273 100644 --- a/packages/task/src/browser/task-definition-registry.ts +++ b/packages/task/src/browser/task-definition-registry.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { injectable } from '@theia/core/shared/inversify'; -import { JSONExt } from '@theia/core/shared/@phosphor/coreutils'; +import { JSONExt } from '@theia/core/shared/@lumino/coreutils'; import { Event, Emitter } from '@theia/core/lib/common'; import { TaskConfiguration, TaskDefinition, TaskCustomization } from '../common'; import { Disposable } from '@theia/core/lib/common/disposable'; diff --git a/packages/task/src/browser/task-schema-updater.ts b/packages/task/src/browser/task-schema-updater.ts index df3060898a14c..2e7bba3b0ec3c 100644 --- a/packages/task/src/browser/task-schema-updater.ts +++ b/packages/task/src/browser/task-schema-updater.ts @@ -33,7 +33,7 @@ import { TaskDefinitionRegistry } from './task-definition-registry'; import { TaskServer, asVariableName } from '../common'; import { UserStorageUri } from '@theia/userstorage/lib/browser'; import { WorkspaceService } from '@theia/workspace/lib/browser'; -import { JSONObject } from '@theia/core/shared/@phosphor/coreutils'; +import { JSONObject } from '@theia/core/shared/@lumino/coreutils'; export const taskSchemaId = 'vscode://schemas/tasks'; diff --git a/packages/terminal/src/browser/terminal-widget-impl.ts b/packages/terminal/src/browser/terminal-widget-impl.ts index 5b923a278ce1c..eab52459e63b8 100644 --- a/packages/terminal/src/browser/terminal-widget-impl.ts +++ b/packages/terminal/src/browser/terminal-widget-impl.ts @@ -115,7 +115,7 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget @inject(ShellTerminalServerProxy) protected readonly shellTerminalServer: ShellTerminalServerProxy; @inject(TerminalWatcher) protected readonly terminalWatcher: TerminalWatcher; @inject(ILogger) @named('terminal') protected readonly logger: ILogger; - @inject('terminal-dom-id') override readonly id: string; + @inject('terminal-dom-id') readonly _id: string; @inject(TerminalPreferences) protected readonly preferences: TerminalPreferences; @inject(ContributionProvider) @named(TerminalContribution) protected readonly terminalContributionProvider: ContributionProvider; @inject(TerminalService) protected readonly terminalService: TerminalService; @@ -127,6 +127,10 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget @inject(ContextMenuRenderer) protected readonly contextMenuRenderer: ContextMenuRenderer; @inject(MarkdownRendererFactory) protected readonly markdownRendererFactory: MarkdownRendererFactory; + override get id(): string { + return this._id; + } + protected _markdownRenderer: MarkdownRenderer | undefined; protected get markdownRenderer(): MarkdownRenderer { this._markdownRenderer ||= this.markdownRendererFactory(); diff --git a/packages/timeline/src/browser/timeline-contribution.ts b/packages/timeline/src/browser/timeline-contribution.ts index cf84ab27f40cf..1dc8cbc8cb50a 100644 --- a/packages/timeline/src/browser/timeline-contribution.ts +++ b/packages/timeline/src/browser/timeline-contribution.ts @@ -28,7 +28,7 @@ import { TimelineWidget } from './timeline-widget'; import { TimelineService } from './timeline-service'; import { CommandContribution, CommandRegistry } from '@theia/core/lib/common'; import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; -import { toArray } from '@theia/core/shared/@phosphor/algorithm'; +import { toArray } from '@theia/core/shared/@lumino/algorithm'; import { LOAD_MORE_COMMAND } from './timeline-tree-model'; @injectable() diff --git a/packages/timeline/src/browser/timeline-widget.tsx b/packages/timeline/src/browser/timeline-widget.tsx index 6c125ef6a611f..a2a918b9c1a89 100644 --- a/packages/timeline/src/browser/timeline-widget.tsx +++ b/packages/timeline/src/browser/timeline-widget.tsx @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { Message } from '@theia/core/shared/@phosphor/messaging'; +import { Message } from '@theia/core/shared/@lumino/messaging'; import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; import { ApplicationShell, @@ -28,7 +28,7 @@ import { TimelineTreeWidget } from './timeline-tree-widget'; import { TimelineService, TimelineAggregate } from './timeline-service'; import { CommandRegistry, SelectionService } from '@theia/core/lib/common'; import { TimelineEmptyWidget } from './timeline-empty-widget'; -import { toArray } from '@theia/core/shared/@phosphor/algorithm'; +import { toArray } from '@theia/core/shared/@lumino/algorithm'; import URI from '@theia/core/lib/common/uri'; import { URI as CodeURI } from '@theia/core/shared/vscode-uri'; import { nls } from '@theia/core/lib/common/nls'; diff --git a/packages/typehierarchy/src/browser/tree/typehierarchy-tree-widget.tsx b/packages/typehierarchy/src/browser/tree/typehierarchy-tree-widget.tsx index 899888aaa026f..3be384f9e4182 100644 --- a/packages/typehierarchy/src/browser/tree/typehierarchy-tree-widget.tsx +++ b/packages/typehierarchy/src/browser/tree/typehierarchy-tree-widget.tsx @@ -16,7 +16,7 @@ import * as React from '@theia/core/shared/react'; import { inject, injectable } from '@theia/core/shared/inversify'; -import { DockPanel } from '@theia/core/shared/@phosphor/widgets'; +import { DockPanel } from '@theia/core/shared/@lumino/widgets'; import URI from '@theia/core/lib/common/uri'; import { SymbolKind, Range } from '@theia/core/shared/vscode-languageserver-protocol'; import { TreeNode } from '@theia/core/lib/browser/tree/tree'; diff --git a/yarn.lock b/yarn.lock index 21d2692e9f2aa..64dd649e9ef58 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1227,6 +1227,108 @@ yargs "16.2.0" yargs-parser "20.2.4" +"@lumino/algorithm@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@lumino/algorithm/-/algorithm-2.0.2.tgz#d211da98c92be0271afde96b949982e29178ae48" + integrity sha512-cI8yJ2+QK1yM5ZRU3Kuaw9fJ/64JEDZEwWWp7+U0cd/mvcZ44BGdJJ29w+tIet1QXxPAvnsUleWyQ5qm4qUouA== + +"@lumino/collections@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@lumino/collections/-/collections-2.0.2.tgz#c790d8d4555d5dd349ecc817c8bd9e65b7f21c64" + integrity sha512-o0QmfV1D3WhAeA8GI1/YmEPaK89JtHVa764rQ5T0LdbDEwUtUDbjavHs1E/+y66tNTXz9RUJ4D2rcSb9tysYsg== + dependencies: + "@lumino/algorithm" "^2.0.2" + +"@lumino/commands@^2.3.1": + version "2.3.1" + resolved "https://registry.yarnpkg.com/@lumino/commands/-/commands-2.3.1.tgz#4ab5ec6521fefd3a9ff7ae0983c645483b9ecd07" + integrity sha512-DpX1kkE4PhILpvK1T4ZnaFb6UP4+YTkdZifvN3nbiomD64O2CTd+wcWIBpZMgy6MMgbVgrE8dzHxHk1EsKxNxw== + dependencies: + "@lumino/algorithm" "^2.0.2" + "@lumino/coreutils" "^2.2.0" + "@lumino/disposable" "^2.1.3" + "@lumino/domutils" "^2.0.2" + "@lumino/keyboard" "^2.0.2" + "@lumino/signaling" "^2.1.3" + "@lumino/virtualdom" "^2.0.2" + +"@lumino/coreutils@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@lumino/coreutils/-/coreutils-2.2.0.tgz#3f9d5c36f2513f067b2563c7ad3b33f43905a4e2" + integrity sha512-x5wnQ/GjWBayJ6vXVaUi6+Q6ETDdcUiH9eSfpRZFbgMQyyM6pi6baKqJBK2CHkCc/YbAEl6ipApTgm3KOJ/I3g== + dependencies: + "@lumino/algorithm" "^2.0.2" + +"@lumino/disposable@^2.1.3": + version "2.1.3" + resolved "https://registry.yarnpkg.com/@lumino/disposable/-/disposable-2.1.3.tgz#cd2b11d82896eb654c2a528c9ff79a85ccf88d74" + integrity sha512-k5KXy/+T3UItiWHY4WwQawnsJnGo3aNtP5CTRKqo4+tbTNuhc3rTSvygJlNKIbEfIZXW2EWYnwfFDozkYx95eA== + dependencies: + "@lumino/signaling" "^2.1.3" + +"@lumino/domutils@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@lumino/domutils/-/domutils-2.0.2.tgz#b05973a179db2da71239976f25194f65c0f8eb98" + integrity sha512-2Kp6YHaMNI1rKB0PrALvOsZBHPy2EvVVAvJLWjlCm8MpWOVETjFp0MA9QpMubT9I76aKbaI5s1o1NJyZ8Y99pQ== + +"@lumino/dragdrop@^2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@lumino/dragdrop/-/dragdrop-2.1.5.tgz#2c178ac3e7520551f08ffb4f31521d87940dcce1" + integrity sha512-zqwR4GakrQBKZOW6S5pj2nfrQDurOErAoe9x3HS3BKLa1AzWA+t9PD5NESOKd81NqXFHjiMirSyFkTUs6pw+uA== + dependencies: + "@lumino/coreutils" "^2.2.0" + "@lumino/disposable" "^2.1.3" + +"@lumino/keyboard@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@lumino/keyboard/-/keyboard-2.0.2.tgz#8ff5e360b8960716f45b742845bea6f3c5f44760" + integrity sha512-icRUpvswDaFjqmAJNbQRb/aTu6Iugo6Y2oC08TiIwhQtLS9W+Ee9VofdqvbPSvCm6DkyP+DCWMuA3KXZ4V4g4g== + +"@lumino/messaging@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@lumino/messaging/-/messaging-2.0.2.tgz#133b94d1fa1c67ad60e622a32acaf682faf05aaa" + integrity sha512-2sUF07cYA0f3mDil41Eh5sfBk0aGAH/mOh1I4+vyRUsKyBqp4WTUtpJFd8xVJGAntygxwnebIygkIaXXTIQvxA== + dependencies: + "@lumino/algorithm" "^2.0.2" + "@lumino/collections" "^2.0.2" + +"@lumino/properties@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@lumino/properties/-/properties-2.0.2.tgz#39213876b06a917eae72e8ea38b71daa1c699682" + integrity sha512-b312oA3Bh97WFK8efXejYmC3DVJmvzJk72LQB7H3fXhfqS5jUWvL7MSnNmgcQvGzl9fIhDWDWjhtSTi0KGYYBg== + +"@lumino/signaling@^2.1.3": + version "2.1.3" + resolved "https://registry.yarnpkg.com/@lumino/signaling/-/signaling-2.1.3.tgz#612419e6948ce77c00328f9eff5ecd995c960a70" + integrity sha512-9Wd4iMk8F1i6pYjy65bqKuPlzQMicyL9xy1/ccS20kovPcfD074waneL/7BVe+3M8i+fGa3x2qjbWrBzOdTdNw== + dependencies: + "@lumino/algorithm" "^2.0.2" + "@lumino/coreutils" "^2.2.0" + +"@lumino/virtualdom@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@lumino/virtualdom/-/virtualdom-2.0.2.tgz#927c9803ebd31cd97ca2c599ec9a5d509afb3b2d" + integrity sha512-HYZThOtZSoknjdXA102xpy5CiXtTFCVz45EXdWeYLx3NhuEwuAIX93QBBIhupalmtFlRg1yhdDNV40HxJ4kcXg== + dependencies: + "@lumino/algorithm" "^2.0.2" + +"@lumino/widgets@2.5.0": + version "2.5.0" + resolved "https://registry.yarnpkg.com/@lumino/widgets/-/widgets-2.5.0.tgz#7e37d86dbbc4eed1f85aa199b9fffa4919aa1e3e" + integrity sha512-RSRpc6aIEiuw79jqWUHYWXLJ2GBy7vhwuqgo94UVzg6oeh3XBECX0OvXGjK2k7N2BhmRrIs9bXky7Dm861S6mQ== + dependencies: + "@lumino/algorithm" "^2.0.2" + "@lumino/commands" "^2.3.1" + "@lumino/coreutils" "^2.2.0" + "@lumino/disposable" "^2.1.3" + "@lumino/domutils" "^2.0.2" + "@lumino/dragdrop" "^2.1.5" + "@lumino/keyboard" "^2.0.2" + "@lumino/messaging" "^2.0.2" + "@lumino/properties" "^2.0.2" + "@lumino/signaling" "^2.1.3" + "@lumino/virtualdom" "^2.0.2" + "@malept/cross-spawn-promise@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@malept/cross-spawn-promise/-/cross-spawn-promise-2.0.0.tgz#d0772de1aa680a0bfb9ba2f32b4c828c7857cb9d" @@ -1619,7 +1721,6 @@ dependencies: node-addon-api "^3.2.1" node-gyp-build "^4.3.0" - "@parcel/watcher@^2.5.0": version "2.5.0" resolved "https://registry.yarnpkg.com/@parcel/watcher/-/watcher-2.5.0.tgz#5c88818b12b8de4307a9d3e6dc3e28eba0dfbd10" @@ -1644,104 +1745,6 @@ "@parcel/watcher-win32-ia32" "2.5.0" "@parcel/watcher-win32-x64" "2.5.0" -"@phosphor/algorithm@1", "@phosphor/algorithm@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@phosphor/algorithm/-/algorithm-1.2.0.tgz#4a19aa59261b7270be696672dc3f0663f7bef152" - integrity sha512-C9+dnjXyU2QAkWCW6QVDGExk4hhwxzAKf5/FIuYlHAI9X5vFv99PYm0EREDxX1PbMuvfFBZhPNu0PvuSDQ7sFA== - -"@phosphor/collections@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@phosphor/collections/-/collections-1.2.0.tgz#a8cdd0edc0257de7c33306a91caf47910036307f" - integrity sha512-T9/0EjSuY6+ga2LIFRZ0xupciOR3Qnyy8Q95lhGTC0FXZUFwC8fl9e8On6IcwasCszS+1n8dtZUWSIynfgdpzw== - dependencies: - "@phosphor/algorithm" "^1.2.0" - -"@phosphor/commands@1", "@phosphor/commands@^1.7.2": - version "1.7.2" - resolved "https://registry.yarnpkg.com/@phosphor/commands/-/commands-1.7.2.tgz#df724f2896ae43c4a3a9e2b5a6445a15e0d60487" - integrity sha512-iSyBIWMHsus323BVEARBhuVZNnVel8USo+FIPaAxGcq+icTSSe6+NtSxVQSmZblGN6Qm4iw6I6VtiSx0e6YDgQ== - dependencies: - "@phosphor/algorithm" "^1.2.0" - "@phosphor/coreutils" "^1.3.1" - "@phosphor/disposable" "^1.3.1" - "@phosphor/domutils" "^1.1.4" - "@phosphor/keyboard" "^1.1.3" - "@phosphor/signaling" "^1.3.1" - -"@phosphor/coreutils@1", "@phosphor/coreutils@^1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@phosphor/coreutils/-/coreutils-1.3.1.tgz#441e34f42340f7faa742a88b2a181947a88d7226" - integrity sha512-9OHCn8LYRcPU/sbHm5v7viCA16Uev3gbdkwqoQqlV+EiauDHl70jmeL7XVDXdigl66Dz0LI11C99XOxp+s3zOA== - -"@phosphor/disposable@^1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@phosphor/disposable/-/disposable-1.3.1.tgz#be98fe12bd8c9a4600741cb83b0a305df28628f3" - integrity sha512-0NGzoTXTOizWizK/brKKd5EjJhuuEH4903tLika7q6wl/u0tgneJlTh7R+MBVeih0iNxtuJAfBa3IEY6Qmj+Sw== - dependencies: - "@phosphor/algorithm" "^1.2.0" - "@phosphor/signaling" "^1.3.1" - -"@phosphor/domutils@1", "@phosphor/domutils@^1.1.4": - version "1.1.4" - resolved "https://registry.yarnpkg.com/@phosphor/domutils/-/domutils-1.1.4.tgz#4c6aecf7902d3793b45db325319340e0a0b5543b" - integrity sha512-ivwq5TWjQpKcHKXO8PrMl+/cKqbgxPClPiCKc1gwbMd+6hnW5VLwNG0WBzJTxCzXK43HxX18oH+tOZ3E04wc3w== - -"@phosphor/dragdrop@1", "@phosphor/dragdrop@^1.4.1": - version "1.4.1" - resolved "https://registry.yarnpkg.com/@phosphor/dragdrop/-/dragdrop-1.4.1.tgz#45887dfe8f5849db2b4d1c0329a377f0f0854464" - integrity sha512-77paMoubIWk7pdwA2GVFkqba1WP48hTZZvS17N30+KVOeWfSqBL3flPSnW2yC4y6FnOP2PFOCtuPIbQv+pYhCA== - dependencies: - "@phosphor/coreutils" "^1.3.1" - "@phosphor/disposable" "^1.3.1" - -"@phosphor/keyboard@^1.1.3": - version "1.1.3" - resolved "https://registry.yarnpkg.com/@phosphor/keyboard/-/keyboard-1.1.3.tgz#e5fd13af0479034ef0b5fffcf43ef2d4a266b5b6" - integrity sha512-dzxC/PyHiD6mXaESRy6PZTd9JeK+diwG1pyngkyUf127IXOEzubTIbu52VSdpGBklszu33ws05BAGDa4oBE4mQ== - -"@phosphor/messaging@1", "@phosphor/messaging@^1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@phosphor/messaging/-/messaging-1.3.0.tgz#a140e6dd28a496260779acf74860f738c654c65e" - integrity sha512-k0JE+BTMKlkM335S2AmmJxoYYNRwOdW5jKBqLgjJdGRvUQkM0+2i60ahM45+J23atGJDv9esKUUBINiKHFhLew== - dependencies: - "@phosphor/algorithm" "^1.2.0" - "@phosphor/collections" "^1.2.0" - -"@phosphor/properties@1", "@phosphor/properties@^1.1.3": - version "1.1.3" - resolved "https://registry.yarnpkg.com/@phosphor/properties/-/properties-1.1.3.tgz#63e4355be5e22a411c566fd1860207038f171598" - integrity sha512-GiglqzU77s6+tFVt6zPq9uuyu/PLQPFcqZt914ZhJ4cN/7yNI/SLyMzpYZ56IRMXvzK9TUgbRna6URE3XAwFUg== - -"@phosphor/signaling@1", "@phosphor/signaling@^1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@phosphor/signaling/-/signaling-1.3.1.tgz#1cd10b069bdb2c9adb3ba74245b30141e5afc2d7" - integrity sha512-Eq3wVCPQAhUd9+gUGaYygMr+ov7dhSGblSBXiDzpZlSIfa8OVD4P3cCvYXr/acDTNmZ/gHTcSFO8/n3rDkeXzg== - dependencies: - "@phosphor/algorithm" "^1.2.0" - -"@phosphor/virtualdom@1", "@phosphor/virtualdom@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@phosphor/virtualdom/-/virtualdom-1.2.0.tgz#6a233312f817eb02555a0359c4ae3e501fa62bca" - integrity sha512-L9mKNhK2XtVjzjuHLG2uYuepSz8uPyu6vhF4EgCP0rt0TiLYaZeHwuNu3XeFbul9DMOn49eBpye/tfQVd4Ks+w== - dependencies: - "@phosphor/algorithm" "^1.2.0" - -"@phosphor/widgets@1": - version "1.9.3" - resolved "https://registry.yarnpkg.com/@phosphor/widgets/-/widgets-1.9.3.tgz#b8b7ad69fd7cc7af8e8c312ebead0e0965a4cefd" - integrity sha512-61jsxloDrW/+WWQs8wOgsS5waQ/MSsXBuhONt0o6mtdeL93HVz7CYO5krOoot5owammfF6oX1z0sDaUYIYgcPA== - dependencies: - "@phosphor/algorithm" "^1.2.0" - "@phosphor/commands" "^1.7.2" - "@phosphor/coreutils" "^1.3.1" - "@phosphor/disposable" "^1.3.1" - "@phosphor/domutils" "^1.1.4" - "@phosphor/dragdrop" "^1.4.1" - "@phosphor/keyboard" "^1.1.3" - "@phosphor/messaging" "^1.3.0" - "@phosphor/properties" "^1.1.3" - "@phosphor/signaling" "^1.3.1" - "@phosphor/virtualdom" "^1.2.0" "@pkgjs/parseargs@^0.11.0": version "0.11.0"