Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* The semantic zone for the mouse position.
*/
zone: DropZone;
/**
* The tab area geometry for the drop zone, or `null`.
*/
target: DockLayout.ITabAreaGeometry | null;
}
/**
* An attached property used to track generated tab bars.
*/
export
const isGeneratedTabBarProperty = new AttachedProperty({
name: 'isGeneratedTabBar',
create: () => false
});
/**
* Create a single document config for the widgets in a dock panel.
*/
export
function createSingleDocumentConfig(panel: DockPanel): DockPanel.ILayoutConfig {
// Return an empty config if the panel is empty.
if (panel.isEmpty) {
return { main: null };
}
// Get a flat array of the widgets in the panel.
let widgets = toArray(panel.widgets());
*/
open(
widget: IDocumentWidget,
options?: DocumentRegistry.IOpenOptions
): void;
}
}
/**
* A namespace for private data.
*/
namespace Private {
/**
* An attached property for a context save handler.
*/
export const saveHandlerProperty = new AttachedProperty<
DocumentRegistry.Context,
SaveHandler | undefined
>({
name: 'saveHandler',
create: () => undefined
});
/**
* A type alias for a standard context.
*
* #### Notes
* We define this as an interface of a specific implementation so that we can
* use the implementation-specific functions.
*/
export interface IContext extends Context {
/* no op */
if (this.parent) {
this.parent = null;
} else if (this.isAttached) {
Widget.detach(this);
}
// Dispose of the widget layout.
if (this._layout) {
this._layout.dispose();
this._layout = null;
}
// Clear the extra data associated with the widget.
Signal.clearData(this);
MessageLoop.clearData(this);
AttachedProperty.clearData(this);
}
MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);
widget.node.parentNode!.removeChild(widget.node);
MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);
}
}
/**
* The namespace for the module implementation details.
*/
namespace Private {
/**
* An attached property for the widget title object.
*/
export
const titleProperty = new AttachedProperty>({
name: 'title',
create: owner => new Title({ owner }),
});
/**
* Create a DOM node for the given widget options.
*/
export
function createNode(options: Widget.IOptions): HTMLElement {
return options.node || document.createElement('div');
}
}
}
app.contextMenu.addItem({
command: toggleShowAllActivity,
selector: '.jp-CodeConsole'
});
}
/*
* A namespace for private data.
*/
namespace Private {
/**
* An attached property for a console's foreign handler.
*/
export const foreignHandlerProperty = new AttachedProperty<
CodeConsole,
ForeignHandler | undefined
>({
name: 'foreignHandler',
create: () => undefined
});
}
export
function setCellConfig(widget: Widget, value: Partial): void {
Private.cellConfigProperty.set(widget, Private.normalizeConfig(value));
}
}
/**
* The namespace for the module implementation details.
*/
namespace Private {
/**
* The property descriptor for the widget cell config.
*/
export
const cellConfigProperty = new AttachedProperty({
name: 'cellConfig',
create: () => ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }),
changed: onChildCellConfigChanged
});
/**
* Normalize a partial cell config object.
*/
export
function normalizeConfig(config: Partial): GridLayout.ICellConfig {
let row = Math.max(0, Math.floor(config.row || 0));
let column = Math.max(0, Math.floor(config.column || 0));
let rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));
let columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));
return { row, column, rowSpan, columnSpan };
}
export
function setSizeBasis(widget: Widget, value: number): void {
Private.sizeBasisProperty.set(widget, value);
}
}
/**
* The namespace for the module implementation details.
*/
namespace Private {
/**
* The property descriptor for a widget stretch factor.
*/
export
const stretchProperty = new AttachedProperty({
name: 'stretch',
create: () => 0,
coerce: (owner, value) => Math.max(0, Math.floor(value)),
changed: onChildSizingChanged
});
/**
* The property descriptor for a widget size basis.
*/
export
const sizeBasisProperty = new AttachedProperty({
name: 'sizeBasis',
create: () => 0,
coerce: (owner, value) => Math.max(0, Math.floor(value)),
changed: onChildSizingChanged
});
void tracker.add(widget);
});
});
}
};
}
/**
* Private namespace for the module.
*/
namespace Private {
/**
* An attached property for keeping the factory name
* that was used to create a mimedocument.
*/
export const factoryNameProperty = new AttachedProperty<
MimeDocument,
string | undefined
>({
name: 'factoryName',
create: () => undefined
});
}
export interface IOptions {
/**
* A namespace designating objects from this pool.
*/
namespace: string;
}
}
/*
* A namespace for private data.
*/
namespace Private {
/**
* An attached property to indicate whether an object has been injected.
*/
export const injectedProperty = new AttachedProperty<
IObservableDisposable,
boolean
>({
name: 'injected',
create: () => false
});
/**
* An attached property for an object's ID.
*/
export const nameProperty = new AttachedProperty<
IObservableDisposable,
string
>({
name: 'name',
create: () => ''
/**
* The property descriptor for a widget stretch factor.
*/
export
const stretchProperty = new AttachedProperty({
name: 'stretch',
create: () => 0,
coerce: (owner, value) => Math.max(0, Math.floor(value)),
changed: onChildSizingChanged
});
/**
* The property descriptor for a widget size basis.
*/
export
const sizeBasisProperty = new AttachedProperty({
name: 'sizeBasis',
create: () => 0,
coerce: (owner, value) => Math.max(0, Math.floor(value)),
changed: onChildSizingChanged
});
/**
* Test whether a direction has horizontal orientation.
*/
export
function isHorizontal(dir: BoxLayout.Direction): boolean {
return dir === 'left-to-right' || dir === 'right-to-left';
}
/**
* Clamp a spacing value to an integer >= 0.