Skip to content

Commit

Permalink
fixed build of widgets pkg wrt to custom rendering changes in virtualdom
Browse files Browse the repository at this point in the history
- needed to add new `h` signature overloads to the `h.IFactory` interface
  • Loading branch information
telamonian committed Jan 26, 2020
1 parent 63e04c1 commit 5711b2f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
2 changes: 2 additions & 0 deletions packages/virtualdom/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,8 @@ namespace h {
interface IFactory {
(...children: Child[]): VirtualElement;
(attrs: ElementAttrs, ...children: Child[]): VirtualElement;
(renderer: VirtualElement.IRenderer, ...children: h.Child[]): VirtualElement;
(attrs: ElementAttrs, renderer: VirtualElement.IRenderer, ...children: h.Child[]): VirtualElement;
}

export const a: IFactory = h.bind(undefined, 'a');
Expand Down
2 changes: 1 addition & 1 deletion packages/virtualdom/tests/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('@lumino/virtualdom', () => {

});

describe('VirtualElementPass', () => {
describe('VirtualElement with custom .renderer', () => {
let mockRenderer = {
render: (host: HTMLElement) => {},
unrender: (host: HTMLElement) =>{}
Expand Down
10 changes: 3 additions & 7 deletions packages/widgets/src/tabbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
} from '@lumino/signaling';

import {
ElementDataset, ElementInlineStyle, VirtualDOM, VirtualElement, VirtualElementPass, h, hpass
ElementDataset, ElementInlineStyle, VirtualDOM, VirtualElement, h
} from '@lumino/virtualdom';

import {
Expand Down Expand Up @@ -1356,15 +1356,11 @@ namespace TabBar {
*
* @returns A virtual element representing the tab icon.
*/
renderIcon(data: IRenderData<any>): VirtualElement | VirtualElementPass {
renderIcon(data: IRenderData<any>): VirtualElement {
const { title } = data;
let className = this.createIconClass(data);

if (title.iconRenderer) {
return hpass('div', {className, title: title.iconLabel}, title.iconRenderer);
} else {
return h.div({className}, title.iconLabel);
}
return h.div({className}, title.iconRenderer, title.iconLabel);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions packages/widgets/src/title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
ISignal, Signal
} from '@lumino/signaling';

import { VirtualElementPass } from "@lumino/virtualdom";
import { VirtualElement } from "@lumino/virtualdom";


/**
Expand Down Expand Up @@ -183,7 +183,7 @@ class Title<T> {
* #### Notes
* The default value is undefined.
*/
get iconRenderer(): VirtualElementPass.IRenderer {
get iconRenderer(): VirtualElement.IRenderer {
return this._iconRenderer;
}

Expand All @@ -193,7 +193,7 @@ class Title<T> {
* #### Notes
* A renderer is an object that supplies a render and unrender function.
*/
set iconRenderer(value: VirtualElementPass.IRenderer) {
set iconRenderer(value: VirtualElement.IRenderer) {
if (this._iconRenderer === value) {
return;
}
Expand Down Expand Up @@ -299,7 +299,7 @@ class Title<T> {
private _mnemonic = -1;
private _iconClass = '';
private _iconLabel = '';
private _iconRenderer: VirtualElementPass.IRenderer;
private _iconRenderer: VirtualElement.IRenderer;
private _className = '';
private _closable = false;
private _dataset: Title.Dataset;
Expand Down Expand Up @@ -357,7 +357,7 @@ namespace Title {
* An object that supplies render and unrender functions used
* to create and cleanup the icon of the title.
*/
iconRenderer?: VirtualElementPass.IRenderer;
iconRenderer?: VirtualElement.IRenderer;

/**
* The caption for the title.
Expand Down

0 comments on commit 5711b2f

Please sign in to comment.