@theia/core
Version:
Theia is a cloud & desktop IDE framework implemented in TypeScript.
45 lines • 1.85 kB
JavaScript
import { __decorate, __param } from "tslib";
import { jsx as _jsx } from "react/jsx-runtime";
// *****************************************************************************
// Copyright (C) 2018 TypeFox and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************
import * as React from 'react';
import { injectable, unmanaged } from 'inversify';
import { Disposable } from '../../common/index.js';
import { BaseWidget } from './widget.js';
import { createRoot } from 'react-dom/client';
let ReactWidget = class ReactWidget extends BaseWidget {
constructor(options) {
super(options);
this.scrollOptions = {
suppressScrollX: true,
minScrollbarLength: 35,
};
this.nodeRoot = createRoot(this.node);
this.toDispose.push(Disposable.create(() => this.nodeRoot.unmount()));
}
onUpdateRequest(msg) {
super.onUpdateRequest(msg);
if (!this.isDisposed) {
this.nodeRoot.render(_jsx(React.Fragment, { children: this.render() }));
}
}
};
ReactWidget = __decorate([
injectable(),
__param(0, unmanaged())
], ReactWidget);
export { ReactWidget };
//# sourceMappingURL=react-widget.js.map