### Build and run the example Source: https://github.com/jupyterlab/lumino/blob/main/docs/source/plugin-registry-server.md Commands to build the repository and execute the plugin registry server example. ```bash yarn install yarn run build yarn workspace @lumino/example-plugin-registry-server build yarn workspace @lumino/example-plugin-registry-server start ``` -------------------------------- ### Build and Run Lumino Examples Source: https://github.com/jupyterlab/lumino/blob/main/CONTRIBUTING.md Follow these steps to build the source, minimize assets, build the examples, and navigate to a specific example directory to run it. ```bash yarn build:src yarn minimize yarn build:examples cd example/dockpanel ``` -------------------------------- ### Install project dependencies Source: https://github.com/jupyterlab/lumino/blob/main/notebooks/README.md Install other necessary dependencies for the project. Run this in the project directory after installing the global package. ```bash npm install ``` -------------------------------- ### Build and start the plugin registry server Source: https://github.com/jupyterlab/lumino/blob/main/examples/example-plugin-registry-server/README.md Execute the build and start commands for the plugin registry server workspace. ```bash yarn workspace @lumino/example-plugin-registry-server build yarn workspace @lumino/example-plugin-registry-server start ``` -------------------------------- ### Run Example Tests Source: https://github.com/jupyterlab/lumino/blob/main/CONTRIBUTING.md Execute this command to run tests specifically for the examples within the Lumino project. ```bash yarn test:examples ``` -------------------------------- ### Launch JupyterLab Source: https://github.com/jupyterlab/lumino/blob/main/notebooks/README.md Start JupyterLab after completing the installation and configuration steps. This allows you to begin using the TypeScript kernel. ```bash jupyter lab ``` -------------------------------- ### Install and Build Lumino Source: https://github.com/jupyterlab/lumino/blob/main/examples/example-dockpanel-amd/README.md Run these commands from the root Lumino folder to install dependencies, build the project, and minimize assets. ```bash yarn install yarn run build yarn run minimize ``` -------------------------------- ### Install Dependencies and Build Lumino Source: https://github.com/jupyterlab/lumino/blob/main/CONTRIBUTING.md Run these commands after cloning Lumino to install project dependencies and build the source code. ```bash yarn yarn build:src ``` -------------------------------- ### Build project dependencies Source: https://github.com/jupyterlab/lumino/blob/main/examples/example-plugin-registry-server/README.md Install and build the necessary packages from the root directory. ```bash yarn install yarn run build ``` -------------------------------- ### Install Playwright Browsers Source: https://github.com/jupyterlab/lumino/blob/main/CONTRIBUTING.md Execute this command to install the necessary browsers for running tests with Playwright if you haven't done so before or have updated it. ```bash yarn playwright install ``` -------------------------------- ### Install jp-babel kernel Source: https://github.com/jupyterlab/lumino/blob/main/notebooks/README.md Use the jp-babel command-line tool to install the kernel. This makes the TypeScript kernel available to Jupyter. ```bash jp-babel-install ``` -------------------------------- ### Install jp-babel npm package Source: https://github.com/jupyterlab/lumino/blob/main/notebooks/README.md Install the jp-babel npm package globally. This is the first step in setting up the TypeScript kernel. ```bash npm install -g jp-babel ``` -------------------------------- ### Register and activate plugins Source: https://github.com/jupyterlab/lumino/blob/main/docs/source/plugin-registry-server.md Initialize the PluginRegistry and register the plugins to start the service lifecycle. ```typescript import { PluginRegistry } from '@lumino/coreutils'; import { hello } from './hello'; import { greeter } from './greeter'; const registry = new PluginRegistry(); registry.registerPlugin(hello); registry.registerPlugin(greeter); registry.activatePlugin('example:greeter'); ``` -------------------------------- ### Initialize Poll with auto: false and Promise tick subscription Source: https://github.com/jupyterlab/lumino/blob/main/packages/polling/README.md Sets up testing state variables and creates a new Poll instance. The `tock` function is assigned to run after the poll ticks and captures the next promise. Use when you need to manually control the poll start and subscribe to ticks using promises. ```typescript const expected = 'started resolved resolved'; const ticker: IPoll.Phase[] = []; const tock = (poll: Poll) => { ticker.push(poll.state.phase); poll.tick.then(tock).catch(() => undefined); }; const poll = new Poll({ auto: false, factory: () => Promise.resolve(), frequency: { interval: 100, backoff: false } }); ``` ```typescript void poll.tick.then(tock); void poll.start(); ``` ```typescript await sleep(1000); // Sleep for longer than the interval. expect(ticker.join(' ').startsWith(expected)).to.equal(true); poll.dispose(); ``` -------------------------------- ### Drag Class Source: https://github.com/jupyterlab/lumino/blob/main/review/api/dragdrop.api.md The `Drag` class is the primary interface for initiating and managing drag-and-drop operations. It handles the setup, event listening, and cleanup associated with a drag operation. ```APIDOC ## Class: Drag ### Description Manages a drag-and-drop operation. ### Constructor `constructor(options: Drag.IOptions)` Initializes a new instance of the `Drag` class. ### Properties - `document` (Document | ShadowRoot): The document or shadow root where the drag operation is taking place. - `dragImage` (HTMLElement | null): The HTML element representing the drag image. - `isDisposed` (boolean): Indicates whether the drag operation has been disposed. - `mimeData` (MimeData): The MIME data associated with the drag operation. - `proposedAction` (Drag.DropAction): The proposed drop action for the drag operation. - `source` (any): The source of the drag operation. - `supportedActions` (Drag.SupportedActions): The supported drop actions for the drag operation. ### Methods - `dispose()`: Disposes of the drag operation and cleans up resources. - `handleEvent(event: Event)`: Handles DOM events related to the drag operation. - `start(clientX: number, clientY: number): Promise`: Starts the drag operation at the specified client coordinates. ### Namespace: Drag #### Type: `DropAction` 'none' | 'copy' | 'link' | 'move' #### Class: `Event` Extends `DragEvent`. ##### Constructor `constructor(event: PointerEvent, options: Event.IOptions)` ##### Properties - `dropAction` (DropAction): The drop action that occurred. - `mimeData` (MimeData): The MIME data transferred during the drop. - `proposedAction` (DropAction): The proposed action for the drop. - `source` (any): The source of the drag event. - `supportedActions` (SupportedActions): The supported actions for the drag event. #### Namespace: Event ##### Interface: `IOptions` - `drag` (Drag): The `Drag` instance associated with the event. - `related` (Element | null): The related DOM element. - `type` ('lm-dragenter' | 'lm-dragexit' | 'lm-dragleave' | 'lm-dragover' | 'lm-drop'): The type of drag event. #### Interface: `IOptions` - `document` (Document | ShadowRoot): The document or shadow root for the drag operation. - `dragImage` (HTMLElement): The HTML element to use as the drag image. - `mimeData` (MimeData): The MIME data to be transferred. - `proposedAction` (DropAction): The proposed action for the drag operation. - `source` (any): The source of the drag operation. - `supportedActions` (SupportedActions): The supported actions for the drag operation. #### Method: `overrideCursor(cursor: string, doc?: Document | ShadowRoot): IDisposable` Overrides the document's cursor for the duration of a drag operation. #### Type: `SupportedActions` `DropAction` | 'copy-link' | 'copy-move' | 'link-move' | 'all' ``` -------------------------------- ### Build HTML Documentation Source: https://github.com/jupyterlab/lumino/blob/main/CONTRIBUTING.md Navigate to the 'docs' directory and run this command to build the HTML version of the documentation. The output will be in the 'build/html' directory. ```bash cd docs make html ``` -------------------------------- ### Plugin registry server output Source: https://github.com/jupyterlab/lumino/blob/main/examples/example-plugin-registry-server/README.md Expected console output showing the interaction between the hello and greeter plugins. ```text [hello] providing IGreeting [greeter] Hello! (from the hello plugin) ``` -------------------------------- ### Create and Activate Conda Environment for Documentation Source: https://github.com/jupyterlab/lumino/blob/main/CONTRIBUTING.md Use these commands to create a new Conda environment with the necessary dependencies for building Lumino's documentation and then activate it. ```bash conda env create -f docs/environment.yml conda activate lumino_documentation ``` -------------------------------- ### Load and Initialize Main Application Module Source: https://github.com/jupyterlab/lumino/blob/main/examples/example-nested-dockpanel-amd/index.html Uses RequireJS to load the main application script ('./src/index') and execute its default export. This is the entry point for the AMD application. ```javascript requirejs(['./src/index'], function (main) { main(); }); ``` -------------------------------- ### Poll Class Source: https://github.com/jupyterlab/lumino/blob/main/review/api/polling.api.md Implements a polling mechanism that can be started, stopped, and refreshed. It emits signals on disposal and ticks. ```typescript export class Poll implements IObservableDisposable, IPoll { [Symbol.asyncIterator](): AsyncIterableIterator>; constructor(options: Poll.IOptions); dispose(): void; get disposed(): ISignal; get frequency(): IPoll.Frequency; set frequency(frequency: IPoll.Frequency); protected get hidden(): boolean; get isDisposed(): boolean; readonly name: string; refresh(): Promise; schedule(next?: Partial & { cancel: (last: IPoll.State) => boolean; }>): Promise; get standby(): Poll.Standby | (() => boolean | Poll.Standby); set standby(standby: Poll.Standby | (() => boolean | Poll.Standby)); start(): Promise; get state(): IPoll.State; stop(): Promise; get tick(): Promise; get ticked(): ISignal>; } ``` -------------------------------- ### Initialize Poll for AsyncIterable usage Source: https://github.com/jupyterlab/lumino/blob/main/packages/polling/README.md Sets up testing state variables and creates a new Poll instance configured for immediate polling and disposal upon completion. This setup is for using the poll as an async iterable. ```typescript let poll: Poll; let total = 2; let i = 0; poll = new Poll({ auto: false, factory: () => Promise.resolve(++i > total ? poll.dispose() : void 0), frequency: { interval: Poll.IMMEDIATE } }); const expected = `started${' resolved'.repeat(total)}`; const ticker: IPoll.Phase[] = []; ``` ```typescript void poll.start(); ``` ```typescript for await (const state of poll) { ticker.push(state.phase); if (poll.isDisposed) { break; } } ``` ```typescript // ticker and expected both equal: // 'started resolved resolved disposed' expect(ticker.join(' ')).to.equal(expected); ``` -------------------------------- ### Manual Release Preparation Source: https://github.com/jupyterlab/lumino/blob/main/RELEASE.md Commands for preparing a manual release. This includes cleaning the environment, updating versions, and updating the changelog. ```bash git clean -dfx yarn yarn run update:versions # Update the changelog with changed packages (minor or higher) and included PRs. # Tag the release with the date, e.g. 2021.4.9 # yarn run publish # Push any changes to main ``` -------------------------------- ### Run Lumino Tests Source: https://github.com/jupyterlab/lumino/blob/main/CONTRIBUTING.md These commands are used to build the test environment and execute the test suite. You can optionally specify a browser to test against. ```bash yarn build:test yarn test # optionally test:chromium, test:firefox, or test:webkit ``` -------------------------------- ### Implement a service provider plugin Source: https://github.com/jupyterlab/lumino/blob/main/docs/source/plugin-registry-server.md Define a plugin that provides a service by listing the token in the provides array and returning the implementation in activate. ```typescript import { IPlugin } from '@lumino/coreutils'; import { IGreeting } from './tokens'; export const hello: IPlugin = { id: 'example:hello', provides: IGreeting, activate: () => { console.log('[hello] providing IGreeting'); return { greet: (name: string) => `Hello, ${name}!` }; } }; ``` -------------------------------- ### RequireJS Configuration and Loading Source: https://github.com/jupyterlab/lumino/blob/main/examples/example-dockpanel-amd/index.html Configures require.js to load Lumino packages from local paths and then loads the main application script. ```javascript require.config({ baseUrl: ".", paths: { // CDN testing --- // "@lumino": "https://cdn.jsdelivr.net/npm/@lumino", // Local testing --- "@lumino/algorithm": "../../packages/algorithm/dist/index.min", "@lumino/collections": "../../packages/collections/dist/index.min", "@lumino/properties": "../../packages/properties/dist/index.min", "@lumino/messaging": "../../packages/messaging/dist/index.min", "@lumino/signaling": "../../packages/signaling/dist/index.min", "@lumino/disposable": "../../packages/disposable/dist/index.min", "@lumino/domutils": "../../packages/domutils/dist/index.min", "@lumino/coreutils": "../../packages/coreutils/dist/index.min", "@lumino/keyboard": "../../packages/keyboard/dist/index.min", "@lumino/commands": "../../packages/commands/dist/index.min", "@lumino/dragdrop": "../../packages/dragdrop/dist/index.min", "@lumino/virtualdom": "../../packages/virtualdom/dist/index.min", "@lumino/widgets": "../../packages/widgets/dist/index.min" } }); requirejs(['./src/index'], function (main) { main(); }); ``` -------------------------------- ### Application Class Source: https://github.com/jupyterlab/lumino/blob/main/review/api/application.api.md The Application class is the main entry point for managing plugins, commands, and the application shell. ```APIDOC ## Application ### Description Manages plugins, commands, and the application shell. ### Methods - **constructor(options: Application.IOptions)**: Initializes a new instance of the class. - **activateDeferredPlugins()**: Activates all plugins that have been deferred. - **activatePlugin(id: string)**: Activates a specific plugin by its ID. - **protected addEventListeners()**: Adds event listeners to the application. - **protected attachShell(id: string)**: Attaches the shell to a specific element. - **deactivatePlugin(id: string)**: Deactivates a specific plugin by its ID. - **get deferredPlugins()**: Returns a list of deferred plugin IDs. - **deregisterPlugin(id: string, force?: boolean)**: Deregisters a plugin by its ID. - **protected evtContextMenu(event: PointerEvent)**: Handles context menu events. - **protected evtKeydown(event: KeyboardEvent)**: Handles keydown events. - **protected evtKeyup(event: KeyboardEvent)**: Handles keyup events. - **protected evtResize(event: Event)**: Handles resize events. - **getPluginDescription(id: string)**: Retrieves the description of a plugin by its ID. - **handleEvent(event: Event)**: Handles generic events. - **hasPlugin(id: string)**: Checks if a plugin with the given ID exists. - **isPluginActivated(id: string)**: Checks if a plugin is currently activated. - **listPlugins()**: Returns a list of all registered plugin IDs. - **registerPlugin(plugin: IPlugin)**: Registers a single plugin. - **registerPlugins(plugins: IPlugin[])**: Registers an array of plugins. - **resolveOptionalService(token: Token)**: Resolves an optional service by its token. - **resolveRequiredService(token: Token)**: Resolves a required service by its token. - **start(options?: Application.IStartOptions)**: Starts the application. - **get started()**: Returns a promise that resolves when the application has started. ### Properties - **commands: CommandRegistry**: The command registry for the application. - **contextMenu: ContextMenu**: The context menu instance for the application. - **protected pluginRegistry: PluginRegistry**: The plugin registry. - **readonly shell: T**: The application shell widget. ``` -------------------------------- ### Configure RequireJS for Lumino AMD Source: https://github.com/jupyterlab/lumino/blob/main/examples/example-nested-dockpanel-amd/index.html Sets up the base URL and package paths for RequireJS to load Lumino modules. This configuration is essential for AMD-based projects using Lumino. ```javascript require.config({ baseUrl: ".", paths: { // CDN testing --- // "@lumino": "https://cdn.jsdelivr.net/npm/@lumino", // Local testing --- "@lumino/algorithm": "../../packages/algorithm/dist/index.min", "@lumino/collections": "../../packages/collections/dist/index.min", "@lumino/properties": "../../packages/properties/dist/index.min", "@lumino/messaging": "../../packages/messaging/dist/index.min", "@lumino/signaling": "../../packages/signaling/dist/index.min", "@lumino/disposable": "../../packages/disposable/dist/index.min", "@lumino/domutils": "../../packages/domutils/dist/index.min", "@lumino/coreutils": "../../packages/coreutils/dist/index.min", "@lumino/keyboard": "../../packages/keyboard/dist/index.min", "@lumino/commands": "../../packages/commands/dist/index.min", "@lumino/dragdrop": "../../packages/dragdrop/dist/index.min", "@lumino/virtualdom": "../../packages/virtualdom/dist/index.min", "@lumino/widgets": "../../packages/widgets/dist/index.min" } }); ``` -------------------------------- ### Platform Source: https://github.com/jupyterlab/lumino/blob/main/review/api/domutils.api.md Utilities for detecting platform-specific features and behaviors. ```APIDOC ## accelKey ### Description Determines if the accelerator key (e.g., Ctrl or Cmd) is pressed during a keyboard or mouse event. ### Signature ```typescript accelKey(event: KeyboardEvent | MouseEvent): boolean ``` ### Parameters - **event** (KeyboardEvent | MouseEvent) - The keyboard or mouse event object. ### Returns `true` if the accelerator key is pressed, `false` otherwise. ``` -------------------------------- ### Lumino Algorithm Functions Source: https://github.com/jupyterlab/lumino/blob/main/docs/source/migration.md This section details the functions available in `@lumino/algorithm` and their migration status. Functions marked with '✅' are supported and can be used with native types, while those marked with '☑️' are deprecated and have recommended native alternatives. ```APIDOC ## `@lumino/algorithm` Functions ### Supported Functions (✅) - **`minmax(...)`**: Supports native types. - **`reduce(...)`**: Supports native types. - **`retro(...)`**: Reimplement with native types. - **`some(...)`**: Reimplement with native types. - **`stride(...)`**: Reimplement with native types. - **`take(...)`**: Reimplement with native types. - **`toObject(...)`**: Reimplement with native types. - **`topologicSort(...)`**: Supports native types. - **`zip(...)`**: Reimplement with native types. ### Deprecated Functions (☑️) - **`once(...)`**: Deprecated, use native `yield` instead. - **`repeat(...)`**: Deprecated, use native `while` loop with `yield`. - **`toArray(...)`**: Deprecated, use [`Array.from(...)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from) or [`for...of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of). ``` -------------------------------- ### BasicKeyHandler Source: https://github.com/jupyterlab/lumino/blob/main/review/api/datagrid.api.md A basic implementation of a key handler for the DataGrid, providing default keyboard navigation and actions. ```APIDOC ## BasicKeyHandler ### Description A basic implementation of a key handler for the DataGrid, providing default keyboard navigation and actions. ### Methods - `dispose(): void` - `get isDisposed(): boolean` - `onKeyDown(grid: DataGrid, event: KeyboardEvent): void` ### Protected Methods - `onArrowDown(grid: DataGrid, event: KeyboardEvent): void` - `onArrowLeft(grid: DataGrid, event: KeyboardEvent): void` - `onArrowRight(grid: DataGrid, event: KeyboardEvent): void` - `onArrowUp(grid: DataGrid, event: KeyboardEvent): void` - `onDelete(grid: DataGrid, event: KeyboardEvent): void` - `onEscape(grid: DataGrid, event: KeyboardEvent): void` - `onKeyC(grid: DataGrid, event: KeyboardEvent): void` - `onPageDown(grid: DataGrid, event: KeyboardEvent): void` - `onPageUp(grid: DataGrid, event: KeyboardEvent): void` ``` -------------------------------- ### BasicSelectionModel Source: https://github.com/jupyterlab/lumino/blob/main/review/api/datagrid.api.md A basic implementation of a selection model for the DataGrid, managing cell selections and cursor position. ```APIDOC ## BasicSelectionModel ### Description A basic implementation of a selection model for the DataGrid, managing cell selections and cursor position. ### Methods - `clear(): void` - `currentSelection(): SelectionModel.Selection | null` - `get cursorColumn(): number` - `get cursorRow(): number` - `get isEmpty(): boolean` - `moveCursorWithinSelections(direction: SelectionModel.CursorMoveDirection): void` - `select(args: SelectionModel.SelectArgs): void` - `selections(): IterableIterator` ### Protected Methods - `onDataModelChanged(sender: DataModel, args: DataModel.ChangedArgs): void` ``` -------------------------------- ### CommandRegistry Class Source: https://github.com/jupyterlab/lumino/blob/main/review/api/commands.api.md The CommandRegistry class provides a way to manage and execute commands within the Lumino framework. It allows for registering commands, associating them with key bindings, and retrieving metadata about commands. ```APIDOC ## Class: CommandRegistry ### Description Manages and executes commands within the Lumino framework. ### Methods - **addCommand(id: string, options: CommandRegistry.ICommandOptions): IDisposable** Adds a new command to the registry. - **addKeyBinding(options: CommandRegistry.IKeyBindingOptions): IDisposable** Adds a key binding to a command. - **caption(id: string, args?: ReadonlyPartialJSONObject): string** Gets the caption for a command. - **className(id: string, args?: ReadonlyPartialJSONObject): string** Gets the CSS class name for a command. - **get commandChanged(): ISignal** A signal that emits when a command is added, removed, or changed. - **get commandExecuted(): ISignal** A signal that emits when a command is executed. - **dataset(id: string, args?: ReadonlyPartialJSONObject): CommandRegistry.Dataset** Gets the dataset for a command. - **describedBy(id: string, args?: ReadonlyPartialJSONObject): Promise** Gets the description for a command. - **execute(id: string, args?: ReadonlyPartialJSONObject): Promise** Executes a command. - **hasCommand(id: string): boolean** Checks if a command exists in the registry. - **holdKeyBindingExecution(event: KeyboardEvent, permission: Promise): void** Holds the execution of a key binding. - **icon(id: string, args?: ReadonlyPartialJSONObject): VirtualElement.IRenderer | undefined** Gets the icon renderer for a command. - **iconClass(id: string, args?: ReadonlyPartialJSONObject): string** Gets the icon class name for a command. - **iconLabel(id: string, args?: ReadonlyPartialJSONObject): string** Gets the icon label for a command. - **isEnabled(id: string, args?: ReadonlyPartialJSONObject): boolean** Checks if a command is enabled. - **isToggleable(id: string, args?: ReadonlyJSONObject): boolean** Checks if a command is toggleable. - **isToggled(id: string, args?: ReadonlyPartialJSONObject): boolean** Checks if a command is toggled. - **isVisible(id: string, args?: ReadonlyPartialJSONObject): boolean** Checks if a command is visible. - **get keyBindingChanged(): ISignal** A signal that emits when a key binding is added or removed. - **get keyBindings(): ReadonlyArray** Gets the list of all key bindings. - **label(id: string, args?: ReadonlyPartialJSONObject): string** Gets the label for a command. - **listCommands(): string[]** Lists all command IDs in the registry. - **mnemonic(id: string, args?: ReadonlyPartialJSONObject): number** Gets the mnemonic index for a command. - **notifyCommandChanged(id?: string): void** Notifies the registry that a command has changed. - **processKeydownEvent(event: KeyboardEvent): void** Processes a keydown event. - **processKeyupEvent(event: KeyboardEvent): void** Processes a keyup event. - **usage(id: string, args?: ReadonlyPartialJSONObject): string** Gets the usage string for a command. ``` -------------------------------- ### IPlugin Interface Source: https://github.com/jupyterlab/lumino/blob/main/review/api/coreutils.api.md Defines the structure for a plugin that can be registered with the PluginRegistry. It includes methods for activation and deactivation, along with metadata like ID, description, and dependencies. ```APIDOC ## IPlugin ### Description Interface for a plugin. ### Properties - **activate** (T, ...any) => U | Promise - Required - The plugin activation function. - **autoStart** (boolean | 'defer') - Optional - Determines if the plugin should auto-start. - **deactivate** ((T, ...any) => void | Promise) | null - Optional - The plugin deactivation function. - **description** (string) - Optional - A description of the plugin. - **id** (string) - Required - The unique identifier for the plugin. - **optional** (Token[]) - Optional - An array of tokens for optional services the plugin requires. - **provides** (Token | null) - Optional - The token that this plugin provides. - **requires** (Token[]) - Optional - An array of tokens for services the plugin requires. ``` -------------------------------- ### VirtualDOM Namespace Source: https://github.com/jupyterlab/lumino/blob/main/review/api/virtualdom.api.md Provides static methods for realizing and rendering virtual DOM nodes. ```APIDOC ## VirtualDOM Namespace ### Description Provides static methods for realizing and rendering virtual DOM nodes. ### Methods #### realize * **realize(node: VirtualText): Text** Converts a VirtualText node into a Text node. * **realize(node: VirtualElement): HTMLElement** Converts a VirtualElement node into an HTMLElement. #### render * **render(content: VirtualNode | ReadonlyArray | null, host: HTMLElement): void** Renders the given virtual DOM content into the specified host element. ``` -------------------------------- ### BasicKeyHandler for DataGrid Source: https://github.com/jupyterlab/lumino/blob/main/review/api/datagrid.api.md A basic implementation of the `DataGrid.IKeyHandler` interface. Handles common keyboard navigation and actions within the datagrid. ```typescript // @public export class BasicKeyHandler implements DataGrid.IKeyHandler { dispose(): void; get isDisposed(): boolean; protected onArrowDown(grid: DataGrid, event: KeyboardEvent): void; protected onArrowLeft(grid: DataGrid, event: KeyboardEvent): void; protected onArrowRight(grid: DataGrid, event: KeyboardEvent): void; protected onArrowUp(grid: DataGrid, event: KeyboardEvent): void; protected onDelete(grid: DataGrid, event: KeyboardEvent): void; protected onEscape(grid: DataGrid, event: KeyboardEvent): void; protected onKeyC(grid: DataGrid, event: KeyboardEvent): void; onKeyDown(grid: DataGrid, event: KeyboardEvent): void; protected onPageDown(grid: DataGrid, event: KeyboardEvent): void; protected onPageUp(grid: DataGrid, event: KeyboardEvent): void; } ``` -------------------------------- ### KeycodeLayout Class Source: https://github.com/jupyterlab/lumino/blob/main/review/api/keyboard.api.md A concrete implementation of IKeyboardLayout that uses key codes to define the layout. ```APIDOC ## class KeycodeLayout ### Description Implements the IKeyboardLayout interface using key codes. ### Constructor - **constructor**(name: string, codes: KeycodeLayout.CodeMap, modifierKeys?: string[]) - **name**: string - The name of the layout. - **codes**: KeycodeLayout.CodeMap - A map of key codes to key names. - **modifierKeys**: string[] (Optional) - An array of modifier keys. ### Methods - **isModifierKey**(key: string): boolean - Checks if a given key is a modifier key. - **isValidKey**(key: string): boolean - Checks if a given key is valid within the layout. - **keyForKeydownEvent**(event: KeyboardEvent): string - Maps a KeyboardEvent to a key identifier. - **keys**(): string[] - Returns a list of all keys in the layout. ### Properties - **name**: string - The name of the keyboard layout. ``` -------------------------------- ### ClipboardExt Source: https://github.com/jupyterlab/lumino/blob/main/review/api/domutils.api.md Utilities for interacting with the system clipboard. ```APIDOC ## copyText ### Description Copies the given text to the system clipboard. ### Signature ```typescript copyText(text: string): void ``` ### Parameters - **text** (string) - The text to copy to the clipboard. ``` -------------------------------- ### CommandPalette Source: https://github.com/jupyterlab/lumino/blob/main/review/api/widgets.api.md A widget that displays a searchable list of commands. ```APIDOC ## CommandPalette ### Description A widget that provides a searchable interface for executing commands. ### Methods - **addItem(options: CommandPalette.IItemOptions): CommandPalette.IItem** - Adds a single item to the palette. - **addItems(items: CommandPalette.IItemOptions[]): CommandPalette.IItem[]** - Adds multiple items to the palette. - **clearItems(): void** - Removes all items from the palette. - **removeItem(item: CommandPalette.IItem): void** - Removes a specific item. - **removeItemAt(index: number): void** - Removes an item at a specific index. - **refresh(): void** - Refreshes the palette display. ``` -------------------------------- ### Compare Encoding Performance Ratios Source: https://github.com/jupyterlab/lumino/blob/main/notebooks/IdGeneration.ipynb Calculates and displays the ratio of the mean time for custom ID string generation to the mean time for Base64 encoding. This highlights performance differences. ```python meanB/meanA ``` -------------------------------- ### DataGrid Options Source: https://github.com/jupyterlab/lumino/blob/main/review/api/datagrid.api.md Interface defining the configuration options for a DataGrid. ```APIDOC ## IOptions Interface ### Properties - **cellRenderers?**: RendererMap Optional map of custom cell renderers. - **copyConfig?**: CopyConfig Optional configuration for copy-paste behavior. - **defaultRenderer?**: CellRenderer Optional default cell renderer. - **defaultSizes?**: DefaultSizes Optional default sizes for rows and columns. - **headerVisibility?**: HeaderVisibility Optional setting for header visibility. - **minimumSizes?**: MinimumSizes Optional minimum sizes for rows and columns. - **stretchLastColumn?**: boolean Whether to stretch the last column to fill available space. - **stretchLastRow?**: boolean Whether to stretch the last row to fill available space. - **style?**: Style Optional styling for the datagrid. ``` -------------------------------- ### EN_US Keyboard Layout Constant Source: https://github.com/jupyterlab/lumino/blob/main/review/api/keyboard.api.md A predefined keyboard layout for US English. ```APIDOC ## const EN_US: IKeyboardLayout ### Description Predefined keyboard layout for US English. ``` -------------------------------- ### Application Namespace Source: https://github.com/jupyterlab/lumino/blob/main/review/api/application.api.md Contains interfaces and types related to the Application class. ```APIDOC ## Application.IOptions ### Description Options for the Application constructor. ### Properties - **contextMenuRenderer?: Menu.IRenderer**: Optional renderer for the context menu. - **pluginRegistry?: PluginRegistry**: Optional plugin registry. - **shell: T**: The application shell widget (required). ## Application.IStartOptions ### Description Options for the Application.start() method. ### Properties - **bubblingKeydown?: boolean**: Whether keydown events should bubble. - **hostID?: string**: The ID of the host element for the application. - **ignorePlugins?: string[]**: An array of plugin IDs to ignore. - **startPlugins?: string[]**: An array of plugin IDs to start. ``` -------------------------------- ### take Source: https://github.com/jupyterlab/lumino/blob/main/review/api/algorithm.api.md Creates an iterator that yields the first `count` elements from the iterable. ```APIDOC ## take(object: Iterable, count: number): IterableIterator ### Description Creates an iterator that yields the first `count` elements from the iterable. ### Parameters - **object** (Iterable) - The iterable to take elements from. - **count** (number) - The number of elements to take. ``` -------------------------------- ### PluginRegistry Class Source: https://github.com/jupyterlab/lumino/blob/main/review/api/coreutils.api.md Manages the registration, activation, and deactivation of plugins. It allows resolving required and optional services based on tokens. ```APIDOC ## PluginRegistry Class ### Description Manages the registration and lifecycle of plugins. ### Constructor - **constructor**(options?: PluginRegistry.IOptions) - Initializes a new instance of PluginRegistry. ### Properties - **application**: T - The application instance associated with the registry. - **deferredPlugins**: string[] - An array of plugin IDs that are deferred. ### Methods - **activatePlugin**(id: string): Promise - Activates a plugin by its ID. - **activatePlugins**(kind: 'startUp' | 'defer', options?: PluginRegistry.IStartOptions): Promise - Activates plugins based on their kind ('startUp' or 'defer'). - **deactivatePlugin**(id: string): Promise - Deactivates a plugin by its ID and returns a list of deactivated plugins. - **deregisterPlugin**(id: string, force?: boolean): void - Deregisters a plugin from the registry. - **getPluginDescription**(id: string): string - Retrieves the description of a plugin. - **hasPlugin**(id: string): boolean - Checks if a plugin with the given ID is registered. - **isPluginActivated**(id: string): boolean - Checks if a plugin is currently activated. - **listPlugins**(): string[] - Returns a list of all registered plugin IDs. - **registerPlugin**(plugin: IPlugin): void - Registers a single plugin. - **registerPlugins**(plugins: IPlugin[]): void - Registers an array of plugins. - **resolveOptionalService**(token: Token): Promise - Resolves an optional service using its token. - **resolveRequiredService**(token: Token): Promise - Resolves a required service using its token. ``` -------------------------------- ### Keyboard Layout Interface Source: https://github.com/jupyterlab/lumino/blob/main/review/api/keyboard.api.md Defines the structure for a keyboard layout, including methods to check key properties and map keyboard events to key identifiers. ```APIDOC ## interface IKeyboardLayout ### Description Represents a keyboard layout configuration. ### Methods - **isModifierKey**(key: string): boolean - Checks if a given key is a modifier key. - **isValidKey**(key: string): boolean - Checks if a given key is valid within the layout. - **keyForKeydownEvent**(event: KeyboardEvent): string - Maps a KeyboardEvent to a key identifier. - **keys**(): string[] - Returns a list of all keys in the layout. ### Properties - **name**: string - The name of the keyboard layout. ``` -------------------------------- ### Lumino 1 Iterator vs. Lumino 2 Native Iterator Loop Source: https://github.com/jupyterlab/lumino/blob/main/docs/source/migration.md Illustrates the difference in loop termination conditions between Lumino 1 iterators (checking for `undefined`) and native/Lumino 2 iterators (checking the `.done` property). ```typescript while ((it = it.next()) !== undefined) { // loop logic } ``` ```typescript while (!(it = it.next()).done) { // loop logic } ``` -------------------------------- ### Selector Source: https://github.com/jupyterlab/lumino/blob/main/review/api/domutils.api.md Utilities for working with CSS selectors. ```APIDOC ## calculateSpecificity ### Description Calculates the specificity value of a given CSS selector. ### Signature ```typescript calculateSpecificity(selector: string): number ``` ### Parameters - **selector** (string) - The CSS selector string. ### Returns The specificity value as a number. ``` ```APIDOC ## isValid ### Description Checks if a given string is a valid CSS selector. ### Signature ```typescript isValid(selector: string): boolean ``` ### Parameters - **selector** (string) - The string to validate as a CSS selector. ### Returns `true` if the selector is valid, `false` otherwise. ``` ```APIDOC ## matches ### Description Checks if a DOM element matches a given CSS selector. ### Signature ```typescript matches(element: Element, selector: string): boolean ``` ### Parameters - **element** (Element) - The DOM element to test. - **selector** (string) - The CSS selector to match against. ### Returns `true` if the element matches the selector, `false` otherwise. ``` -------------------------------- ### getKeyboardLayout Function Source: https://github.com/jupyterlab/lumino/blob/main/review/api/keyboard.api.md Retrieves the current keyboard layout configuration. ```APIDOC ## function getKeyboardLayout() ### Description Gets the current keyboard layout. ### Returns - **IKeyboardLayout** - The current keyboard layout object. ``` -------------------------------- ### Menu Class Source: https://github.com/jupyterlab/lumino/blob/main/review/api/widgets.api.md The Menu class provides a widget for displaying a list of commands or submenus. ```APIDOC ## Menu ### Description A widget that displays a list of items, which can be commands or submenus. ### Methods - **constructor(options: Menu.IOptions)**: Create a new menu instance. - **addItem(options: Menu.IItemOptions): Menu.IItem**: Add an item to the menu. - **insertItem(index: number, options: Menu.IItemOptions): Menu.IItem**: Insert an item at a specific index. - **removeItem(item: Menu.IItem): void**: Remove a specific item. - **removeItemAt(index: number): void**: Remove an item at a specific index. - **clearItems(): void**: Remove all items from the menu. - **open(x: number, y: number, options?: Menu.IOpenOptions): void**: Open the menu at the specified coordinates. ``` -------------------------------- ### Import convert-hrtime Source: https://github.com/jupyterlab/lumino/blob/main/notebooks/IdGeneration.ipynb Imports the convert-hrtime module for time conversion. ```javascript const convertHrtime = require('convert-hrtime'); ``` -------------------------------- ### Signal Namespace Static Methods Source: https://github.com/jupyterlab/lumino/blob/main/review/api/signaling.api.md Provides utility functions for managing signal connections and exception handling. ```APIDOC ## Signal Static Methods ### Description Provides utility functions for managing signal connections and exception handling. ### Methods #### clearData(object: unknown): void Clears all signal data associated with the given object. #### disconnectAll(object: unknown): void Disconnects all signals associated with the given object. #### disconnectBetween(sender: unknown, receiver: unknown): void Disconnects signals between a specific sender and receiver. #### disconnectReceiver(receiver: unknown): void Disconnects all signals connected to a specific receiver. #### disconnectSender(sender: unknown): void Disconnects all signals emitted by a specific sender. #### getExceptionHandler(): Signal.ExceptionHandler Gets the current exception handler for signals. #### setExceptionHandler(handler: Signal.ExceptionHandler): Signal.ExceptionHandler Sets a new exception handler for signals. Returns the previously set handler. ``` -------------------------------- ### BasicSelectionModel for DataGrid Source: https://github.com/jupyterlab/lumino/blob/main/review/api/datagrid.api.md A basic implementation of the `SelectionModel` for managing cell selections in a datagrid. Supports clearing selections, moving the cursor, and selecting cells. ```typescript // @public export class BasicSelectionModel extends SelectionModel { clear(): void; currentSelection(): SelectionModel.Selection | null; get cursorColumn(): number; get cursorRow(): number; get isEmpty(): boolean; moveCursorWithinSelections(direction: SelectionModel.CursorMoveDirection): void; protected onDataModelChanged(sender: DataModel, args: DataModel.ChangedArgs): void; select(args: SelectionModel.SelectArgs): void; selections(): IterableIterator; } ``` -------------------------------- ### DockPanel Source: https://github.com/jupyterlab/lumino/blob/main/review/api/widgets.api.md A widget that provides a dockable layout for other widgets. It supports multiple modes and layout management. ```APIDOC ## DockPanel ### Description A widget that provides a dockable layout for other widgets. It supports multiple modes and layout management. ### Methods - **activateWidget(widget: Widget)**: Activates the given widget. - **addWidget(widget: Widget, options?: DockPanel.IAddOptions)**: Adds a widget to the dock panel. - **saveLayout()**: Returns the current layout configuration. - **restoreLayout(config: DockPanel.ILayoutConfig)**: Restores the layout from a configuration object. - **selectWidget(widget: Widget)**: Selects the given widget. ``` -------------------------------- ### Implement a service consumer plugin Source: https://github.com/jupyterlab/lumino/blob/main/docs/source/plugin-registry-server.md Define a plugin that requires a service by listing the token in the requires array, which the registry then injects into the activate function. ```typescript import { IPlugin } from '@lumino/coreutils'; import { IGreeting } from './tokens'; export const greeter: IPlugin = { id: 'example:greeter', requires: [IGreeting], activate: (_, greeting: IGreeting) => { console.log(`[greeter] ${greeting.greet('from the hello plugin')}`); } }; ``` -------------------------------- ### Widget.attach Source: https://github.com/jupyterlab/lumino/blob/main/review/api/widgets.api.md Attaches a widget to a specific DOM host element. ```APIDOC ## Widget.attach(widget: Widget, host: HTMLElement, ref?: HTMLElement | null): void ### Description Attaches a widget to a specified host element in the DOM. An optional reference element can be provided to insert the widget before a specific child. ### Parameters - **widget** (Widget) - Required - The widget instance to attach. - **host** (HTMLElement) - Required - The DOM element to serve as the host. - **ref** (HTMLElement | null) - Optional - The reference element to insert before. ``` -------------------------------- ### Initialize Poll with Promise-based tick subscription Source: https://github.com/jupyterlab/lumino/blob/main/packages/polling/README.md Creates a new Poll instance and connects to its `ticked` signal. This is suitable for reacting to poll ticks using Lumino signals. Ensure to dispose of the poll when no longer needed. ```typescript const poll = new Poll({ factory: () => Promise.resolve(), frequency: { interval: 100, backoff: false } }); ``` ```typescript poll.ticked.connect((_, tick) => { expect(tick).to.equal(poll.state); }); await sleep(1000); // Sleep for longer than the interval. poll.dispose(); ``` -------------------------------- ### Package version updates Source: https://github.com/jupyterlab/lumino/blob/main/CHANGELOG.md List of updated package versions for the Lumino application suite. ```text @lumino/application: 2.4.0 => 2.4.1 @lumino/datagrid: 2.4.0 => 2.4.1 @lumino/default-theme: 2.1.6 => 2.1.7 @lumino/widgets: 2.4.0 => 2.5.0 ```