fix(core): update

This commit is contained in:
2023-09-21 20:16:32 +02:00
parent 256a002595
commit b8f6c38689
18 changed files with 6846 additions and 12985 deletions

View File

@ -1,4 +1,4 @@
import { customElement, DeesElement, html, TemplateResult } from '@designestate/dees-element';
import { customElement, DeesElement, html, type TemplateResult } from '@design.estate/dees-element';
declare global {
interface HTMLElementTagNameMap {

View File

@ -3,11 +3,11 @@ import {
property,
html,
customElement,
TemplateResult,
type TemplateResult,
css,
cssManager,
} from '@designestate/dees-element';
import * as domtools from '@designestate/dees-domtools';
} from '@design.estate/dees-element';
import * as domtools from '@design.estate/dees-domtools';
import type * as monaco from 'monaco-editor';

View File

@ -3,13 +3,13 @@ import {
property,
html,
customElement,
TemplateResult,
type TemplateResult,
css,
cssManager,
} from '@designestate/dees-element';
import * as domtools from '@designestate/dees-domtools';
} from '@design.estate/dees-element';
import * as domtools from '@design.estate/dees-domtools';
import * as smartmarkdown from '@pushrocks/smartmarkdown';
import * as smartmarkdown from '@push.rocks/smartmarkdown';
const deferred = domtools.plugins.smartpromise.defer();

View File

@ -1,5 +1,15 @@
import { DeesElement, property, html, customElement, TemplateResult, css, cssManager } from '@designestate/dees-element';
import * as domtools from '@designestate/dees-domtools';
import {
DeesElement,
property,
html,
customElement,
type TemplateResult,
css,
cssManager,
} from '@design.estate/dees-element';
import * as domtools from '@design.estate/dees-domtools';
import * as webcontainer from '@webcontainer/api';
import { Terminal } from 'xterm';
import { FitAddon } from 'xterm-addon-fit';
@ -12,9 +22,7 @@ declare global {
@customElement('dees-terminal')
export class DeesTerminal extends DeesElement {
public static demo = () => html`
<dees-terminal></dees-terminal>
`;
public static demo = () => html` <dees-terminal></dees-terminal> `;
constructor() {
super();
@ -79,143 +87,143 @@ export class DeesTerminal extends DeesElement {
*/
.xterm {
font-feature-settings: "liga" 0;
position: relative;
user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
font-feature-settings: 'liga' 0;
position: relative;
user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
}
.xterm.focus,
.xterm:focus {
outline: none;
outline: none;
}
.xterm .xterm-helpers {
position: absolute;
top: 0;
/**
position: absolute;
top: 0;
/**
* The z-index of the helpers must be higher than the canvases in order for
* IMEs to appear on top.
*/
z-index: 5;
z-index: 5;
}
.xterm .xterm-helper-textarea {
padding: 0;
border: 0;
margin: 0;
/* Move textarea out of the screen to the far left, so that the cursor is not visible */
position: absolute;
opacity: 0;
left: -9999em;
top: 0;
width: 0;
height: 0;
z-index: -5;
/** Prevent wrapping so the IME appears against the textarea at the correct position */
white-space: nowrap;
overflow: hidden;
resize: none;
padding: 0;
border: 0;
margin: 0;
/* Move textarea out of the screen to the far left, so that the cursor is not visible */
position: absolute;
opacity: 0;
left: -9999em;
top: 0;
width: 0;
height: 0;
z-index: -5;
/** Prevent wrapping so the IME appears against the textarea at the correct position */
white-space: nowrap;
overflow: hidden;
resize: none;
}
.xterm .composition-view {
/* TODO: Composition position got messed up somewhere */
background: #000;
color: #FFF;
display: none;
position: absolute;
white-space: nowrap;
z-index: 1;
/* TODO: Composition position got messed up somewhere */
background: #000;
color: #fff;
display: none;
position: absolute;
white-space: nowrap;
z-index: 1;
}
.xterm .composition-view.active {
display: block;
display: block;
}
.xterm .xterm-viewport {
/* On OS X this is required in order for the scroll bar to appear fully opaque */
background-color: #000;
overflow-y: scroll;
cursor: default;
position: absolute;
right: 0;
left: 0;
top: 0;
bottom: 0;
/* On OS X this is required in order for the scroll bar to appear fully opaque */
background-color: #000;
overflow-y: scroll;
cursor: default;
position: absolute;
right: 0;
left: 0;
top: 0;
bottom: 0;
}
.xterm .xterm-screen {
position: relative;
position: relative;
}
.xterm .xterm-screen canvas {
position: absolute;
left: 0;
top: 0;
position: absolute;
left: 0;
top: 0;
}
.xterm .xterm-scroll-area {
visibility: hidden;
visibility: hidden;
}
.xterm-char-measure-element {
display: inline-block;
visibility: hidden;
position: absolute;
top: 0;
left: -9999em;
line-height: normal;
display: inline-block;
visibility: hidden;
position: absolute;
top: 0;
left: -9999em;
line-height: normal;
}
.xterm {
cursor: text;
cursor: text;
}
.xterm.enable-mouse-events {
/* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
cursor: default;
/* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
cursor: default;
}
.xterm.xterm-cursor-pointer {
cursor: pointer;
cursor: pointer;
}
.xterm.column-select.focus {
/* Column selection mode */
cursor: crosshair;
/* Column selection mode */
cursor: crosshair;
}
.xterm .xterm-accessibility,
.xterm .xterm-message {
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
z-index: 10;
color: transparent;
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
z-index: 10;
color: transparent;
}
.xterm .live-region {
position: absolute;
left: -9999px;
width: 1px;
height: 1px;
overflow: hidden;
position: absolute;
left: -9999px;
width: 1px;
height: 1px;
overflow: hidden;
}
.xterm-dim {
opacity: 0.5;
opacity: 0.5;
}
.xterm-underline {
text-decoration: underline;
text-decoration: underline;
}
`
]
`,
];
public render (): TemplateResult {
public render(): TemplateResult {
return html`
<div class="mainbox">
<div id="container"></div>
@ -223,11 +231,17 @@ export class DeesTerminal extends DeesElement {
`;
}
public async firstUpdated (_changedProperties: Map<string | number | symbol, unknown>): Promise<void> {
public async firstUpdated(
_changedProperties: Map<string | number | symbol, unknown>
): Promise<void> {
const domtools = await this.domtoolsPromise;
super.firstUpdated(_changedProperties);
const container = this.shadowRoot.getElementById('container');
const term = new Terminal();
const term = new Terminal({
convertEol: true,
cursorBlink: true,
});
const fitAddon = new FitAddon();
term.loadAddon(fitAddon);
@ -238,5 +252,23 @@ export class DeesTerminal extends DeesElement {
fitAddon.fit();
term.write(`dees-terminal custom terminal. \r\n$ `);
// lets start the webcontainer
// Call only once
const webcontainerInstance = await webcontainer.WebContainer.boot();
const shellProcess = await webcontainerInstance.spawn('jsh');
shellProcess.output.pipeTo(
new WritableStream({
write(data) {
term.write(data);
},
})
);
const input = shellProcess.input.getWriter();
term.onData((data) => {
input.write(data);
});
await domtools.convenience.smartdelay.delayFor(5000);
input.write(`pnpm add isomorphic-git @git.zone/tsbuild\n`);
}
}
}