Skip to content

Commit

Permalink
Remove the unneeded and buggy lit-html work around.
Browse files Browse the repository at this point in the history
issue #309
  • Loading branch information
sedwards2009 committed Nov 20, 2020
1 parent 93a66e9 commit 2db14cd
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 97 deletions.
1 change: 0 additions & 1 deletion extraterm/src/render_process/TerminalCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { trimBetweenTags } from "extraterm-trim-between-tags";
import { CssFile } from '../theme/Theme';
import { EVENT_DRAG_STARTED, EVENT_DRAG_ENDED } from './GeneralEvents';
import { TerminalVisualConfig, injectTerminalVisualConfig } from "./TerminalVisualConfig";
import { disassembleDOMTree } from "./DomUtils";

const SCROLL_STEP = 1;
const CHILD_RESIZE_BATCH_SIZE = 3;
Expand Down
9 changes: 1 addition & 8 deletions extraterm/src/render_process/command/EmptyPaneMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { CustomElement } from "extraterm-web-component-decorators";
import { html, render, parts } from "extraterm-lit-html";
import { html, render } from "extraterm-lit-html";

import * as ThemeTypes from "../../theme/Theme";
import {ThemeableElementBase} from "../ThemeableElementBase";
Expand All @@ -14,7 +14,6 @@ import * as DomUtils from "../DomUtils";
import {commandPaletteFilterEntries, commandPaletteFormatEntries, CommandAndShortcut } from "./CommandPalette";
import {Logger, getLogger} from "extraterm-logging";
import { log } from "extraterm-logging";
import { disassembleDOMTree } from "../DomUtils";

const ID_LIST_PICKER = "ID_LIST_PICKER";

Expand Down Expand Up @@ -49,12 +48,6 @@ export class EmptyPaneMenu extends ThemeableElementBase {
listPicker.setEntries(this._entries);
}

disconnectedCallback(): void {
super.disconnectedCallback();
parts.set(this.shadowRoot, undefined);
disassembleDOMTree(this.shadowRoot);
}

protected _render(): void {
const template = html`${this._styleTag()}
<div id="ID_EMPTY_PANE_MENU">
Expand Down
9 changes: 1 addition & 8 deletions extraterm/src/render_process/gui/DropDown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
*
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
import { html, parts, render } from "extraterm-lit-html";
import { html, render } from "extraterm-lit-html";
import { CustomElement } from "extraterm-web-component-decorators";

import {ContextMenu} from "./ContextMenu";
import { ThemeableElementBase } from "../ThemeableElementBase";
import { disassembleDOMTree } from "../DomUtils";


const SLOT_CONTEXTMENU = "et-context-menu";
Expand Down Expand Up @@ -39,12 +38,6 @@ export class DropDown extends ThemeableElementBase {
this.addEventListener("selected", this._handleSelected);
}

disconnectedCallback(): void {
super.disconnectedCallback();
parts.set(this.shadowRoot, undefined);
disassembleDOMTree(this.shadowRoot);
}

private _setupChildObservation(): void {
const childChangeCallback: MutationCallback = (mutationsList, observer) => {
for(const mutation of mutationsList) {
Expand Down
9 changes: 1 addition & 8 deletions extraterm/src/render_process/gui/ListPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
import { html, parts, render, TemplateResult } from "extraterm-lit-html";
import { html, render, TemplateResult } from "extraterm-lit-html";
import { DirectiveFn } from "extraterm-lit-html/lib/directive";
import { repeat } from "extraterm-lit-html/directives/repeat";
import { Disposable } from "@extraterm/extraterm-extension-api";
Expand All @@ -15,7 +15,6 @@ import {doLater} from "extraterm-later";
import {Logger, getLogger} from "extraterm-logging";
import { log } from "extraterm-logging";
import { ThemeableElementBase } from "../ThemeableElementBase";
import { disassembleDOMTree } from "../DomUtils";

const ID_FILTER = "ID_FILTER";
const ID_RESULTS = "ID_RESULTS";
Expand Down Expand Up @@ -54,12 +53,6 @@ export class ListPicker<T extends { id: string; }> extends ThemeableElementBase
this._render();
}

disconnectedCallback(): void {
super.disconnectedCallback();
parts.set(this.shadowRoot, undefined);
disassembleDOMTree(this.shadowRoot);
}

private _handleFilterInput(): void {
const filterInput = <HTMLInputElement> DomUtils.getShadowId(this, ID_FILTER);
this.filter = filterInput.value;
Expand Down
9 changes: 1 addition & 8 deletions extraterm/src/render_process/gui/MenuItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
*
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
import { html, parts, render, TemplateResult } from "extraterm-lit-html";
import { html, render, TemplateResult } from "extraterm-lit-html";
import { classMap } from "extraterm-lit-html/directives/class-map.js";
import { unsafeHTML } from "extraterm-lit-html/directives/unsafe-html";
import { Attribute, Observe, CustomElement } from "extraterm-web-component-decorators";

import * as ThemeTypes from "../../theme/Theme";
import { ThemeableElementBase } from "../ThemeableElementBase";
import { disassembleDOMTree } from "../DomUtils";


/**
Expand All @@ -37,12 +36,6 @@ export class MenuItem extends ThemeableElementBase {
this._render();
}

disconnectedCallback(): void {
super.disconnectedCallback();
parts.set(this.shadowRoot, undefined);
disassembleDOMTree(this.shadowRoot);
}

protected _render(): void {
const template = html`${this._styleTag()}
<div id="ID_CONTAINER" class=${classMap({"selected": this.selected})}>
Expand Down
9 changes: 1 addition & 8 deletions extraterm/src/render_process/gui/PopDownDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
import {Attribute, Observe, CustomElement } from "extraterm-web-component-decorators";
import { html, parts, render } from "extraterm-lit-html";
import { html, render } from "extraterm-lit-html";

import * as ThemeTypes from "../../theme/Theme";
import { ThemeableElementBase } from "../ThemeableElementBase";
import { disassembleDOMTree } from "../DomUtils";

const CLASS_CONTEXT_COVER_OPEN = "CLASS_CONTEXT_COVER_OPEN";
const CLASS_CONTEXT_COVER_CLOSED = "CLASS_CONTEXT_COVER_CLOSED";
Expand All @@ -35,12 +34,6 @@ export class PopDownDialog extends ThemeableElementBase {
this._render();
}

disconnectedCallback(): void {
super.disconnectedCallback();
parts.set(this.shadowRoot, undefined);
disassembleDOMTree(this.shadowRoot);
}

private _handleContainerContextMenu(): void {
this.dispatchEvent(new CustomEvent(PopDownDialog.EVENT_CLOSE_REQUEST, {bubbles: false}));
}
Expand Down
9 changes: 1 addition & 8 deletions extraterm/src/render_process/gui/PopDownListPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
import { html, render, TemplateResult, parts } from "extraterm-lit-html";
import { html, render, TemplateResult } from "extraterm-lit-html";
import { DirectiveFn } from "extraterm-lit-html/lib/directive";
import { live } from "extraterm-lit-html/directives/live";
import { repeat } from "extraterm-lit-html/directives/repeat";
Expand All @@ -17,7 +17,6 @@ import * as ThemeTypes from "../../theme/Theme";
import {PopDownDialog} from "./PopDownDialog";
import { ThemeableElementBase } from "../ThemeableElementBase";
import * as DomUtils from "../DomUtils";
import { disassembleDOMTree } from "../DomUtils";


const ID_FILTER = "ID_FILTER";
Expand Down Expand Up @@ -71,12 +70,6 @@ export class PopDownListPicker<T extends { id: string; }> extends ThemeableEleme
(entry, index) => html`<div data-id=${entry.id}>${entry.id}</div>`);
}

