@jupyterlab/apputils 0.18.2 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +34 -0
- package/lib/clientsession.js +3 -8
- package/lib/mainareawidget.d.ts +0 -19
- package/lib/mainareawidget.js +0 -40
- package/lib/sanitizer.d.ts +8 -0
- package/lib/sanitizer.js +869 -22
- package/lib/splash.d.ts +3 -1
- package/lib/thememanager.js +1 -1
- package/lib/toolbar.d.ts +1 -0
- package/lib/toolbar.js +7 -2
- package/package.json +20 -14
- package/style/index.css +1 -0
- package/style/materialcolors.css +278 -0
- package/lib/clientsession.js.map +0 -1
- package/lib/clipboard.js.map +0 -1
- package/lib/commandlinker.js.map +0 -1
- package/lib/commandpalette.js.map +0 -1
- package/lib/dialog.js.map +0 -1
- package/lib/domutils.js.map +0 -1
- package/lib/hoverbox.js.map +0 -1
- package/lib/iframe.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/instancetracker.js.map +0 -1
- package/lib/mainareawidget.js.map +0 -1
- package/lib/sanitizer.js.map +0 -1
- package/lib/spinner.js.map +0 -1
- package/lib/splash.js.map +0 -1
- package/lib/styling.js.map +0 -1
- package/lib/thememanager.js.map +0 -1
- package/lib/toolbar.js.map +0 -1
- package/lib/vdom.js.map +0 -1
- package/lib/windowresolver.js.map +0 -1
package/lib/dialog.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../../apputils/src/dialog.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAE3D,mDAAmE;AAEnE,mDAAsD;AAEtD,mDAA2D;AAE3D,+CAA+D;AAI/D,iCAA4C;AAE5C,uCAAoC;AAEpC;;;;;;GAMG;AACH,oBACE,UAAuC,EAAE;IAEzC,IAAI,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,MA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E5D;;;;;;OAMG;IACH,uBACE,UAAuC,EAAE;QAEzC,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC5E,IAAI,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QACvC,IAAI,OAAO,CAAC,aAAa,KAAK,SAAS,EAAE;YACvC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;SACvC;QACD,OAAO;YACL,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;YAC1B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,EAAE;YACxB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI;YACnC,OAAO;YACP,aAAa;YACb,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC,eAAe;YACpD,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,IAAI,EAAE;SACnD,CAAC;IACJ,CAAC;IAjBe,qBAAa,gBAiB5B,CAAA;IAED;;OAEG;IACH,4BAAmC,IAAiB;QAClD,IAAI,kBAAkB,GAAG;YACvB,OAAO;YACP,QAAQ;YACR,SAAS;YACT,UAAU;YACV,QAAQ;YACR,YAAY;SACb,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACZ,OAAO,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAgB,CAAC;IACrE,CAAC;IAVe,0BAAkB,qBAUjC,CAAA;AACH,CAAC,EA9CS,OAAO,KAAP,OAAO,QA8ChB","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt, each, map, toArray } from '@phosphor/algorithm';\n\nimport { PromiseDelegate } from '@phosphor/coreutils';\n\nimport { Message, MessageLoop } from '@phosphor/messaging';\n\nimport { PanelLayout, Panel, Widget } from '@phosphor/widgets';\n\nimport * as React from 'react';\n\nimport { ReactElementWidget } from './vdom';\n\nimport { Styling } from './styling';\n\n/**\n * Create and show a dialog.\n *\n * @param options - The dialog setup options.\n *\n * @returns A promise that resolves with whether the dialog was accepted.\n */\nexport function showDialog<T>(\n options: Partial<Dialog.IOptions<T>> = {}\n): Promise<Dialog.IResult<T>> {\n let dialog = new Dialog(options);\n return dialog.launch();\n}\n\n/**\n * Show an error message dialog.\n *\n * @param title - The title of the dialog box.\n *\n * @param error - the error to show in the dialog body (either a string\n * or an object with a string `message` property).\n */\nexport function showErrorMessage(title: string, error: any): Promise<void> {\n console.warn('Showing error:', error);\n\n return showDialog({\n title: title,\n body: error.message || title,\n buttons: [Dialog.okButton({ label: 'DISMISS' })]\n }).then(() => {\n /* no-op */\n });\n}\n\n/**\n * A modal dialog widget.\n */\nexport class Dialog<T> extends Widget {\n /**\n * Create a dialog panel instance.\n *\n * @param options - The dialog setup options.\n */\n constructor(options: Partial<Dialog.IOptions<T>> = {}) {\n super();\n this.addClass('jp-Dialog');\n let normalized = Private.handleOptions(options);\n let renderer = normalized.renderer;\n\n this._host = normalized.host;\n this._defaultButton = normalized.defaultButton;\n this._buttons = normalized.buttons;\n this._buttonNodes = toArray(\n map(this._buttons, button => {\n return renderer.createButtonNode(button);\n })\n );\n\n let layout = (this.layout = new PanelLayout());\n let content = new Panel();\n content.addClass('jp-Dialog-content');\n layout.addWidget(content);\n\n this._body = normalized.body;\n\n let header = renderer.createHeader(normalized.title);\n let body = renderer.createBody(normalized.body);\n let footer = renderer.createFooter(this._buttonNodes);\n content.addWidget(header);\n content.addWidget(body);\n content.addWidget(footer);\n\n this._primary = this._buttonNodes[this._defaultButton];\n this._focusNodeSelector = options.focusNodeSelector;\n }\n\n /**\n * Dispose of the resources used by the dialog.\n */\n dispose(): void {\n const promise = this._promise;\n if (promise) {\n this._promise = null;\n promise.reject(void 0);\n ArrayExt.removeFirstOf(Private.launchQueue, promise.promise);\n }\n super.dispose();\n }\n\n /**\n * Launch the dialog as a modal window.\n *\n * @returns a promise that resolves with the result of the dialog.\n */\n launch(): Promise<Dialog.IResult<T>> {\n // Return the existing dialog if already open.\n if (this._promise) {\n return this._promise.promise;\n }\n const promise = (this._promise = new PromiseDelegate<Dialog.IResult<T>>());\n let promises = Promise.all(Private.launchQueue);\n Private.launchQueue.push(this._promise.promise);\n return promises.then(() => {\n Widget.attach(this, this._host);\n return promise.promise;\n });\n }\n\n /**\n * Resolve the current dialog.\n *\n * @param index - An optional index to the button to resolve.\n *\n * #### Notes\n * Will default to the defaultIndex.\n * Will resolve the current `show()` with the button value.\n * Will be a no-op if the dialog is not shown.\n */\n resolve(index?: number): void {\n if (!this._promise) {\n return;\n }\n if (index === undefined) {\n index = this._defaultButton;\n }\n this._resolve(this._buttons[index]);\n }\n\n /**\n * Reject the current dialog with a default reject value.\n *\n * #### Notes\n * Will be a no-op if the dialog is not shown.\n */\n reject(): void {\n if (!this._promise) {\n return;\n }\n this._resolve(Dialog.cancelButton());\n }\n\n /**\n * Handle the DOM events for the directory listing.\n *\n * @param event - The DOM event sent to the widget.\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 'keydown':\n this._evtKeydown(event as KeyboardEvent);\n break;\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n default:\n break;\n }\n }\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n */\n protected onAfterAttach(msg: Message): void {\n let node = this.node;\n node.addEventListener('keydown', this, true);\n node.addEventListener('contextmenu', this, true);\n node.addEventListener('click', this, true);\n document.addEventListener('focus', this, true);\n this._first = Private.findFirstFocusable(this.node);\n this._original = document.activeElement as HTMLElement;\n if (this._focusNodeSelector) {\n let body = this.node.querySelector('.jp-Dialog-body');\n let el = body.querySelector(this._focusNodeSelector);\n\n if (el) {\n this._primary = el as HTMLElement;\n }\n }\n this._primary.focus();\n }\n\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n protected onAfterDetach(msg: Message): void {\n let node = this.node;\n node.removeEventListener('keydown', this, true);\n node.removeEventListener('contextmenu', this, true);\n node.removeEventListener('click', this, true);\n document.removeEventListener('focus', this, true);\n this._original.focus();\n }\n\n /**\n * A message handler invoked on a `'close-request'` message.\n */\n protected onCloseRequest(msg: Message): void {\n if (this._promise) {\n this.reject();\n }\n super.onCloseRequest(msg);\n }\n\n /**\n * Handle the `'click'` event for a dialog button.\n *\n * @param event - The DOM event sent to the widget\n */\n protected _evtClick(event: MouseEvent): void {\n let content = this.node.getElementsByClassName(\n 'jp-Dialog-content'\n )[0] as HTMLElement;\n if (!content.contains(event.target as HTMLElement)) {\n event.stopPropagation();\n event.preventDefault();\n return;\n }\n for (let buttonNode of this._buttonNodes) {\n if (buttonNode.contains(event.target as HTMLElement)) {\n let index = this._buttonNodes.indexOf(buttonNode);\n this.resolve(index);\n }\n }\n }\n\n /**\n * Handle the `'keydown'` event for the widget.\n *\n * @param event - The DOM event sent to the widget\n */\n protected _evtKeydown(event: KeyboardEvent): void {\n // Check for escape key\n switch (event.keyCode) {\n case 27: // Escape.\n event.stopPropagation();\n event.preventDefault();\n this.reject();\n break;\n case 9: // Tab.\n // Handle a tab on the last button.\n let node = this._buttonNodes[this._buttons.length - 1];\n if (document.activeElement === node && !event.shiftKey) {\n event.stopPropagation();\n event.preventDefault();\n this._first.focus();\n }\n break;\n case 13: // Enter.\n event.stopPropagation();\n event.preventDefault();\n this.resolve();\n break;\n default:\n break;\n }\n }\n\n /**\n * Handle the `'focus'` event for the widget.\n *\n * @param event - The DOM event sent to the widget\n */\n protected _evtFocus(event: FocusEvent): void {\n let target = event.target as HTMLElement;\n if (!this.node.contains(target as HTMLElement)) {\n event.stopPropagation();\n this._buttonNodes[this._defaultButton].focus();\n }\n }\n\n /**\n * Resolve a button item.\n */\n private _resolve(button: Dialog.IButton): void {\n // Prevent loopback.\n const promise = this._promise;\n if (!promise) {\n this.dispose();\n return;\n }\n this._promise = null;\n ArrayExt.removeFirstOf(Private.launchQueue, promise.promise);\n let body = this._body;\n let value: T | null = null;\n if (\n button.accept &&\n body instanceof Widget &&\n typeof body.getValue === 'function'\n ) {\n value = body.getValue();\n }\n this.dispose();\n promise.resolve({ button, value });\n }\n\n private _buttonNodes: ReadonlyArray<HTMLElement>;\n private _buttons: ReadonlyArray<Dialog.IButton>;\n private _original: HTMLElement;\n private _first: HTMLElement;\n private _primary: HTMLElement;\n private _promise: PromiseDelegate<Dialog.IResult<T>> | null;\n private _defaultButton: number;\n private _host: HTMLElement;\n private _body: Dialog.BodyType<T>;\n private _focusNodeSelector = '';\n}\n\n/**\n * The namespace for Dialog class statics.\n */\nexport namespace Dialog {\n /**\n * The options used to create a dialog.\n */\n export interface IOptions<T> {\n /**\n * The top level text for the dialog. Defaults to an empty string.\n */\n title: HeaderType;\n\n /**\n * The main body element for the dialog or a message to display.\n * Defaults to an empty string.\n *\n * #### Notes\n * If a widget is given as the body, it will be disposed after the\n * dialog is resolved. If the widget has a `getValue()` method,\n * the method will be called prior to disposal and the value\n * will be provided as part of the dialog result.\n * A string argument will be used as raw `textContent`.\n * All `input` and `select` nodes will be wrapped and styled.\n */\n body: BodyType<T>;\n\n /**\n * The host element for the dialog. Defaults to `document.body`.\n */\n host: HTMLElement;\n\n /**\n * The to buttons to display. Defaults to cancel and accept buttons.\n */\n buttons: ReadonlyArray<IButton>;\n\n /**\n * The index of the default button. Defaults to the last button.\n */\n defaultButton: number;\n\n /**\n * A selector for the primary element that should take focus in the dialog.\n * Defaults to an empty string, causing the [[defaultButton]] to take\n * focus.\n */\n focusNodeSelector: string;\n\n /**\n * An optional renderer for dialog items. Defaults to a shared\n * default renderer.\n */\n renderer: IRenderer;\n }\n\n /**\n * The options used to make a button item.\n */\n export interface IButton {\n /**\n * The label for the button.\n */\n label: string;\n\n /**\n * The icon class for the button.\n */\n iconClass: string;\n\n /**\n * The icon label for the button.\n */\n iconLabel: string;\n\n /**\n * The caption for the button.\n */\n caption: string;\n\n /**\n * The extra class name for the button.\n */\n className: string;\n\n /**\n * The dialog action to perform when the button is clicked.\n */\n accept: boolean;\n\n /**\n * The button display type.\n */\n displayType: 'default' | 'warn';\n }\n\n /**\n * The options used to create a button.\n */\n export type ButtonOptions = Partial<IButton>;\n\n /**\n * The header input types.\n */\n export type HeaderType = React.ReactElement<any> | string;\n\n /**\n * The result of a dialog.\n */\n export interface IResult<T> {\n /**\n * The button that was pressed.\n */\n button: IButton;\n\n /**\n * The value retrieved from `.getValue()` if given on the widget.\n */\n value: T | null;\n }\n\n /**\n * A widget used as a dialog body.\n */\n export interface IBodyWidget<T = string> extends Widget {\n /**\n * Get the serialized value of the widget.\n */\n getValue?(): T;\n }\n\n /**\n * The body input types.\n */\n export type BodyType<T> = IBodyWidget<T> | React.ReactElement<any> | string;\n\n /**\n * Create an accept button.\n */\n export function okButton(options: ButtonOptions = {}): Readonly<IButton> {\n options.accept = true;\n return createButton(options);\n }\n\n /**\n * Create a reject button.\n */\n export function cancelButton(options: ButtonOptions = {}): Readonly<IButton> {\n options.accept = false;\n return createButton(options);\n }\n\n /**\n * Create a warn button.\n */\n export function warnButton(options: ButtonOptions = {}): Readonly<IButton> {\n options.displayType = 'warn';\n return createButton(options);\n }\n\n /**\n * Create a button item.\n */\n export function createButton(value: Dialog.ButtonOptions): Readonly<IButton> {\n value.accept = value.accept !== false;\n let defaultLabel = value.accept ? 'OK' : 'CANCEL';\n return {\n label: value.label || defaultLabel,\n iconClass: value.iconClass || '',\n iconLabel: value.iconLabel || '',\n caption: value.caption || '',\n className: value.className || '',\n accept: value.accept,\n displayType: value.displayType || 'default'\n };\n }\n\n /**\n * A dialog renderer.\n */\n export interface IRenderer {\n /**\n * Create the header of the dialog.\n *\n * @param title - The title of the dialog.\n *\n * @returns A widget for the dialog header.\n */\n createHeader(title: HeaderType): Widget;\n\n /**\n * Create the body of the dialog.\n *\n * @param value - The input value for the body.\n *\n * @returns A widget for the body.\n */\n createBody(body: BodyType<any>): Widget;\n\n /**\n * Create the footer of the dialog.\n *\n * @param buttons - The button nodes to add to the footer.\n *\n * @returns A widget for the footer.\n */\n createFooter(buttons: ReadonlyArray<HTMLElement>): Widget;\n\n /**\n * Create a button node for the dialog.\n *\n * @param button - The button data.\n *\n * @returns A node for the button.\n */\n createButtonNode(button: IButton): HTMLElement;\n }\n\n /**\n * The default implementation of a dialog renderer.\n */\n export class Renderer {\n /**\n * Create the header of the dialog.\n *\n * @param title - The title of the dialog.\n *\n * @returns A widget for the dialog header.\n */\n createHeader(title: HeaderType): Widget {\n let header: Widget;\n if (typeof title === 'string') {\n header = new Widget({ node: document.createElement('span') });\n header.node.textContent = title;\n } else {\n header = new ReactElementWidget(title);\n }\n header.addClass('jp-Dialog-header');\n Styling.styleNode(header.node);\n return header;\n }\n\n /**\n * Create the body of the dialog.\n *\n * @param value - The input value for the body.\n *\n * @returns A widget for the body.\n */\n createBody(value: BodyType<any>): Widget {\n let body: Widget;\n if (typeof value === 'string') {\n body = new Widget({ node: document.createElement('span') });\n body.node.textContent = value;\n } else if (value instanceof Widget) {\n body = value;\n } else {\n body = new ReactElementWidget(value);\n // Immediately update the body even though it has not yet attached in\n // order to trigger a render of the DOM nodes from the React element.\n MessageLoop.sendMessage(body, Widget.Msg.UpdateRequest);\n }\n body.addClass('jp-Dialog-body');\n Styling.styleNode(body.node);\n return body;\n }\n\n /**\n * Create the footer of the dialog.\n *\n * @param buttonNodes - The buttons nodes to add to the footer.\n *\n * @returns A widget for the footer.\n */\n createFooter(buttons: ReadonlyArray<HTMLElement>): Widget {\n let footer = new Widget();\n footer.addClass('jp-Dialog-footer');\n each(buttons, button => {\n footer.node.appendChild(button);\n });\n Styling.styleNode(footer.node);\n return footer;\n }\n\n /**\n * Create a button node for the dialog.\n *\n * @param button - The button data.\n *\n * @returns A node for the button.\n */\n createButtonNode(button: IButton): HTMLElement {\n const e = document.createElement('button');\n e.className = this.createItemClass(button);\n e.appendChild(this.renderIcon(button));\n e.appendChild(this.renderLabel(button));\n return e;\n }\n\n /**\n * Create the class name for the button.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the button.\n */\n createItemClass(data: IButton): string {\n // Setup the initial class name.\n let name = 'jp-Dialog-button';\n\n // Add the other state classes.\n if (data.accept) {\n name += ' jp-mod-accept';\n } else {\n name += ' jp-mod-reject';\n }\n if (data.displayType === 'warn') {\n name += ' jp-mod-warn';\n }\n\n // Add the extra class.\n let extra = data.className;\n if (extra) {\n name += ` ${extra}`;\n }\n\n // Return the complete class name.\n return name;\n }\n\n /**\n * Render an icon element for a dialog item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns An HTML element representing the icon.\n */\n renderIcon(data: IButton): HTMLElement {\n const e = document.createElement('div');\n e.className = this.createIconClass(data);\n e.appendChild(document.createTextNode(data.iconLabel));\n return e;\n }\n\n /**\n * Create the class name for the button 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: IButton): string {\n let name = 'jp-Dialog-buttonIcon';\n let extra = data.iconClass;\n return extra ? `${name} ${extra}` : name;\n }\n\n /**\n * Render the label element for a button.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns An HTML element representing the item label.\n */\n renderLabel(data: IButton): HTMLElement {\n const e = document.createElement('div');\n e.className = 'jp-Dialog-buttonLabel';\n e.title = data.caption;\n e.appendChild(document.createTextNode(data.label));\n return e;\n }\n }\n\n /**\n * The default renderer instance.\n */\n export const defaultRenderer = new Renderer();\n}\n\n/**\n * The namespace for module private data.\n */\nnamespace Private {\n /**\n * The queue for launching dialogs.\n */\n export let launchQueue: Promise<Dialog.IResult<any>>[] = [];\n\n /**\n * Handle the input options for a dialog.\n *\n * @param options - The input options.\n *\n * @returns A new options object with defaults applied.\n */\n export function handleOptions<T>(\n options: Partial<Dialog.IOptions<T>> = {}\n ): Dialog.IOptions<T> {\n let buttons = options.buttons || [Dialog.cancelButton(), Dialog.okButton()];\n let defaultButton = buttons.length - 1;\n if (options.defaultButton !== undefined) {\n defaultButton = options.defaultButton;\n }\n return {\n title: options.title || '',\n body: options.body || '',\n host: options.host || document.body,\n buttons,\n defaultButton,\n renderer: options.renderer || Dialog.defaultRenderer,\n focusNodeSelector: options.focusNodeSelector || ''\n };\n }\n\n /**\n * Find the first focusable item in the dialog.\n */\n export function findFirstFocusable(node: HTMLElement): HTMLElement {\n let candidateSelectors = [\n 'input',\n 'select',\n 'a[href]',\n 'textarea',\n 'button',\n '[tabindex]'\n ].join(',');\n return node.querySelectorAll(candidateSelectors)[0] as HTMLElement;\n }\n}\n"]}
|
package/lib/domutils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"domutils.js","sourceRoot":"","sources":["../../../../apputils/src/domutils.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAE3D,mDAA+C;AAE/C,iDAAgD;AAEhD;;GAEG;AACH,IAAiB,QAAQ,CAuBxB;AAvBD,WAAiB,QAAQ;IACvB;;OAEG;IACH,sBACE,KAAqC,EACrC,CAAS,EACT,CAAS;QAET,OAAO,oBAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;YAC3C,OAAO,qBAAU,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC;IARe,qBAAY,eAQ3B,CAAA;IAED;;OAEG;IACH,qBACE,MAAmB,EACnB,SAAiB;QAEjB,OAAO,MAAM,CAAC,aAAa,CAAC,IAAI,SAAS,EAAE,CAAgB,CAAC;IAC9D,CAAC;IALe,oBAAW,cAK1B,CAAA;AACH,CAAC,EAvBgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAuBxB","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ArrayExt } from '@phosphor/algorithm';\n\nimport { ElementExt } from '@phosphor/domutils';\n\n/**\n * The namespace for DOM utilities.\n */\nexport namespace DOMUtils {\n /**\n * Get the index of the node at a client position, or `-1`.\n */\n export function hitTestNodes(\n nodes: HTMLElement[] | HTMLCollection,\n x: number,\n y: number\n ): number {\n return ArrayExt.findFirstIndex(nodes, node => {\n return ElementExt.hitTest(node, x, y);\n });\n }\n\n /**\n * Find the first element matching a class name.\n */\n export function findElement(\n parent: HTMLElement,\n className: string\n ): HTMLElement {\n return parent.querySelector(`.${className}`) as HTMLElement;\n }\n}\n"]}
|
package/lib/hoverbox.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hoverbox.js","sourceRoot":"","sources":["../../../../apputils/src/hoverbox.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAE3D;;GAEG;AACH,MAAM,cAAc,GAAG,aAAa,CAAC;AAErC;;GAEG;AACH,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAE3C;;GAEG;AACH,IAAiB,QAAQ,CAmLxB;AAnLD,WAAiB,QAAQ;IA6EvB;;;;OAIG;IACH,qBAA4B,OAAiB;QAC3C,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;QAElD,4CAA4C;QAC5C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAEnC,yEAAyE;QACzE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QAEpC,oDAAoD;QACpD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;YACtE,OAAO;SACR;QAED,uCAAuC;QACvC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;QAE1B,6CAA6C;QAC7C,IAAI,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M,CAAC;QAE1B,2DAA2D;QAC3D,IAAI,IAAI,CAAC,YAAY,IAAI,SAAS,EAAE;YAClC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAChE,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;SACpB;QAED,kCAAkC;QAClC,IAAI,KAAK,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAC;QAC/C,IAAI,KAAK,GAAG,MAAM,CAAC,UAAU,EAAE;YAC7B,IAAI,IAAI,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC;YAClC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;SAC1C;IACH,CAAC;IAhGe,oBAAW,cAgG1B,CAAA;AACH,CAAC,EAnLgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAmLxB","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n/**\n * The class name added to all hover boxes.\n */\nconst HOVERBOX_CLASS = 'jp-HoverBox';\n\n/**\n * The class name added to a hovering node that is scrolled out of view.\n */\nconst OUTOFVIEW_CLASS = 'jp-mod-outofview';\n\n/**\n * A namespace for `HoverBox` members.\n */\nexport namespace HoverBox {\n /**\n * Options for setting the geometry of a hovering node and its anchor node.\n */\n export interface IOptions {\n /**\n * The referent anchor rectangle to which the hover box is bound.\n *\n * #### Notes\n * In an editor context, this value will typically be the cursor's\n * coordinate position, which can be retrieved via calling the\n * `getCoordinateForPosition` method.\n */\n anchor: ClientRect;\n\n /**\n * The node that hosts the anchor.\n *\n * #### Notes\n * The visibility of the anchor rectangle within this host node is the\n * heuristic that determines whether the hover box ought to be visible.\n */\n host: HTMLElement;\n\n /**\n * The maximum height of a hover box.\n *\n * #### Notes\n * This value is only used if a CSS max-height attribute is not set for the\n * hover box. It is a fallback value.\n */\n maxHeight: number;\n\n /**\n * The minimum height of a hover box.\n */\n minHeight: number;\n\n /**\n * The hover box node.\n */\n node: HTMLElement;\n\n /**\n * Optional pixel offset values added to where the hover box should render.\n *\n * #### Notes\n * This option is useful for passing in values that may pertain to CSS\n * borders or padding in cases where the text inside the hover box may need\n * to align with the text of the referent editor.\n *\n * Because the hover box calculation may render a box either above or below\n * the cursor, the `vertical` offset accepts `above` and `below` values for\n * the different render modes.\n */\n offset?: {\n horizontal?: number;\n vertical?: { above?: number; below?: number };\n };\n\n /**\n * If space is available both above and below the anchor, denote which\n * location is privileged. Use forceBelow and forceAbove to mandate where\n * hover box should render relative to anchor.\n *\n * #### Notes\n * The default value is `'below'`.\n */\n privilege?: 'above' | 'below' | 'forceAbove' | 'forceBelow';\n\n /**\n * If the style of the node has already been computed, it can be passed into\n * the hover box for geometry calculation.\n */\n style?: CSSStyleDeclaration;\n }\n\n /**\n * Set the visible dimensions of a hovering box anchored to an editor cursor.\n *\n * @param options - The hover box geometry calculation options.\n */\n export function setGeometry(options: IOptions): void {\n const { anchor, host, node, privilege } = options;\n\n // Add hover box class if it does not exist.\n node.classList.add(HOVERBOX_CLASS);\n\n // Hide the hover box before querying the DOM for the anchor coordinates.\n node.classList.add(OUTOFVIEW_CLASS);\n\n // If the current coordinates are not visible, bail.\n if (!host.contains(document.elementFromPoint(anchor.left, anchor.top))) {\n return;\n }\n\n // Clear any previously set max-height.\n node.style.maxHeight = '';\n\n // Clear any programmatically set margin-top.\n node.style.marginTop = '';\n\n // Make sure the node is visible so that its dimensions can be queried.\n node.classList.remove(OUTOFVIEW_CLASS);\n\n const style = options.style || window.getComputedStyle(node);\n const innerHeight = window.innerHeight;\n const spaceAbove = anchor.top;\n const spaceBelow = innerHeight - anchor.bottom;\n const marginTop = parseInt(style.marginTop!, 10) || 0;\n const minHeight = parseInt(style.minHeight!, 10) || options.minHeight;\n\n let maxHeight = parseInt(style.maxHeight!, 10) || options.maxHeight;\n\n // Determine whether to render above or below; check privilege.\n const renderBelow =\n privilege === 'forceAbove'\n ? false\n : privilege === 'forceBelow'\n ? true\n : privilege === 'above'\n ? spaceAbove < maxHeight && spaceAbove < spaceBelow\n : spaceBelow >= maxHeight || spaceBelow >= spaceAbove;\n\n if (renderBelow) {\n maxHeight = Math.min(spaceBelow - marginTop, maxHeight);\n } else {\n maxHeight = Math.min(spaceAbove, maxHeight);\n // If the box renders above the text, its top margin is irrelevant.\n node.style.marginTop = '0px';\n }\n node.style.maxHeight = `${maxHeight}px`;\n\n // Make sure the box ought to be visible.\n const withinBounds =\n maxHeight > minHeight &&\n (spaceBelow >= minHeight || spaceAbove >= minHeight);\n\n if (!withinBounds) {\n node.classList.add(OUTOFVIEW_CLASS);\n return;\n }\n\n // Position the box vertically.\n const offsetAbove =\n (options.offset &&\n options.offset.vertical &&\n options.offset.vertical.above) ||\n 0;\n const offsetBelow =\n (options.offset &&\n options.offset.vertical &&\n options.offset.vertical.below) ||\n 0;\n const top = renderBelow\n ? innerHeight - spaceBelow + offsetBelow\n : spaceAbove - node.getBoundingClientRect().height + offsetAbove;\n node.style.top = `${Math.floor(top)}px`;\n\n // Position the box horizontally.\n const offsetHorizontal = (options.offset && options.offset.horizontal) || 0;\n let left = anchor.left + offsetHorizontal;\n\n node.style.left = `${Math.ceil(left)}px`;\n node.style.width = 'auto';\n\n // Expand the menu width by the scrollbar size, if present.\n if (node.scrollHeight >= maxHeight) {\n node.style.width = `${2 * node.offsetWidth - node.clientWidth}`;\n node.scrollTop = 0;\n }\n\n // Move left to fit in the window.\n let right = node.getBoundingClientRect().right;\n if (right > window.innerWidth) {\n left -= right - window.innerWidth;\n node.style.left = `${Math.ceil(left)}px`;\n }\n }\n}\n"]}
|
package/lib/iframe.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"iframe.js","sourceRoot":"","sources":["../../../../apputils/src/iframe.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAE3D,+CAA2C;AAE3C;;GAEG;AACH,YAAoB,SAAQ,gBAAM;IAChC;;OAEG;IACH;QACE,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACtC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAE,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IACtE,CAAC;IACD,IAAI,GAAG,CAAC,GAAW;QACjB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAE,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC9D,CAAC;CACF;AAlBD,wBAkBC;AAED;;GAEG;AACH,IAAU,OAAO,CAYhB;AAZD,WAAU,OAAO;IACf;;OAEG;IACH;QACE,IAAI,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC9C,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QAC7B,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC;QAC5B,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAPe,kBAAU,aAOzB,CAAA;AACH,CAAC,EAZS,OAAO,KAAP,OAAO,QAYhB","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { Widget } from '@phosphor/widgets';\n\n/**\n * A phosphor widget which wraps an IFrame.\n */\nexport class IFrame extends Widget {\n /**\n * Create a new IFrame widget.\n */\n constructor() {\n super({ node: Private.createNode() });\n this.addClass('jp-IFrame');\n }\n\n /**\n * The url of the IFrame.\n */\n get url(): string {\n return this.node.querySelector('iframe')!.getAttribute('src') || '';\n }\n set url(url: string) {\n this.node.querySelector('iframe')!.setAttribute('src', url);\n }\n}\n\n/**\n * A namespace for private data.\n */\nnamespace Private {\n /**\n * Create the main content node of an iframe widget.\n */\n export function createNode(): HTMLElement {\n let node = document.createElement('div');\n let iframe = document.createElement('iframe');\n iframe.style.height = '100%';\n iframe.style.width = '100%';\n node.appendChild(iframe);\n return node;\n }\n}\n"]}
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../apputils/src/index.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;;;;AAE3D,8BAA4B;AAE5B,qCAAgC;AAChC,iCAA4B;AAC5B,qCAAgC;AAChC,sCAAiC;AACjC,8BAAyB;AACzB,gCAA2B;AAC3B,gCAA2B;AAC3B,8BAAyB;AACzB,uCAAkC;AAClC,sCAAiC;AACjC,iCAA4B;AAC5B,+BAA0B;AAC1B,8BAAyB;AACzB,+BAA0B;AAC1B,oCAA+B;AAC/B,+BAA0B;AAC1B,4BAAuB;AACvB,sCAAiC","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport '../style/index.css';\n\nexport * from './clientsession';\nexport * from './clipboard';\nexport * from './commandlinker';\nexport * from './commandpalette';\nexport * from './dialog';\nexport * from './domutils';\nexport * from './hoverbox';\nexport * from './iframe';\nexport * from './instancetracker';\nexport * from './mainareawidget';\nexport * from './sanitizer';\nexport * from './spinner';\nexport * from './splash';\nexport * from './styling';\nexport * from './thememanager';\nexport * from './toolbar';\nexport * from './vdom';\nexport * from './windowresolver';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instancetracker.js","sourceRoot":"","sources":["../../../../apputils/src/instancetracker.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAI3D,mDAA2D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ACU,oBAAY,GAAG,IAAI,6BAAgB,CAAiB;QAC/D,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE;KACjB,CAAC,CAAC;AACL,CAAC,EAhBS,OAAO,KAAP,OAAO,QAgBhB","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { IStateDB } from '@jupyterlab/coreutils';\n\nimport { ArrayExt, each, find } from '@phosphor/algorithm';\n\nimport { CommandRegistry } from '@phosphor/commands';\n\nimport { ReadonlyJSONObject } from '@phosphor/coreutils';\n\nimport { IDisposable } from '@phosphor/disposable';\n\nimport { AttachedProperty } from '@phosphor/properties';\n\nimport { ISignal, Signal } from '@phosphor/signaling';\n\nimport { FocusTracker, Widget } from '@phosphor/widgets';\n\n/**\n * An object that tracks widget instances.\n */\nexport interface IInstanceTracker<T extends Widget> extends IDisposable {\n /**\n * A signal emitted when the current widget changes.\n *\n * #### Notes\n * If the last widget being tracked is disposed, `null` will be emitted.\n */\n readonly currentChanged: ISignal<this, T | null>;\n\n /**\n * A signal emitted when a widget is added.\n *\n * #### Notes\n * This signal will only fire when a widget is added to the tracker. It will\n * not fire if a widget is injected into the tracker.\n */\n readonly widgetAdded: ISignal<this, T>;\n\n /**\n * The current widget is the most recently focused or added widget.\n *\n * #### Notes\n * It is the most recently focused widget, or the most recently added\n * widget if no widget has taken focus.\n */\n readonly currentWidget: T | null;\n\n /**\n * The number of widgets held by the tracker.\n */\n readonly size: number;\n\n /**\n * Find the first widget in the tracker that satisfies a filter function.\n *\n * @param - fn The filter function to call on each widget.\n *\n * #### Notes\n * If no widget is found, the value returned is `undefined`.\n */\n find(fn: (widget: T) => boolean): T | undefined;\n\n /**\n * Iterate through each widget in the tracker.\n *\n * @param fn - The function to call on each widget.\n */\n forEach(fn: (widget: T) => void): void;\n\n /**\n * Filter the widgets in the tracker based on a predicate.\n *\n * @param fn - The function by which to filter.\n */\n filter(fn: (widget: T) => boolean): T[];\n\n /**\n * Check if this tracker has the specified widget.\n *\n * @param widget - The widget whose existence is being checked.\n */\n has(widget: Widget): boolean;\n\n /**\n * Inject a foreign widget into the instance tracker.\n *\n * @param widget - The widget to inject into the tracker.\n *\n * #### Notes\n * Any widgets injected into an instance tracker will not have their state\n * saved by the tracker. The primary use case for widget injection is for a\n * plugin that offers a sub-class of an extant plugin to have its instances\n * share the same commands as the parent plugin (since most relevant commands\n * will use the `currentWidget` of the parent plugin's instance tracker). In\n * this situation, the sub-class plugin may well have its own instance tracker\n * for layout and state restoration in addition to injecting its widgets into\n * the parent plugin's instance tracker.\n */\n inject(widget: T): void;\n}\n\n/**\n * A class that keeps track of widget instances on an Application shell.\n *\n * #### Notes\n * The API surface area of this concrete implementation is substantially larger\n * than the instance tracker interface it implements. The interface is intended\n * for export by JupyterLab plugins that create widgets and have clients who may\n * wish to keep track of newly created widgets. This class, however, can be used\n * internally by plugins to restore state as well.\n */\nexport class InstanceTracker<T extends Widget>\n implements IInstanceTracker<T>, IDisposable {\n /**\n * Create a new instance tracker.\n *\n * @param options - The instantiation options for an instance tracker.\n */\n constructor(options: InstanceTracker.IOptions) {\n this.namespace = options.namespace;\n this._tracker.currentChanged.connect(this._onCurrentChanged, this);\n }\n\n /**\n * A signal emitted when the current widget changes.\n */\n get currentChanged(): ISignal<this, T | null> {\n return this._currentChanged;\n }\n\n /**\n * A signal emitted when a widget is added.\n *\n * #### Notes\n * This signal will only fire when a widget is added to the tracker. It will\n * not fire if a widget is injected into the tracker.\n */\n get widgetAdded(): ISignal<this, T> {\n return this._widgetAdded;\n }\n\n /**\n * A signal emitted when a widget is updated.\n */\n get widgetUpdated(): ISignal<this, T> {\n return this._widgetUpdated;\n }\n\n /**\n * A namespace for all tracked widgets, (e.g., `notebook`).\n */\n readonly namespace: string;\n\n /**\n * The current widget is the most recently focused or added widget.\n *\n * #### Notes\n * It is the most recently focused widget, or the most recently added\n * widget if no widget has taken focus.\n */\n get currentWidget(): T | null {\n return this._currentWidget;\n }\n\n /**\n * The number of widgets held by the tracker.\n */\n get size(): number {\n return this._tracker.widgets.length;\n }\n\n /**\n * Add a new widget to the tracker.\n *\n * @param widget - The widget being added.\n */\n add(widget: T): Promise<void> {\n if (this._tracker.has(widget)) {\n let warning = `${widget.id} already exists in the tracker.`;\n console.warn(warning);\n return Promise.reject(warning);\n }\n this._tracker.add(widget);\n this._widgets.push(widget);\n\n let injected = Private.injectedProperty.get(widget);\n let promise: Promise<void> = Promise.resolve(void 0);\n\n if (injected) {\n return promise;\n }\n\n widget.disposed.connect(this._onWidgetDisposed, this);\n\n // Handle widget state restoration.\n if (this._restore) {\n let { state } = this._restore;\n let widgetName = this._restore.name(widget);\n\n if (widgetName) {\n let name = `${this.namespace}:${widgetName}`;\n let data = this._restore.args(widget);\n\n Private.nameProperty.set(widget, name);\n promise = state.save(name, { data });\n }\n }\n\n // If there is no focused widget, set this as the current widget.\n if (!this._tracker.currentWidget) {\n this._currentWidget = widget;\n this.onCurrentChanged(widget);\n this._currentChanged.emit(widget);\n }\n\n // Emit the widget added signal.\n this._widgetAdded.emit(widget);\n\n return promise;\n }\n\n /**\n * Test whether the tracker is disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n Signal.clearData(this);\n this._tracker.dispose();\n }\n\n /**\n * Find the first widget in the tracker that satisfies a filter function.\n *\n * @param - fn The filter function to call on each widget.\n *\n * #### Notes\n * If no widget is found, the value returned is `undefined`.\n */\n find(fn: (widget: T) => boolean): T | undefined {\n return find(this._tracker.widgets, fn);\n }\n\n /**\n * Iterate through each widget in the tracker.\n *\n * @param fn - The function to call on each widget.\n */\n forEach(fn: (widget: T) => void): void {\n each(this._tracker.widgets, widget => {\n fn(widget);\n });\n }\n\n /**\n * Filter the widgets in the tracker based on a predicate.\n *\n * @param fn - The function by which to filter.\n */\n filter(fn: (widget: T) => boolean): T[] {\n return this._tracker.widgets.filter(fn);\n }\n\n /**\n * Inject a foreign widget into the instance tracker.\n *\n * @param widget - The widget to inject into the tracker.\n *\n * #### Notes\n * Any widgets injected into an instance tracker will not have their state\n * saved by the tracker. The primary use case for widget injection is for a\n * plugin that offers a sub-class of an extant plugin to have its instances\n * share the same commands as the parent plugin (since most relevant commands\n * will use the `currentWidget` of the parent plugin's instance tracker). In\n * this situation, the sub-class plugin may well have its own instance tracker\n * for layout and state restoration in addition to injecting its widgets into\n * the parent plugin's instance tracker.\n */\n inject(widget: T): void {\n Private.injectedProperty.set(widget, true);\n this.add(widget);\n }\n\n /**\n * Check if this tracker has the specified widget.\n *\n * @param widget - The widget whose existence is being checked.\n */\n has(widget: Widget): boolean {\n return this._tracker.has(widget as any);\n }\n\n /**\n * Restore the widgets in this tracker's namespace.\n *\n * @param options - The configuration options that describe restoration.\n *\n * @returns A promise that resolves when restoration has completed.\n *\n * #### Notes\n * This function should almost never be invoked by client code. Its primary\n * use case is to be invoked by a layout restorer plugin that handles\n * multiple instance trackers and, when ready, asks them each to restore their\n * respective widgets.\n */\n restore(options: InstanceTracker.IRestoreOptions<T>): Promise<any> {\n const { command, registry, state, when } = options;\n const namespace = this.namespace;\n const promises = when\n ? [state.fetchNamespace(namespace)].concat(when)\n : [state.fetchNamespace(namespace)];\n\n this._restore = options;\n\n return Promise.all(promises).then(([saved]) => {\n return Promise.all(\n saved.map(item => {\n const { id, value } = item;\n const args = value && (value as any).data;\n if (args === undefined) {\n return state.remove(item.id);\n }\n\n // Execute the command and if it fails, delete the state restore data.\n return registry.execute(command, args).catch(() => state.remove(id));\n })\n );\n });\n }\n\n /**\n * Save the restore data for a given widget.\n *\n * @param widget - The widget being saved.\n */\n save(widget: T): void {\n const injected = Private.injectedProperty.get(widget);\n\n if (!this._restore || !this.has(widget) || injected) {\n return;\n }\n\n const { state } = this._restore;\n const widgetName = this._restore.name(widget);\n const oldName = Private.nameProperty.get(widget);\n const newName = widgetName ? `${this.namespace}:${widgetName}` : '';\n\n if (oldName && oldName !== newName) {\n state.remove(oldName);\n }\n\n // Set the name property irrespective of whether the new name is null.\n Private.nameProperty.set(widget, newName);\n\n if (newName) {\n const data = this._restore.args(widget);\n state.save(newName, { data });\n }\n\n if (oldName !== newName) {\n this._widgetUpdated.emit(widget);\n }\n }\n\n /**\n * Handle the current change event.\n *\n * #### Notes\n * The default implementation is a no-op.\n */\n protected onCurrentChanged(value: T | null): void {\n /* no-op */\n }\n\n /**\n * Handle the current change signal from the internal focus tracker.\n */\n private _onCurrentChanged(\n sender: any,\n args: FocusTracker.IChangedArgs<T>\n ): void {\n // Bail if the active widget did not change.\n if (args.newValue === this._currentWidget) {\n return;\n }\n\n this._currentWidget = args.newValue;\n this.onCurrentChanged(args.newValue);\n this._currentChanged.emit(args.newValue);\n }\n\n /**\n * Clean up after disposed widgets.\n */\n private _onWidgetDisposed(widget: T): void {\n const injected = Private.injectedProperty.get(widget);\n\n if (injected) {\n return;\n }\n\n // Handle widget removal.\n ArrayExt.removeFirstOf(this._widgets, widget);\n\n // Handle the current widget being disposed.\n if (widget === this._currentWidget) {\n this._currentWidget =\n this._tracker.currentWidget ||\n this._widgets[this._widgets.length - 1] ||\n null;\n this._currentChanged.emit(this._currentWidget);\n this.onCurrentChanged(this._currentWidget);\n }\n\n // If there is no restore data, return.\n if (!this._restore) {\n return;\n }\n\n const { state } = this._restore;\n const name = Private.nameProperty.get(widget);\n\n if (name) {\n state.remove(name);\n }\n }\n\n private _restore: InstanceTracker.IRestoreOptions<T> | null = null;\n private _tracker = new FocusTracker<T>();\n private _currentChanged = new Signal<this, T | null>(this);\n private _widgetAdded = new Signal<this, T>(this);\n private _widgetUpdated = new Signal<this, T>(this);\n private _widgets: T[] = [];\n private _currentWidget: T | null = null;\n private _isDisposed = false;\n}\n\n/**\n * A namespace for `InstanceTracker` statics.\n */\nexport namespace InstanceTracker {\n /**\n * The instantiation options for an instance tracker.\n */\n export interface IOptions {\n /**\n * A namespace for all tracked widgets, (e.g., `notebook`).\n */\n namespace: string;\n }\n\n /**\n * The state restoration configuration options.\n */\n export interface IRestoreOptions<T extends Widget> {\n /**\n * The command to execute when restoring instances.\n */\n command: string;\n\n /**\n * A function that returns the args needed to restore an instance.\n */\n args: (widget: T) => ReadonlyJSONObject;\n\n /**\n * A function that returns a unique persistent name for this instance.\n */\n name: (widget: T) => string;\n\n /**\n * The command registry which holds the restore command.\n */\n registry: CommandRegistry;\n\n /**\n * The state database instance.\n */\n state: IStateDB;\n\n /**\n * The point after which it is safe to restore state.\n *\n * #### Notes\n * By definition, this promise or promises will happen after the application\n * has `started`.\n */\n when?: Promise<any> | Array<Promise<any>>;\n }\n}\n\n/*\n * A namespace for private data.\n */\nnamespace Private {\n /**\n * An attached property to indicate whether a widget has been injected.\n */\n export const injectedProperty = new AttachedProperty<Widget, boolean>({\n name: 'injected',\n create: () => false\n });\n\n /**\n * An attached property for a widget's ID in the state database.\n */\n export const nameProperty = new AttachedProperty<Widget, string>({\n name: 'name',\n create: () => ''\n });\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mainareawidget.js","sourceRoot":"","sources":["../../../../apputils/src/mainareawidget.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAE3D,mDAA2C;AAI3C,+CAAsD;AAEtD,uCAAoC;AAEpC,uCAAoC;AAEpC;;;;;;;;GAQG;AACH,oBAAuD,SAAQ,gBAAM;IACnE;;;;OAIG;IACH,YAAY,OAAmC;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;QAwNT,iBAAY,GAAG,KAAK,CAAC;QACrB,aAAQ,GAAG,IAAI,iBAAO,EAAE,CAAC;QAEzB,gBAAW,GAAG,KAAK,CAAC;QA1N1B,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QACnC,IAAI,CAAC,EAAE,GAAG,gBAAI,CAAC,KAAK,EAAE,CAAC;QAEvB,MAAM,OAAO,GAAG,CAAC,IAAI,CA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CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;CASF;AApOD,wCAoOC","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { UUID } from '@phosphor/coreutils';\n\nimport { Message } from '@phosphor/messaging';\n\nimport { BoxLayout, Widget } from '@phosphor/widgets';\n\nimport { Spinner } from './spinner';\n\nimport { Toolbar } from './toolbar';\n\n/**\n * A widget meant to be contained in the JupyterLab main area.\n *\n * #### Notes\n * Mirrors all of the `title` attributes of the content.\n * This widget is `closable` by default.\n * This widget is automatically disposed when closed.\n * This widget ensures its own focus when activated.\n */\nexport class MainAreaWidget<T extends Widget = Widget> extends Widget {\n /**\n * Construct a new main area widget.\n *\n * @param options - The options for initializing the widget.\n */\n constructor(options: MainAreaWidget.IOptions<T>) {\n super(options);\n this.addClass('jp-MainAreaWidget');\n this.id = UUID.uuid4();\n\n const content = (this._content = options.content);\n const toolbar = (this._toolbar = options.toolbar || new Toolbar());\n const spinner = this._spinner;\n\n const layout = (this.layout = new BoxLayout({ spacing: 0 }));\n layout.direction = 'top-to-bottom';\n BoxLayout.setStretch(toolbar, 0);\n BoxLayout.setStretch(content, 1);\n layout.addWidget(toolbar);\n layout.addWidget(content);\n\n if (!content.id) {\n content.id = UUID.uuid4();\n }\n content.node.tabIndex = -1;\n\n this._updateTitle();\n content.title.changed.connect(this._updateTitle, this);\n this.title.closable = true;\n this.title.changed.connect(this._updateContentTitle, this);\n\n if (options.reveal) {\n this.node.appendChild(spinner.node);\n this._revealed = options.reveal\n .then(() => {\n if (content.isDisposed) {\n this.dispose();\n return;\n }\n content.disposed.connect(() => this.dispose());\n const active = document.activeElement === spinner.node;\n this.node.removeChild(spinner.node);\n spinner.dispose();\n this._isRevealed = true;\n if (active) {\n this._focusContent();\n }\n })\n .catch(e => {\n // Show a revealed promise error.\n const error = new Widget();\n // Show the error to the user.\n const pre = document.createElement('pre');\n pre.textContent = String(e);\n error.node.appendChild(pre);\n BoxLayout.setStretch(error, 1);\n this.node.removeChild(spinner.node);\n spinner.dispose();\n content.dispose();\n this._content = null;\n toolbar.dispose();\n this._toolbar = null;\n layout.addWidget(error);\n this._isRevealed = true;\n throw error;\n });\n } else {\n // Handle no reveal promise.\n spinner.dispose();\n content.disposed.connect(() => this.dispose());\n this._isRevealed = true;\n this._revealed = Promise.resolve(undefined);\n }\n }\n\n /**\n * The content hosted by the widget.\n */\n get content(): T {\n return this._content;\n }\n\n /**\n * The toolbar hosted by the widget.\n */\n get toolbar(): Toolbar {\n return this._toolbar;\n }\n\n /**\n * Whether the content widget or an error is revealed.\n */\n get isRevealed(): boolean {\n return this._isRevealed;\n }\n\n /**\n * A promise that resolves when the widget is revealed.\n */\n get revealed(): Promise<void> {\n return this._revealed;\n }\n\n /**\n * Handle the DOM events for the widget.\n *\n * @param event - The DOM event sent to the widget.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the main area widget's node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'mouseup':\n case 'mouseout':\n let target = event.target as HTMLElement;\n if (\n this._isRevealed &&\n this._content &&\n this.toolbar.node.contains(document.activeElement) &&\n target.tagName !== 'SELECT'\n ) {\n this._focusContent();\n }\n break;\n default:\n break;\n }\n }\n\n /**\n * Handle `after-attach` messages for the widget.\n */\n protected onAfterAttach(msg: Message): void {\n this.toolbar.node.addEventListener('mouseup', this);\n this.toolbar.node.addEventListener('mouseout', this);\n }\n\n /**\n * Handle `before-detach` messages for the widget.\n */\n protected onBeforeDetach(msg: Message): void {\n this.toolbar.node.removeEventListener('mouseup', this);\n this.toolbar.node.removeEventListener('mouseout', this);\n }\n\n /**\n * Handle `'activate-request'` messages.\n */\n protected onActivateRequest(msg: Message): void {\n if (this._isRevealed) {\n if (this._content) {\n this._focusContent();\n }\n } else {\n this._spinner.node.focus();\n }\n }\n\n /**\n * Handle `'close-request'` messages.\n */\n protected onCloseRequest(msg: Message): void {\n this.dispose();\n }\n\n /**\n * Update the title based on the attributes of the child widget.\n */\n private _updateTitle(): void {\n if (this._changeGuard) {\n return;\n }\n this._changeGuard = true;\n const content = this.content;\n this.title.label = content.title.label;\n this.title.mnemonic = content.title.mnemonic;\n this.title.iconClass = content.title.iconClass;\n this.title.iconLabel = content.title.iconLabel;\n this.title.caption = content.title.caption;\n this.title.className = content.title.className;\n this.title.dataset = content.title.dataset;\n this._changeGuard = false;\n }\n\n /**\n * Update the content title based on attributes of the main widget.\n */\n private _updateContentTitle(): void {\n if (this._changeGuard) {\n return;\n }\n this._changeGuard = true;\n const content = this.content;\n content.title.label = this.title.label;\n content.title.mnemonic = this.title.mnemonic;\n content.title.iconClass = this.title.iconClass;\n content.title.iconLabel = this.title.iconLabel;\n content.title.caption = this.title.caption;\n content.title.className = this.title.className;\n content.title.dataset = this.title.dataset;\n this._changeGuard = false;\n }\n\n /**\n * Give focus to the content.\n */\n private _focusContent(): void {\n // Focus the content node if we aren't already focused on it or a\n // descendent.\n if (!this.content.node.contains(document.activeElement)) {\n this.content.node.focus();\n }\n\n // Activate the content asynchronously (which may change the focus).\n this.content.activate();\n }\n\n private _content: T;\n private _toolbar: Toolbar;\n private _changeGuard = false;\n private _spinner = new Spinner();\n\n private _isRevealed = false;\n private _revealed: Promise<void>;\n}\n\n/**\n * The namespace for the `MainAreaWidget` class statics.\n */\nexport namespace MainAreaWidget {\n /**\n * An options object for creating a main area widget.\n */\n export interface IOptions<T extends Widget = Widget> extends Widget.IOptions {\n /**\n * The child widget to wrap.\n */\n content: T;\n\n /**\n * The toolbar to use for the widget. Defaults to an empty toolbar.\n */\n toolbar?: Toolbar;\n\n /**\n * An optional promise for when the content is ready to be revealed.\n */\n reveal?: Promise<any>;\n }\n\n /**\n * An options object for main area widget subclasses providing their own\n * default content.\n *\n * #### Notes\n * This makes it easier to have a subclass that provides its own default\n * content. This can go away once we upgrade to TypeScript 2.8 and have an\n * easy way to make a single property optional, ala\n * https://stackoverflow.com/a/46941824\n */\n export interface IOptionsOptionalContent<T extends Widget = Widget>\n extends Widget.IOptions {\n /**\n * The child widget to wrap.\n */\n content?: T;\n\n /**\n * The toolbar to use for the widget. Defaults to an empty toolbar.\n */\n toolbar?: Toolbar;\n\n /**\n * An optional promise for when the content is ready to be revealed.\n */\n reveal?: Promise<any>;\n }\n}\n"]}
|
package/lib/sanitizer.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizer.js","sourceRoot":"","sources":["../../../../apputils/src/sanitizer.ts"],"names":[],"mappings":";;;;;AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D,kEAAqC;AAmCrC;;GAEG;AACH;IAAA;QAcU,aAAQ,GAAsB;YACpC,WAAW,EAAE,uBAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CAC/C,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,SAAS,EACT,SAAS,EACT,OAAO,CACR;YACD,iBAAiB,EAAE;gBACjB,0CAA0C;gBAC1C,CAAC,EAAE,uBAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBACzD,4CAA4C;gBAC5C,GAAG,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC;gBACtC,uEAAuE;gBACvE,KAAK,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC;gBACtC,2CAA2C;gBAC3C,IAAI,EAAE,CAAC,OAAO,CAAC;gBACf,2CAA2C;gBAC3C,IAAI,EAAE,CAAC,OAAO,CAAC;gBACf,0CAA0C;gBAC1C,GAAG,EAAE,CAAC,OAAO,CAAC;gBACd,wCAAwC;gBACxC,CAAC,EAAE,CAAC,OAAO,CAAC;gBACZ,0CAA0C;gBAC1C,GAAG,EAAE,CAAC,OAAO,CAAC;gBACd,8CAA8C;gBAC9C,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC;gBACvD,8CAA8C;gBAC9C,KAAK,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC;aAC3E;YACD,aAAa,EAAE;gBACb,sDAAsD;gBACtD,CAAC,EAAE,uBAAQ,CAAC,eAAe,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;gBACrD,iDAAiD;gBACjD,KAAK,EAAE,uBAAQ,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;aACnE;YACD,mBAAmB,EAAE;gBACnB,oEAAoE;gBACpE,GAAG,EAAE,uBAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;aAC7D;SACF,CAAC;IACJ,CAAC;IA9DC;;;;;;;;OAQG;IACH,QAAQ,CAAC,KAAa,EAAE,OAA6B;QACnD,OAAO,uBAAQ,CAAC,KAAK,oBAAO,IAAI,CAAC,QAAQ,EAAK,CAAC,OAAO,IAAI,EAAE,CAAC,EAAG,CAAC;IACnE,CAAC;CAmDF;AAED;;GAEG;AACU,QAAA,gBAAgB,GAAe,IAAI,SAAS,EAAE,CAAC","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport sanitize from 'sanitize-html';\n\nexport interface ISanitizer {\n /**\n * Sanitize an HTML string.\n *\n * @param dirty - The dirty text.\n *\n * @param options - The optional sanitization options.\n *\n * @returns The sanitized string.\n */\n sanitize(dirty: string, options?: ISanitizer.IOptions): string;\n}\n\n/**\n * The namespace for `ISanitizer` related interfaces.\n */\nexport namespace ISanitizer {\n /**\n * The options used to sanitize.\n */\n export interface IOptions {\n /**\n * The allowed tags.\n */\n allowedTags?: string[];\n\n /**\n * The allowed attributes for a given tag.\n */\n allowedAttributes?: { [key: string]: string[] };\n }\n}\n\n/**\n * A class to sanitize HTML strings.\n */\nclass Sanitizer implements ISanitizer {\n /**\n * Sanitize an HTML string.\n *\n * @param dirty - The dirty text.\n *\n * @param options - The optional sanitization options.\n *\n * @returns The sanitized string.\n */\n sanitize(dirty: string, options?: ISanitizer.IOptions): string {\n return sanitize(dirty, { ...this._options, ...(options || {}) });\n }\n\n private _options: sanitize.IOptions = {\n allowedTags: sanitize.defaults.allowedTags.concat(\n 'h1',\n 'h2',\n 'img',\n 'span',\n 'audio',\n 'video',\n 'del',\n 'kbd',\n 'sup',\n 'sub',\n 'colspan',\n 'rowspan',\n 'input'\n ),\n allowedAttributes: {\n // Allow the \"rel\" attribute for <a> tags.\n a: sanitize.defaults.allowedAttributes['a'].concat('rel'),\n // Allow the \"src\" attribute for <img> tags.\n img: ['src', 'height', 'width', 'alt'],\n // Allow \"type\", \"disabled\", and \"checked\" attributes for <input> tags.\n input: ['type', 'disabled', 'checked'],\n // Allow \"class\" attribute for <code> tags.\n code: ['class'],\n // Allow \"class\" attribute for <span> tags.\n span: ['class'],\n // Allow \"class\" attribute for <div> tags.\n div: ['class'],\n // Allow \"class\" attribute for <p> tags.\n p: ['class'],\n // Allow \"class\" attribute for <pre> tags.\n pre: ['class'],\n // Allow the \"src\" attribute for <audio> tags.\n audio: ['src', 'autoplay', 'loop', 'muted', 'controls'],\n // Allow the \"src\" attribute for <video> tags.\n video: ['src', 'height', 'width', 'autoplay', 'loop', 'muted', 'controls']\n },\n transformTags: {\n // Set the \"rel\" attribute for <a> tags to \"nofollow\".\n a: sanitize.simpleTransform('a', { rel: 'nofollow' }),\n // Set the \"disabled\" attribute for <input> tags.\n input: sanitize.simpleTransform('input', { disabled: 'disabled' })\n },\n allowedSchemesByTag: {\n // Allow 'attachment:' img src (used for markdown cell attachments).\n img: sanitize.defaults.allowedSchemes.concat(['attachment'])\n }\n };\n}\n\n/**\n * The default instance of an `ISanitizer` meant for use by user code.\n */\nexport const defaultSanitizer: ISanitizer = new Sanitizer();\n"]}
|
package/lib/spinner.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../../../apputils/src/spinner.ts"],"names":[],"mappings":";AAAA;;;+EAG+E;;AAI/E,+CAA2C;AAE3C;;GAEG;AACH,aAAqB,SAAQ,gBAAM;IACjC;;OAEG;IACH;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;QACxB,IAAI,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC5C,OAAO,CAAC,SAAS,GAAG,mBAAmB,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,iBAAiB,CAAC,GAAY;QACtC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;CACF;AAnBD,0BAmBC","sourcesContent":["/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\nimport { Message } from '@phosphor/messaging';\n\nimport { Widget } from '@phosphor/widgets';\n\n/**\n * The spinner class.\n */\nexport class Spinner extends Widget {\n /**\n * Construct a spinner widget.\n */\n constructor() {\n super();\n this.addClass('jp-Spinner');\n this.node.tabIndex = -1;\n let content = document.createElement('div');\n content.className = 'jp-SpinnerContent';\n this.node.appendChild(content);\n }\n\n /**\n * Handle `'activate-request'` messages.\n */\n protected onActivateRequest(msg: Message): void {\n this.node.focus();\n }\n}\n"]}
|
package/lib/splash.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"splash.js","sourceRoot":"","sources":["../../../../apputils/src/splash.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAI3D,mDAA4C;AAE5C,oBAAoB;AACpB;;GAEG;AACU,QAAA,aAAa,GAAG,IAAI,iBAAK,CACpC,oCAAoC,CACrC,CAAC","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { IDisposable } from '@phosphor/disposable';\n\nimport { Token } from '@phosphor/coreutils';\n\n/* tslint:disable */\n/**\n * The main menu token.\n */\nexport const ISplashScreen = new Token<ISplashScreen>(\n '@jupyterlab/apputils:ISplashScreen'\n);\n/* tslint:enable */\n\n/**\n * The interface for an application splash screen.\n */\nexport interface ISplashScreen {\n /**\n * Show the application splash screen.\n *\n * @returns A disposable used to clear the splash screen.\n */\n show(): IDisposable;\n}\n"]}
|
package/lib/styling.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styling.js","sourceRoot":"","sources":["../../../../apputils/src/styling.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAE3D;;GAEG;AACH,IAAiB,OAAO,CA+DvB;AA/DD,WAAiB,OAAO;IACtB;;;;;;OAMG;IACH,mBAA0B,IAAiB,EAAE,SAAS,GAAG,EAAE;QACzD,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC1C,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QAC5C,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QACzC,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC5C,CAAC;IALe,iBAAS,YAKxB,CAAA;IAED;;;;;;;;OAQG;IACH,wBACE,IAAiB,EACjB,OAAe,EACf,SAAS,GAAG,EAAE;QAEd,IAAI,IAAI,CAAC,SAAS,KAAK,OAAO,EAAE;YAC9B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,eAAe,CAAC,C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AAO,KAAP,eAAO,QA+DvB;AAED;;GAEG;AACH,IAAU,OAAO,CAgBhB;AAhBD,WAAU,OAAO;IACf;;OAEG;IACH,iBAAwB,KAAiB;QACvC,IAAI,MAAM,GAAG,KAAK,CAAC,MAAiB,CAAC;QACrC,IAAI,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC;QAClC,IAAI,CAAC,MAAM,EAAE;YACX,OAAO;SACR;QACD,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;YAC1B,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;SACxC;aAAM;YACL,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;SAC3C;IACH,CAAC;IAXe,eAAO,UAWtB,CAAA;AACH,CAAC,EAhBS,OAAO,KAAP,OAAO,QAgBhB","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n/**\n * A namespace for node styling.\n */\nexport namespace Styling {\n /**\n * Style a node and its child elements with the default tag names.\n *\n * @param node - The base node.\n *\n * @param className - The optional CSS class to add to styled nodes.\n */\n export function styleNode(node: HTMLElement, className = ''): void {\n styleNodeByTag(node, 'select', className);\n styleNodeByTag(node, 'textarea', className);\n styleNodeByTag(node, 'input', className);\n styleNodeByTag(node, 'button', className);\n }\n\n /**\n * Style a node and its elements that have a given tag name.\n *\n * @param node - The base node.\n *\n * @param tagName - The html tag name to style.\n *\n * @param className - The optional CSS class to add to styled nodes.\n */\n export function styleNodeByTag(\n node: HTMLElement,\n tagName: string,\n className = ''\n ): void {\n if (node.localName === tagName) {\n node.classList.add('jp-mod-styled');\n }\n if (node.localName === 'select') {\n wrapSelect(node as HTMLSelectElement);\n }\n let nodes = node.getElementsByTagName(tagName);\n for (let i = 0; i < nodes.length; i++) {\n let child = nodes[i];\n child.classList.add('jp-mod-styled');\n if (className) {\n child.classList.add(className);\n }\n if (tagName === 'select') {\n wrapSelect(child as HTMLSelectElement);\n }\n }\n }\n\n /**\n * Wrap a select node.\n */\n export function wrapSelect(node: HTMLSelectElement): HTMLElement {\n let wrapper = document.createElement('div');\n wrapper.classList.add('jp-select-wrapper');\n node.addEventListener('focus', Private.onFocus);\n node.addEventListener('blur', Private.onFocus);\n node.classList.add('jp-mod-styled');\n if (node.parentElement) {\n node.parentElement.replaceChild(wrapper, node);\n }\n wrapper.appendChild(node);\n return wrapper;\n }\n}\n\n/**\n * The namespace for module private data.\n */\nnamespace Private {\n /**\n * Handle a focus event on a styled select.\n */\n export function onFocus(event: FocusEvent): void {\n let target = event.target as Element;\n let parent = target.parentElement;\n if (!parent) {\n return;\n }\n if (event.type === 'focus') {\n parent.classList.add('jp-mod-focused');\n } else {\n parent.classList.remove('jp-mod-focused');\n }\n }\n}\n"]}
|
package/lib/thememanager.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"thememanager.js","sourceRoot":"","sources":["../../../../apputils/src/thememanager.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAE3D,qDAA+E;AAE/E,mDAA2C;AAE3C,mDAA4C;AAE5C,qDAAuE;AAIvE,mDAAsD;AAEtD,qCAA8C;AAI9C,oBAAoB;AACpB;;GAEG;AACU,QAAA,aAAa,GAAG,IAAI,iBAAK,CACpC,oCAAoC,CACrC,CAAC;AAQF;;GAEG;AACH,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;GAEG;AACH,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B;;GAEG;AACH;IACE;;OAEG;IACH,YAAY,OAA8B;QA0NlC,aAAQ,GAAkB,IAAI,CAAC;QAE/B,WAAM,GAAsB,EAAE,CAAC;QAC/B,iBAAY,GAAyB,IAAI,CAAC;QAC1C,aAAQ,GAAG,CAAC,CAAC;QACb,cAAS,GAAgC,EAAE,CAAC;QAG5C,YAAO,GAA2C,EAAE,CAAC;QACrD,kBAAa,GAAG,IAAI,kBAAM,CAA6B,IAAI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AAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAEnE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;aAC5C,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACtB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3B,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;gBACtB,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,OAAO;gBACjB,QAAQ,EAAE,KAAK;aAChB,CAAC,CAAC;QACL,CAAC,CAAC;aACD,KAAK,CAAC,MAAM,CAAC,EAAE;YACd,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YACtB,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACK,QAAQ,CAAC,MAAW;QAC1B,mBAAU,CAAC;YACT,KAAK,EAAE,qBAAqB;YAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;YACpB,OAAO,EAAE,CAAC,eAAM,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;SAC5C,CAAC,CAAC;IACL,CAAC;CAaF;AAxOD,oCAwOC;AAoED;;GAEG;AACH,IAAU,OAAO,CAQhB;AARD,WAAU,OAAO;IACf;;OAEG;IACH,gBAAuB,MAAc;QACnC,gBAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;QAChC,MAAM,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;IAHe,cAAM,SAGrB,CAAA;AACH,CAAC,EARS,OAAO,KAAP,OAAO,QAQhB","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { IChangedArgs, ISettingRegistry, URLExt } from '@jupyterlab/coreutils';\n\nimport { each } from '@phosphor/algorithm';\n\nimport { Token } from '@phosphor/coreutils';\n\nimport { DisposableDelegate, IDisposable } from '@phosphor/disposable';\n\nimport { Widget } from '@phosphor/widgets';\n\nimport { ISignal, Signal } from '@phosphor/signaling';\n\nimport { Dialog, showDialog } from './dialog';\n\nimport { ISplashScreen } from './splash';\n\n/* tslint:disable */\n/**\n * The theme manager token.\n */\nexport const IThemeManager = new Token<IThemeManager>(\n '@jupyterlab/apputils:IThemeManager'\n);\n/* tslint:enable */\n\n/**\n * An interface for a theme manager.\n */\nexport interface IThemeManager extends ThemeManager {}\n\n/**\n * The number of milliseconds between theme loading attempts.\n */\nconst REQUEST_INTERVAL = 75;\n\n/**\n * The number of times to attempt to load a theme before giving up.\n */\nconst REQUEST_THRESHOLD = 20;\n\n/**\n * A class that provides theme management.\n */\nexport class ThemeManager {\n /**\n * Construct a new theme manager.\n */\n constructor(options: ThemeManager.IOptions) {\n const { host, key, splash, url } = options;\n const registry = options.settings;\n\n this._base = url;\n this._host = host;\n this._splash = splash;\n\n registry.load(key).then(settings => {\n this._settings = settings;\n this._settings.changed.connect(this._loadSettings, this);\n this._loadSettings();\n });\n }\n\n /**\n * Get the name of the current theme.\n */\n get theme(): string | null {\n return this._current;\n }\n\n /**\n * The names of the registered themes.\n */\n get themes(): ReadonlyArray<string> {\n return Object.keys(this._themes);\n }\n\n /**\n * A signal fired when the application theme changes.\n */\n get themeChanged(): ISignal<this, IChangedArgs<string>> {\n return this._themeChanged;\n }\n\n /**\n * Load a theme CSS file by path.\n *\n * @param path - The path of the file to load.\n */\n loadCSS(path: string): Promise<void> {\n const base = this._base;\n const href = URLExt.isLocal(path) ? URLExt.join(base, path) : path;\n const links = this._links;\n\n return new Promise((resolve, reject) => {\n const link = document.createElement('link');\n\n link.setAttribute('rel', 'stylesheet');\n link.setAttribute('type', 'text/css');\n link.setAttribute('href', href);\n link.addEventListener('load', () => {\n resolve(undefined);\n });\n link.addEventListener('error', () => {\n reject(`Stylesheet failed to load: ${href}`);\n });\n\n document.body.appendChild(link);\n links.push(link);\n });\n }\n\n /**\n * Register a theme with the theme manager.\n *\n * @param theme - The theme to register.\n *\n * @returns A disposable that can be used to unregister the theme.\n */\n register(theme: ThemeManager.ITheme): IDisposable {\n const { name } = theme;\n const themes = this._themes;\n\n if (themes[name]) {\n throw new Error(`Theme already registered for ${name}`);\n }\n\n themes[name] = theme;\n\n return new DisposableDelegate(() => {\n delete themes[name];\n });\n }\n\n /**\n * Set the current theme.\n */\n setTheme(name: string): Promise<void> {\n return this._settings.set('theme', name);\n }\n\n /**\n * Test whether a given theme is light.\n */\n isLight(name: string): boolean {\n return this._themes[name].isLight;\n }\n\n /**\n * Handle the current settings.\n */\n private _loadSettings(): void {\n const outstanding = this._outstanding;\n const pending = this._pending;\n const requests = this._requests;\n\n // If another request is pending, cancel it.\n if (pending) {\n window.clearTimeout(pending);\n this._pending = 0;\n }\n\n const settings = this._settings;\n const themes = this._themes;\n const theme = settings.composite['theme'] as string;\n\n // If another promise is outstanding, wait until it finishes before\n // attempting to load the settings. Because outstanding promises cannot\n // be aborted, the order in which they occur must be enforced.\n if (outstanding) {\n outstanding\n .then(() => {\n this._loadSettings();\n })\n .catch(() => {\n this._loadSettings();\n });\n this._outstanding = null;\n return;\n }\n\n // Increment the request counter.\n requests[theme] = requests[theme] ? requests[theme] + 1 : 1;\n\n // If the theme exists, load it right away.\n if (themes[theme]) {\n this._outstanding = this._loadTheme(theme);\n delete requests[theme];\n return;\n }\n\n // If the request has taken too long, give up.\n if (requests[theme] > REQUEST_THRESHOLD) {\n const fallback = settings.default('theme') as string;\n\n // Stop tracking the requests for this theme.\n delete requests[theme];\n\n if (!themes[fallback]) {\n this._onError(`Neither theme ${theme} nor default ${fallback} loaded.`);\n return;\n }\n\n console.warn(`Could not load theme ${theme}, using default ${fallback}.`);\n this._outstanding = this._loadTheme(fallback);\n return;\n }\n\n // If the theme does not yet exist, attempt to wait for it.\n this._pending = window.setTimeout(() => {\n this._loadSettings();\n }, REQUEST_INTERVAL);\n }\n\n /**\n * Load the theme.\n *\n * #### Notes\n * This method assumes that the `theme` exists.\n */\n private _loadTheme(theme: string): Promise<void> {\n const current = this._current;\n const links = this._links;\n const themes = this._themes;\n const splash = this._splash.show();\n\n // Unload any CSS files that have been loaded.\n links.forEach(link => {\n if (link.parentElement) {\n link.parentElement.removeChild(link);\n }\n });\n links.length = 0;\n\n // Unload the previously loaded theme.\n const old = current ? themes[current].unload() : Promise.resolve();\n\n return Promise.all([old, themes[theme].load()])\n .then(() => {\n this._current = theme;\n Private.fitAll(this._host);\n splash.dispose();\n this._themeChanged.emit({\n name: 'theme',\n oldValue: current,\n newValue: theme\n });\n })\n .catch(reason => {\n this._onError(reason);\n splash.dispose();\n });\n }\n\n /**\n * Handle a theme error.\n */\n private _onError(reason: any): void {\n showDialog({\n title: 'Error Loading Theme',\n body: String(reason),\n buttons: [Dialog.okButton({ label: 'OK' })]\n });\n }\n\n private _base: string;\n private _current: string | null = null;\n private _host: Widget;\n private _links: HTMLLinkElement[] = [];\n private _outstanding: Promise<void> | null = null;\n private _pending = 0;\n private _requests: { [theme: string]: number } = {};\n private _settings: ISettingRegistry.ISettings;\n private _splash: ISplashScreen;\n private _themes: { [key: string]: ThemeManager.ITheme } = {};\n private _themeChanged = new Signal<this, IChangedArgs<string>>(this);\n}\n\n/**\n * A namespace for `ThemeManager` statics.\n */\nexport namespace ThemeManager {\n /**\n * The options used to create a theme manager.\n */\n export interface IOptions {\n /**\n * The host widget for the theme manager.\n */\n host: Widget;\n\n /**\n * The setting registry key that holds theme setting data.\n */\n key: string;\n\n /**\n * The settings registry.\n */\n settings: ISettingRegistry;\n\n /**\n * The splash screen to show when loading themes.\n */\n splash: ISplashScreen;\n\n /**\n * The url for local theme loading.\n */\n url: string;\n }\n\n /**\n * An interface for a theme.\n */\n export interface ITheme {\n /**\n * The display name of the theme.\n */\n name: string;\n\n /**\n * Whether the theme is light or dark. Downstream authors\n * of extensions can use this information to customize their\n * UI depending upon the current theme.\n */\n isLight: boolean;\n\n /**\n * Load the theme.\n *\n * @returns A promise that resolves when the theme has loaded.\n */\n load(): Promise<void>;\n\n /**\n * Unload the theme.\n *\n * @returns A promise that resolves when the theme has unloaded.\n */\n unload(): Promise<void>;\n }\n}\n\n/**\n * A namespace for module private data.\n */\nnamespace Private {\n /**\n * Fit a widget and all of its children, recursively.\n */\n export function fitAll(widget: Widget): void {\n each(widget.children(), fitAll);\n widget.fit();\n }\n}\n"]}
|
package/lib/toolbar.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar.js","sourceRoot":"","sources":["../../../../apputils/src/toolbar.tsx"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;;;;;;;;AAE3D,iCAA4C;AAE5C,mDAAiE;AAIjE,mDAA2D;AAE3D,qDAAwD;AAExD,+CAAwD;AAIxD,6CAA+B;AAE/B;;GAEG;AACH,MAAM,aAAa,GAAG,YAAY,CAAC;AAEnC;;GAEG;AACH,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAE7C;;GAEG;AACH,MAAM,yBAAyB,GAAG,uBAAuB,CAAC;AAE1D;;GAEG;AACH,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AAEjD;;GAEG;AACH,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AAE9D;;GAEG;AACH,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEjD,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAE3C;;;;;;;GAOG;AACH,mBAAoB,SAAQ,qBAAW;IAAvC;;QA6GU,WAAM,GAAG,KAAK,CAAC;IACzB,CAAC;IA7GC;;;;;OAKG;IACO,YAAY,CAAC,GAAY;QACjC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,IAAI,CAAC,MAAO,CAAC,UAAU,EAAE;YAC3B,wEAAwE;YACxE,oBAAoB;YAC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AQ,gBAAM;QACtC;;WAEG;QACH,YAAY,OAAuB;YACjC,KAAK,EAAE,CAAC;YACR,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC;YAC3C,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAC/B,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QAC7D,CAAC;QAED;;WAEG;QACK,gBAAgB,CAAC,OAAuB;YAC9C,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,OAAO;aACR;YACD,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC5B,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;YACxD,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;YACxD,IAAI,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAClE,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAC1B,CAAC;KACF;IAxBY,oBAAY,eAwBxB,CAAA;AACH,CAAC,EA1IS,OAAO,KAAP,OAAO,QA0IhB","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { ReactElementWidget } from './vdom';\n\nimport { IIterator, find, map, some } from '@phosphor/algorithm';\n\nimport { CommandRegistry } from '@phosphor/commands';\n\nimport { Message, MessageLoop } from '@phosphor/messaging';\n\nimport { AttachedProperty } from '@phosphor/properties';\n\nimport { PanelLayout, Widget } from '@phosphor/widgets';\n\nimport { IClientSession } from './clientsession';\n\nimport * as React from 'react';\n\n/**\n * The class name added to toolbars.\n */\nconst TOOLBAR_CLASS = 'jp-Toolbar';\n\n/**\n * The class name added to toolbar items.\n */\nconst TOOLBAR_ITEM_CLASS = 'jp-Toolbar-item';\n\n/**\n * The class name added to toolbar kernel name text.\n */\nconst TOOLBAR_KERNEL_NAME_CLASS = 'jp-Toolbar-kernelName';\n\n/**\n * The class name added to toolbar spacer.\n */\nconst TOOLBAR_SPACER_CLASS = 'jp-Toolbar-spacer';\n\n/**\n * The class name added to toolbar kernel status icon.\n */\nconst TOOLBAR_KERNEL_STATUS_CLASS = 'jp-Toolbar-kernelStatus';\n\n/**\n * The class name added to a busy kernel indicator.\n */\nconst TOOLBAR_BUSY_CLASS = 'jp-FilledCircleIcon';\n\nconst TOOLBAR_IDLE_CLASS = 'jp-CircleIcon';\n\n/**\n * A layout for toolbars.\n *\n * #### Notes\n * This layout automatically collapses its height if there are no visible\n * toolbar widgets, and expands to the standard toolbar height if there are\n * visible toolbar widgets.\n */\nclass ToolbarLayout extends PanelLayout {\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * If any child widget is visible, expand the toolbar height to the normal\n * toolbar height.\n */\n protected onFitRequest(msg: Message): void {\n super.onFitRequest(msg);\n if (this.parent!.isAttached) {\n // If there are any widgets not explicitly hidden, expand the toolbar to\n // accommodate them.\n if (some(this.widgets, w => !w.isHidden)) {\n this.parent!.node.style.minHeight = 'var(--jp-private-toolbar-height)';\n } else {\n this.parent!.node.style.minHeight = '';\n }\n }\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 * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n super.onUpdateRequest(msg);\n if (this.parent!.isVisible) {\n this._dirty = false;\n }\n }\n\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n protected onChildShown(msg: Widget.ChildMessage): void {\n super.onChildShown(msg);\n\n // Post a fit request for the parent widget.\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 super.onChildHidden(msg);\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-attach'` message.\n */\n protected onBeforeAttach(msg: Message): void {\n super.onBeforeAttach(msg);\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\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 super.attachWidget(index, widget);\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 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 super.detachWidget(index, widget);\n\n // Post a fit request for the parent widget.\n this.parent!.fit();\n }\n\n private _dirty = false;\n}\n\n/**\n * A class which provides a toolbar widget.\n */\nexport class Toolbar<T extends Widget = Widget> extends Widget {\n /**\n * Construct a new toolbar widget.\n */\n constructor() {\n super();\n this.addClass(TOOLBAR_CLASS);\n this.layout = new ToolbarLayout();\n }\n\n /**\n * Get an iterator over the ordered toolbar item names.\n *\n * @returns An iterator over the toolbar item names.\n */\n names(): IIterator<string> {\n let layout = this.layout as ToolbarLayout;\n return map(layout.widgets, widget => {\n return Private.nameProperty.get(widget);\n });\n }\n\n /**\n * Add an item to the end of the toolbar.\n *\n * @param name - The name of the widget to add to the toolbar.\n *\n * @param widget - The widget to add to the toolbar.\n *\n * @param index - The optional name of the item to insert after.\n *\n * @returns Whether the item was added to toolbar. Returns false if\n * an item of the same name is already in the toolbar.\n *\n * #### Notes\n * The item can be removed from the toolbar by setting its parent to `null`.\n */\n addItem(name: string, widget: T): boolean {\n let layout = this.layout as ToolbarLayout;\n return this.insertItem(layout.widgets.length, name, widget);\n }\n\n /**\n * Insert an item into the toolbar at the specified index.\n *\n * @param index - The index at which to insert the item.\n *\n * @param name - The name of the item.\n *\n * @param widget - The widget to add.\n *\n * @returns Whether the item was added to the toolbar. Returns false if\n * an item of the same name is already in the toolbar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the items.\n * The item can be removed from the toolbar by setting its parent to `null`.\n */\n insertItem(index: number, name: string, widget: T): boolean {\n let existing = find(this.names(), value => value === name);\n if (existing) {\n return false;\n }\n widget.addClass(TOOLBAR_ITEM_CLASS);\n let layout = this.layout as ToolbarLayout;\n layout.insertWidget(index, widget);\n Private.nameProperty.set(widget, name);\n return true;\n }\n\n /**\n * Handle the DOM events for the widget.\n *\n * @param event - The DOM event sent to the widget.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the dock panel's node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'click':\n if (!this.node.contains(document.activeElement) && this.parent) {\n this.parent.activate();\n }\n break;\n default:\n break;\n }\n }\n\n /**\n * Handle `after-attach` messages for the widget.\n */\n protected onAfterAttach(msg: Message): void {\n this.node.addEventListener('click', this);\n }\n\n /**\n * Handle `before-detach` messages for the widget.\n */\n protected onBeforeDetach(msg: Message): void {\n this.node.removeEventListener('click', this);\n }\n}\n\n/**\n * The namespace for Toolbar class statics.\n */\nexport namespace Toolbar {\n /**\n * Create an interrupt toolbar item.\n */\n export function createInterruptButton(\n session: IClientSession\n ): ToolbarButton {\n return new ToolbarButton({\n iconClassName: 'jp-StopIcon jp-Icon jp-Icon-16',\n onClick: () => {\n if (session.kernel) {\n session.kernel.interrupt();\n }\n },\n tooltip: 'Interrupt the kernel'\n });\n }\n\n /**\n * Create a restart toolbar item.\n */\n export function createRestartButton(session: IClientSession): ToolbarButton {\n return new ToolbarButton({\n iconClassName: 'jp-RefreshIcon jp-Icon jp-Icon-16',\n onClick: () => {\n session.restart();\n },\n tooltip: 'Restart the kernel'\n });\n }\n\n /**\n * Create a toolbar spacer item.\n *\n * #### Notes\n * It is a flex spacer that separates the left toolbar items\n * from the right toolbar items.\n */\n export function createSpacerItem(): Widget {\n return new Private.Spacer();\n }\n\n /**\n * Create a kernel name indicator item.\n *\n * #### Notes\n * It will display the `'display_name`' of the current kernel,\n * or `'No Kernel!'` if there is no kernel.\n * It can handle a change in context or kernel.\n */\n export function createKernelNameItem(session: IClientSession): ToolbarButton {\n return new Private.KernelName({ session });\n }\n\n /**\n * Create a kernel status indicator item.\n *\n * #### Notes\n * It show display a busy status if the kernel status is\n * not idle.\n * It will show the current status in the node title.\n * It can handle a change to the context or the kernel.\n */\n export function createKernelStatusItem(session: IClientSession): Widget {\n return new Private.KernelStatus(session);\n }\n}\n\n/**\n * Namespace for ToolbarButtonComponent.\n */\nexport namespace ToolbarButtonComponent {\n /**\n * Interface for ToolbarButttonComponent props.\n */\n export interface IProps {\n className?: string;\n label?: string;\n iconClassName?: string;\n iconLabel?: string;\n tooltip?: string;\n onClick?: () => void;\n }\n}\n\n/**\n * React component for a toolbar button.\n *\n * @param props - The props for ToolbarButtonComponent.\n */\nexport function ToolbarButtonComponent(props: ToolbarButtonComponent.IProps) {\n return (\n <button\n className={\n props.className\n ? props.className + ' jp-ToolbarButtonComponent'\n : 'jp-ToolbarButtonComponent'\n }\n onClick={props.onClick}\n title={props.tooltip || props.iconLabel}\n >\n {props.iconClassName && (\n <span\n className={props.iconClassName + ' jp-ToolbarButtonComponent-icon'}\n />\n )}\n {props.label && (\n <span className=\"jp-ToolbarButtonComponent-label\">{props.label}</span>\n )}\n </button>\n );\n}\n\n/**\n * Phosphor Widget version of ToolbarButtonComponent.\n */\nexport class ToolbarButton extends ReactElementWidget {\n /**\n * Create a ToolbarButton.\n *\n * @param props - Props for ToolbarButtonComponent.\n */\n constructor(props: ToolbarButtonComponent.IProps = {}) {\n super(<ToolbarButtonComponent {...props} />);\n this.addClass('jp-ToolbarButton');\n }\n}\n\n/**\n * Namespace for CommandToolbarButtonComponent.\n */\nexport namespace CommandToolbarButtonComponent {\n /**\n * Interface for CommandToolbarButtonComponent props.\n */\n export interface IProps {\n commands: CommandRegistry;\n id: string;\n }\n}\n\n/**\n * React component for a toolbar button that wraps a command.\n *\n * This wraps the ToolbarButtonComponent and watches the command registry\n * for changes to the command.\n */\nexport class CommandToolbarButtonComponent extends React.Component<\n CommandToolbarButtonComponent.IProps\n> {\n constructor(props: CommandToolbarButtonComponent.IProps) {\n super(props);\n props.commands.commandChanged.connect(this._onChange, this);\n this._childProps = Private.propsFromCommand(this.props);\n }\n\n public render() {\n return <ToolbarButtonComponent {...this._childProps} />;\n }\n\n private _onChange(\n sender: CommandRegistry,\n args: CommandRegistry.ICommandChangedArgs\n ) {\n if (args.id !== this.props.id) {\n return; // Not our command\n }\n\n if (args.type !== 'changed') {\n return; // Not a change\n }\n\n this._childProps = Private.propsFromCommand(this.props);\n this.forceUpdate();\n }\n\n private _childProps: ToolbarButtonComponent.IProps;\n}\n\n/**\n * Phosphor Widget version of ToolbarButtonComponent.\n */\nexport class CommandToolbarButton extends ReactElementWidget {\n constructor(props: CommandToolbarButtonComponent.IProps) {\n super(<CommandToolbarButtonComponent {...props} />);\n this.addClass('jp-CommandToolbarButton');\n }\n}\n\n/**\n * A namespace for private data.\n */\nnamespace Private {\n export function propsFromCommand(\n options: CommandToolbarButtonComponent.IProps\n ): ToolbarButtonComponent.IProps {\n let { commands, id } = options;\n const iconClassName = commands.iconClass(id);\n const iconLabel = commands.iconLabel(id);\n const label = commands.label(id);\n let className = commands.className(id);\n // Add the boolean state classes.\n if (commands.isToggled(id)) {\n className += ' p-mod-toggled';\n }\n if (!commands.isVisible(id)) {\n className += ' p-mod-hidden';\n }\n const tooltip = commands.caption(id) || label || iconLabel;\n const onClick = () => {\n commands.execute(id);\n };\n return { className, iconClassName, tooltip, onClick };\n }\n\n /**\n * An attached property for the name of a toolbar item.\n */\n export const nameProperty = new AttachedProperty<Widget, string>({\n name: 'name',\n create: () => ''\n });\n\n /**\n * A no-op function.\n */\n export function noOp() {\n /* no-op */\n }\n\n /**\n * A spacer widget.\n */\n export class Spacer extends Widget {\n /**\n * Construct a new spacer widget.\n */\n constructor() {\n super();\n this.addClass(TOOLBAR_SPACER_CLASS);\n }\n }\n\n /**\n * Namespace for KernelNameComponent.\n */\n export namespace KernelNameComponent {\n /**\n * Interface for KernelNameComponent props.\n */\n export interface IProps {\n session: IClientSession;\n }\n }\n\n /**\n * React component for a kernel name button.\n *\n * This wraps the ToolbarButtonComponent and watches the kernel\n * session for changes.\n */\n export class KernelNameComponent extends React.Component<\n KernelNameComponent.IProps\n > {\n constructor(props: KernelNameComponent.IProps) {\n super(props);\n props.session.kernelChanged.connect(this._onKernelChanged, this);\n this._childProps = {\n className: TOOLBAR_KERNEL_NAME_CLASS,\n onClick: () => {\n this.props.session.selectKernel();\n },\n tooltip: 'Switch kernel',\n label: props.session.kernelDisplayName\n };\n }\n\n public render() {\n return <ToolbarButtonComponent {...this._childProps} />;\n }\n\n /**\n * Update the text of the kernel name item.\n */\n private _onKernelChanged(session: IClientSession): void {\n this._childProps.label = session.kernelDisplayName;\n this.forceUpdate();\n }\n\n private _childProps: ToolbarButtonComponent.IProps;\n }\n\n /**\n * Phosphor Widget version of ToolbarButtonComponent.\n */\n export class KernelName extends ReactElementWidget {\n constructor(props: KernelNameComponent.IProps) {\n super(<KernelNameComponent {...props} />);\n this.addClass('jp-KernelName');\n }\n }\n\n /**\n * A toolbar item that displays kernel status.\n */\n export class KernelStatus extends Widget {\n /**\n * Construct a new kernel status widget.\n */\n constructor(session: IClientSession) {\n super();\n this.addClass(TOOLBAR_KERNEL_STATUS_CLASS);\n this._onStatusChanged(session);\n session.statusChanged.connect(this._onStatusChanged, this);\n }\n\n /**\n * Handle a status on a kernel.\n */\n private _onStatusChanged(session: IClientSession) {\n if (this.isDisposed) {\n return;\n }\n let status = session.status;\n this.toggleClass(TOOLBAR_IDLE_CLASS, status === 'idle');\n this.toggleClass(TOOLBAR_BUSY_CLASS, status !== 'idle');\n let title = 'Kernel ' + status[0].toUpperCase() + status.slice(1);\n this.node.title = title;\n }\n }\n}\n"]}
|
package/lib/vdom.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vdom.js","sourceRoot":"","sources":["../../../../apputils/src/vdom.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;;;;;;;;AAI3D,mDAA2D;AAE3D,mDAAsD;AAEtD,+CAA2C;AAI3C,oDAAsC;AAEtC;;GAEG;AACH,kBAEE,SAAQ,gBAAM;IAFhB;;QAkFU,kBAAa,GAAG,IAAI,kBAAM,CAAa,IAAI,CAAC,CAAC;IACvD,CAAC;IAhFC;;OAEG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAI,KAAK,CAAC,QAAkB;QAC1B,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ,EAAE;YAC5B,OAAO;SACR;QAED,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SACxD;QACD,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;QACvB,IAAI,QAAQ,EAAE;YACZ,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SAClD;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;I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CAGF;AAzBD,8BAyBC","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { IDisposable } from '@phosphor/disposable';\n\nimport { Message, MessageLoop } from '@phosphor/messaging';\n\nimport { ISignal, Signal } from '@phosphor/signaling';\n\nimport { Widget } from '@phosphor/widgets';\n\nimport * as React from 'react';\n\nimport * as ReactDOM from 'react-dom';\n\n/**\n * Phosphor widget that encodes best practices for VDOM based rendering.\n */\nexport abstract class VDomRenderer<\n T extends VDomRenderer.IModel | null\n> extends Widget {\n /**\n * A signal emitted when the model changes.\n */\n get modelChanged(): ISignal<this, void> {\n return this._modelChanged;\n }\n\n /**\n * Set the model and fire changed signals.\n */\n set model(newValue: T | null) {\n if (this._model === newValue) {\n return;\n }\n\n if (this._model) {\n this._model.stateChanged.disconnect(this.update, this);\n }\n this._model = newValue;\n if (newValue) {\n newValue.stateChanged.connect(this.update, this);\n }\n this.update();\n this._modelChanged.emit(void 0);\n }\n\n /**\n * Get the current model.\n */\n get model(): T | null {\n return this._model;\n }\n\n /**\n * Dispose this widget.\n */\n dispose() {\n this._model = null;\n super.dispose();\n }\n\n /**\n * Called to update the state of the widget.\n *\n * The default implementation of this method triggers\n * VDOM based rendering by calling the this.render() method.\n */\n protected onUpdateRequest(msg: Message): void {\n let vnode = this.render();\n if (Array.isArray(vnode)) {\n ReactDOM.render(vnode, this.node);\n } else {\n ReactDOM.render<any>(vnode, this.node);\n }\n }\n\n /* Called after the widget is attached to the DOM\n *\n * Make sure the widget is rendered, even if the model has not changed.\n */\n protected onAfterAttach(msg: Message): void {\n MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n }\n\n /**\n * Render the content of this widget using the virtual DOM.\n *\n * This method will be called anytime the widget needs to be rendered,\n * which includes layout triggered rendering and all model changes.\n *\n * Subclasses should define this method and use the current model state\n * to create a virtual node or nodes to render.\n */\n protected abstract render():\n | Array<React.ReactElement<any>>\n | React.ReactElement<any>\n | null;\n\n private _model: T | null;\n private _modelChanged = new Signal<this, void>(this);\n}\n\n/**\n * Phosphor widget that renders React Element(s).\n *\n * All messages will re-render the element.\n */\nexport class ReactElementWidget extends VDomRenderer<any> {\n /**\n * Creates a Phosphor widget that renders the element(s) `es`.\n */\n constructor(\n es: Array<React.ReactElement<any>> | React.ReactElement<any> | null\n ) {\n super();\n this._es = es;\n }\n\n render(): Array<React.ReactElement<any>> | React.ReactElement<any> | null {\n return this._es;\n }\n\n private _es: Array<React.ReactElement<any>> | React.ReactElement<any> | null;\n}\n\n/**\n * The namespace for VDomRenderer statics.\n */\nexport namespace VDomRenderer {\n /**\n * An interface for a model to be used with vdom rendering.\n */\n export interface IModel extends IDisposable {\n /**\n * A signal emitted when any model state changes.\n */\n readonly stateChanged: ISignal<this, void>;\n }\n}\n\n/**\n * Concrete implementation of VDomRenderer model.\n */\nexport class VDomModel implements VDomRenderer.IModel {\n /**\n * A signal emitted when any model state changes.\n */\n readonly stateChanged = new Signal<this, void>(this);\n\n /**\n * Test whether the model is disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose the model.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n Signal.clearData(this);\n }\n\n private _isDisposed = false;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"windowresolver.js","sourceRoot":"","sources":["../../../../apputils/src/windowresolver.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAE3D,mDAA6D;AAE7D,oBAAoB;AACpB;;GAEG;AACU,QAAA,eAAe,GAAG,IAAI,iBAAK,CACtC,sCAAsC,CACvC,CAAC;AAaF;;GAEG;AACH;IAAA;QA0BU,UAAK,GAAkB,IAAI,CAAC;IACtC,CAAC;IA1BC;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,SAAiB;QACv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AC;YAChB,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC;YACrC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,CAAC,EAAE,OAAO,CAAC,CAAC;QAEZ,mDAAmD;QACnD,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAEzE,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IApCe,eAAO,UAoCtB,CAAA;IAED,8CAA8C;IAC9C,CAAC,GAAG,EAAE;QACJ,UAAU,EAAE,CAAC;IACf,CAAC,CAAC,EAAE,CAAC;AACP,CAAC,EA1JS,OAAO,KAAP,OAAO,QA0JhB","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { PromiseDelegate, Token } from '@phosphor/coreutils';\n\n/* tslint:disable */\n/**\n * The default window resolver token.\n */\nexport const IWindowResolver = new Token<IWindowResolver>(\n '@jupyterlab/apputils:IWindowResolver'\n);\n/* tslint:enable */\n\n/**\n * The description of a window name resolver.\n */\nexport interface IWindowResolver {\n /**\n * A window name to use as a handle among shared resources.\n */\n readonly name: string;\n}\n\n/**\n * A concrete implementation of a window name resolver.\n */\nexport class WindowResolver implements IWindowResolver {\n /**\n * The resolved window name.\n */\n get name(): string {\n return this._name;\n }\n\n /**\n * Resolve a window name to use as a handle among shared resources.\n *\n * @param candidate - The potential window name being resolved.\n *\n * #### Notes\n * Typically, the name candidate should be a JupyterLab workspace name or\n * an empty string if there is no workspace.\n *\n * If the returned promise rejects, a window name cannot be resolved without\n * user intervention, which typically means navigation to a new URL.\n */\n resolve(candidate: string): Promise<void> {\n return Private.resolve(candidate).then(name => {\n this._name = name;\n });\n }\n\n private _name: string | null = null;\n}\n\n/*\n * A namespace for private module data.\n */\nnamespace Private {\n /**\n * The internal prefix for private local storage keys.\n */\n const PREFIX = '@jupyterlab/coreutils:StateDB';\n\n /**\n * The local storage beacon key.\n */\n const BEACON = `${PREFIX}:beacon`;\n\n /**\n * The timeout (in ms) to wait for beacon responders.\n *\n * #### Notes\n * This value is a whole number between 200 and 500 in order to prevent\n * perfect timeout collisions between multiple simultaneously opening windows\n * that have the same URL. This is an edge case because multiple windows\n * should not ordinarily share the same URL, but it can be contrived.\n */\n const TIMEOUT = Math.floor(200 + Math.random() * 300);\n\n /**\n * The local storage window key.\n */\n const WINDOW = `${PREFIX}:window`;\n\n /**\n * A potential preferred default window name.\n */\n let candidate: string | null = null;\n\n /**\n * The window name promise.\n */\n let delegate = new PromiseDelegate<string>();\n\n /**\n * The known window names.\n */\n let known: { [window: string]: null } = {};\n\n /**\n * The window name.\n */\n let name: string | null = null;\n\n /**\n * Whether the name resolution has completed.\n */\n let resolved = false;\n\n /**\n * Start the storage event handler.\n */\n function initialize(): void {\n // Listen to all storage events for beacons and window names.\n window.addEventListener('storage', (event: StorageEvent) => {\n const { key, newValue } = event;\n\n // All the keys we care about have values.\n if (newValue === null) {\n return;\n }\n\n // If the beacon was fired, respond with a ping.\n if (key === BEACON && candidate !== null) {\n ping(resolved ? name : candidate);\n return;\n }\n\n // If the window name is resolved, bail.\n if (resolved || key !== WINDOW) {\n return;\n }\n\n const reported = newValue.replace(/\\-\\d+$/, '');\n\n // Store the reported window name.\n known[reported] = null;\n\n // If a reported window name and candidate collide, reject the candidate.\n if (candidate in known) {\n reject();\n }\n });\n }\n\n /**\n * Ping peers with payload.\n */\n function ping(payload: string): void {\n if (payload === null) {\n return;\n }\n\n const { localStorage } = window;\n\n localStorage.setItem(WINDOW, `${payload}-${new Date().getTime()}`);\n }\n\n /**\n * Reject the candidate.\n */\n function reject(): void {\n resolved = true;\n delegate.reject(`Window name candidate \"${candidate}\" already exists`);\n }\n\n /**\n * Returns a promise that resolves with the window name used for restoration.\n */\n export function resolve(potential: string): Promise<string> {\n if (resolved) {\n return delegate.promise;\n }\n\n // Set the local candidate.\n candidate = potential;\n\n if (candidate in known) {\n reject();\n return delegate.promise;\n }\n\n const { localStorage, setTimeout } = window;\n\n // Wait until other windows have reported before claiming the candidate.\n setTimeout(() => {\n if (resolved) {\n return;\n }\n\n // If the window name has not already been resolved, check one last time\n // to confirm it is not a duplicate before resolving.\n if (candidate in known) {\n return reject();\n }\n\n resolved = true;\n delegate.resolve((name = candidate));\n ping(name);\n }, TIMEOUT);\n\n // Fire the beacon to collect other windows' names.\n localStorage.setItem(BEACON, `${Math.random()}-${new Date().getTime()}`);\n\n return delegate.promise;\n }\n\n // Initialize the storage listener at runtime.\n (() => {\n initialize();\n })();\n}\n"]}
|