disconnectedCallback(): void {
super.disconnectedCallback();
parts.set(this.shadowRoot, undefined);
disassembleDOMTree(this.shadowRoot);
}

private _handleDialogClose(): void {
this._open = false;
this._scheduleUpdate({updateContents: true});
Expand Down
9 changes: 1 addition & 8 deletions extraterm/src/render_process/gui/PopDownNumberDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
*/
import {Disposable} from "@extraterm/extraterm-extension-api";
import { Attribute, Observe, CustomElement } from "extraterm-web-component-decorators";
import { html, parts, render } from "extraterm-lit-html";
import { html, render } from "extraterm-lit-html";

import * as DomUtils from "../DomUtils";
import {doLater} from "extraterm-later";
import {PopDownDialog} from "./PopDownDialog";
import * as ThemeTypes from "../../theme/Theme";
import { ThemeableElementBase } from "../ThemeableElementBase";
import { disassembleDOMTree } from "../DomUtils";

const ID_INPUT = "ID_INPUT";

Expand All @@ -36,12 +35,6 @@ export class PopDownNumberDialog extends ThemeableElementBase {
this._render();
}

disconnectedCallback(): void {
super.disconnectedCallback();
parts.set(this.shadowRoot, undefined);
disassembleDOMTree(this.shadowRoot);
}

protected _render(): void {
const template = html`${this._styleTag()}
<et-pop-down-dialog
Expand Down
9 changes: 1 addition & 8 deletions extraterm/src/render_process/gui/ScrollBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
*
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
import { html, render, parts } from "extraterm-lit-html";
import { html, render } from "extraterm-lit-html";
import { Attribute, Filter, Observe, CustomElement } from "extraterm-web-component-decorators";

import { log, Logger, getLogger } from "extraterm-logging";
import * as DomUtils from "../DomUtils";
import * as ThemeTypes from "../../theme/Theme";
import { ThemeableElementBase } from "../ThemeableElementBase";
import { disassembleDOMTree } from "../DomUtils";

const ID_AREA = "ID_AREA";
const ID_CONTAINER = "ID_CONTAINER";
Expand Down Expand Up @@ -60,12 +59,6 @@ export class ScrollBar extends ThemeableElementBase {
this._updatePosition("position");
}

disconnectedCallback(): void {
super.disconnectedCallback();
parts.set(this.shadowRoot, undefined);
disassembleDOMTree(this.shadowRoot);
}

protected _themeCssFiles(): ThemeTypes.CssFile[] {
return [ThemeTypes.CssFile.GUI_SCROLLBAR];
}
Expand Down
9 changes: 1 addition & 8 deletions extraterm/src/render_process/gui/SidebarLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
*
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
import { html, render, parts } from "extraterm-lit-html";
import { html, render } from "extraterm-lit-html";
import { CustomElement } from "extraterm-web-component-decorators";
import { getLogger, Logger } from "extraterm-logging";
import { CssFile } from "../../theme/Theme";
import { ThemeableElementBase } from "../ThemeableElementBase";
import { disassembleDOMTree } from "../DomUtils";


export type BorderSide = "north" | "south" | "east" | "west";
Expand All @@ -29,12 +28,6 @@ export class SidebarLayout extends ThemeableElementBase {
this._render();
}

disconnectedCallback(): void {
super.disconnectedCallback();
parts.set(this.shadowRoot, undefined);
disassembleDOMTree(this.shadowRoot);
}

private _handleSlotChange(ev: Event): void {
const slot = <HTMLSlotElement> ev.target;
if (slot.assignedNodes().length === 0) {
Expand Down
9 changes: 1 addition & 8 deletions extraterm/src/render_process/gui/SnapDropContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
*
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
import { html, render, parts } from "extraterm-lit-html";
import { html, render } from "extraterm-lit-html";
import { log, Logger, getLogger} from "extraterm-logging";
import { CustomElement, Attribute, Observe } from 'extraterm-web-component-decorators';

import {ThemeableElementBase} from '../ThemeableElementBase';
import * as ThemeTypes from '../../theme/Theme';
import * as DomUtils from '../DomUtils';
import {ElementMimeType, FrameMimeType} from '../InternalMimeTypes';
import { disassembleDOMTree } from "../DomUtils";


const ID_TOP = "ID_TOP";
Expand Down Expand Up @@ -79,12 +78,6 @@ export class SnapDropContainer extends ThemeableElementBase {
this._supportedMimeTypes = SUPPORTED_MIMETYPES.map(mt => mt + mimeTypeParams);
}

disconnectedCallback(): void {
super.disconnectedCallback();
parts.set(this.shadowRoot, undefined);
disassembleDOMTree(this.shadowRoot);
}

@Attribute windowId = "";
@Observe("windowId")
private _observeWindowId(target: string): void {
Expand Down
9 changes: 1 addition & 8 deletions extraterm/src/render_process/gui/StackedWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
import {Attribute, Filter, Observe, CustomElement } from "extraterm-web-component-decorators";
import { html, parts, render, TemplateResult } from "extraterm-lit-html";
import { html, render, TemplateResult } from "extraterm-lit-html";

import * as ThemeTypes from "../../theme/Theme";
import { ThemeableElementBase } from "../ThemeableElementBase";
import { disassembleDOMTree } from "../DomUtils";


/**
Expand Down Expand Up @@ -38,12 +37,6 @@ export class StackedWidget extends ThemeableElementBase {
this._mutationObserver.observe(this, { childList: true });
}

disconnectedCallback(): void {
super.disconnectedCallback();
parts.set(this.shadowRoot, undefined);
disassembleDOMTree(this.shadowRoot);
}

protected _render(): void {
const slots: TemplateResult[] = [];
for (let i=0; i<this.childElementCount; i++) {
Expand Down
9 changes: 1 addition & 8 deletions extraterm/src/render_process/gui/TabWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
import * as _ from "lodash";
import { html, render, TemplateResult, parts } from "extraterm-lit-html";
import { html, render, TemplateResult } from "extraterm-lit-html";
import { Attribute, Observe, CustomElement, Filter } from "extraterm-web-component-decorators";
import { classMap } from "extraterm-lit-html/directives/class-map.js";

Expand All @@ -21,7 +21,6 @@ import { SnapDropContainer } from "./SnapDropContainer";
import { EVENT_DRAG_STARTED, EVENT_DRAG_ENDED } from "../GeneralEvents";
import { ElementMimeType, FrameMimeType } from "../InternalMimeTypes";
import { ThemeableElementBase } from "../ThemeableElementBase";
import { disassembleDOMTree } from "../DomUtils";

const ATTR_TAG_REST_LEFT = "rest-left";
const ATTR_TAG_REST_RIGHT = "rest";
Expand Down Expand Up @@ -92,12 +91,6 @@ export class TabWidget extends ThemeableElementBase {
this._setupDragAndDrop();
}

disconnectedCallback(): void {
super.disconnectedCallback();
parts.set(this.shadowRoot, undefined);
disassembleDOMTree(this.shadowRoot);
}

private _syncDom(): void {
const domChildren = this.children;
if (this._isEqualElementLists(domChildren, this._childNodes)) {
Expand Down

0 comments on commit 2db14cd

Please sign in to comment.