@termaxjs/web-ui 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/dist/Terminal.d.ts +128 -0
- package/dist/Terminal.d.ts.map +1 -0
- package/dist/Terminal.js +1070 -0
- package/dist/Terminal.js.map +1 -0
- package/dist/adapters/tauri.d.ts +16 -0
- package/dist/adapters/tauri.d.ts.map +1 -0
- package/dist/adapters/tauri.js +30 -0
- package/dist/adapters/tauri.js.map +1 -0
- package/dist/adapters/web.d.ts +18 -0
- package/dist/adapters/web.d.ts.map +1 -0
- package/dist/adapters/web.js +38 -0
- package/dist/adapters/web.js.map +1 -0
- package/dist/adapters/worker.d.ts +26 -0
- package/dist/adapters/worker.d.ts.map +1 -0
- package/dist/adapters/worker.js +62 -0
- package/dist/adapters/worker.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/renderer/BoxDrawingRenderer.d.ts +7 -0
- package/dist/renderer/BoxDrawingRenderer.d.ts.map +1 -0
- package/dist/renderer/BoxDrawingRenderer.js +138 -0
- package/dist/renderer/BoxDrawingRenderer.js.map +1 -0
- package/dist/renderer/CanvasRenderer.d.ts +51 -0
- package/dist/renderer/CanvasRenderer.d.ts.map +1 -0
- package/dist/renderer/CanvasRenderer.js +537 -0
- package/dist/renderer/CanvasRenderer.js.map +1 -0
- package/dist/renderer/DomRenderer.d.ts +15 -0
- package/dist/renderer/DomRenderer.d.ts.map +1 -0
- package/dist/renderer/DomRenderer.js +112 -0
- package/dist/renderer/DomRenderer.js.map +1 -0
- package/dist/renderer/GlyphAtlas.d.ts +26 -0
- package/dist/renderer/GlyphAtlas.d.ts.map +1 -0
- package/dist/renderer/GlyphAtlas.js +86 -0
- package/dist/renderer/GlyphAtlas.js.map +1 -0
- package/dist/renderer/WebGpuRenderer.d.ts +31 -0
- package/dist/renderer/WebGpuRenderer.d.ts.map +1 -0
- package/dist/renderer/WebGpuRenderer.js +134 -0
- package/dist/renderer/WebGpuRenderer.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { CellFlags } from '@termaxjs/web-core';
|
|
2
|
+
export class DomRenderer {
|
|
3
|
+
element;
|
|
4
|
+
lineElements = [];
|
|
5
|
+
options;
|
|
6
|
+
constructor(options = {}) {
|
|
7
|
+
this.options = {
|
|
8
|
+
cols: options.cols || 80,
|
|
9
|
+
rows: options.rows || 24,
|
|
10
|
+
fontFamily: options.fontFamily || 'monospace',
|
|
11
|
+
fontSize: options.fontSize || 14,
|
|
12
|
+
lineHeight: options.lineHeight || 1.2,
|
|
13
|
+
theme: options.theme || {},
|
|
14
|
+
cursorBlink: options.cursorBlink ?? true,
|
|
15
|
+
cursorStyle: options.cursorStyle || 'block',
|
|
16
|
+
};
|
|
17
|
+
const fontSize = this.options.fontSize || 14;
|
|
18
|
+
const fontFamily = this.options.fontFamily || 'monospace';
|
|
19
|
+
const lineHeight = this.options.lineHeight || 1.2;
|
|
20
|
+
this.element = document.createElement('div');
|
|
21
|
+
this.element.className = 'termaxui-dom-renderer';
|
|
22
|
+
this.element.setAttribute('role', 'region');
|
|
23
|
+
this.element.setAttribute('aria-label', 'Terminal Output');
|
|
24
|
+
this.element.setAttribute('aria-live', 'polite');
|
|
25
|
+
this.element.style.fontFamily = fontFamily;
|
|
26
|
+
this.element.style.fontSize = `${fontSize}px`;
|
|
27
|
+
this.element.style.lineHeight = `${lineHeight}`;
|
|
28
|
+
this.element.style.backgroundColor = this.options.theme?.background || '#181818';
|
|
29
|
+
this.element.style.color = this.options.theme?.foreground || '#ffffff';
|
|
30
|
+
this.element.style.whiteSpace = 'pre';
|
|
31
|
+
this.element.style.userSelect = 'text';
|
|
32
|
+
this.initLines(this.options.rows || 24);
|
|
33
|
+
}
|
|
34
|
+
attach(container) {
|
|
35
|
+
container.appendChild(this.element);
|
|
36
|
+
}
|
|
37
|
+
resize(cols, rows) {
|
|
38
|
+
this.options.cols = cols;
|
|
39
|
+
this.options.rows = rows;
|
|
40
|
+
this.initLines(rows);
|
|
41
|
+
}
|
|
42
|
+
updateTheme(theme) {
|
|
43
|
+
this.options.theme = theme;
|
|
44
|
+
this.element.style.backgroundColor = theme.background || '#181818';
|
|
45
|
+
this.element.style.color = theme.foreground || '#ffffff';
|
|
46
|
+
}
|
|
47
|
+
applyDiff(diff) {
|
|
48
|
+
if (diff.rows !== (this.options.rows || 24)) {
|
|
49
|
+
this.resize(diff.cols, diff.rows);
|
|
50
|
+
}
|
|
51
|
+
for (const dirtyRow of diff.dirtyRows) {
|
|
52
|
+
if (dirtyRow.row < this.lineElements.length) {
|
|
53
|
+
this.renderLine(dirtyRow.row, dirtyRow.cells);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
initLines(rows) {
|
|
58
|
+
this.element.replaceChildren();
|
|
59
|
+
this.lineElements = new Array(rows);
|
|
60
|
+
for (let r = 0; r < rows; r++) {
|
|
61
|
+
const lineDiv = document.createElement('div');
|
|
62
|
+
lineDiv.className = 'termaxui-line';
|
|
63
|
+
lineDiv.textContent = ' ';
|
|
64
|
+
this.element.appendChild(lineDiv);
|
|
65
|
+
this.lineElements[r] = lineDiv;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
renderLine(row, cells) {
|
|
69
|
+
const lineEl = this.lineElements[row];
|
|
70
|
+
if (!lineEl)
|
|
71
|
+
return;
|
|
72
|
+
lineEl.replaceChildren();
|
|
73
|
+
let currentSpan = null;
|
|
74
|
+
let currentStyle = '';
|
|
75
|
+
for (let col = 0; col < cells.length; col++) {
|
|
76
|
+
const cell = cells[col];
|
|
77
|
+
if (cell.width === 0)
|
|
78
|
+
continue;
|
|
79
|
+
const style = this.computeCellStyle(cell);
|
|
80
|
+
if (!currentSpan || style !== currentStyle) {
|
|
81
|
+
currentSpan = document.createElement('span');
|
|
82
|
+
if (style)
|
|
83
|
+
currentSpan.style.cssText = style;
|
|
84
|
+
lineEl.appendChild(currentSpan);
|
|
85
|
+
currentStyle = style;
|
|
86
|
+
}
|
|
87
|
+
currentSpan.textContent += cell.char;
|
|
88
|
+
}
|
|
89
|
+
if (!lineEl.hasChildNodes()) {
|
|
90
|
+
lineEl.textContent = ' ';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
computeCellStyle(cell) {
|
|
94
|
+
let css = '';
|
|
95
|
+
if (cell.fg.type === 'rgb' && cell.fg.r !== undefined) {
|
|
96
|
+
css += `color: rgb(${cell.fg.r},${cell.fg.g},${cell.fg.b});`;
|
|
97
|
+
}
|
|
98
|
+
if (cell.bg.type === 'rgb' && cell.bg.r !== undefined) {
|
|
99
|
+
css += `background-color: rgb(${cell.bg.r},${cell.bg.g},${cell.bg.b});`;
|
|
100
|
+
}
|
|
101
|
+
if (cell.flags & CellFlags.BOLD)
|
|
102
|
+
css += 'font-weight:bold;';
|
|
103
|
+
if (cell.flags & CellFlags.ITALIC)
|
|
104
|
+
css += 'font-style:italic;';
|
|
105
|
+
if (cell.flags & CellFlags.UNDERLINE)
|
|
106
|
+
css += 'text-decoration:underline;';
|
|
107
|
+
if (cell.flags & CellFlags.STRIKETHROUGH)
|
|
108
|
+
css += 'text-decoration:line-through;';
|
|
109
|
+
return css;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=DomRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DomRenderer.js","sourceRoot":"","sources":["../../src/renderer/DomRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8E,MAAM,oBAAoB,CAAC;AAE3H,MAAM,OAAO,WAAW;IACN,OAAO,CAAiB;IAChC,YAAY,GAAqB,EAAE,CAAC;IACpC,OAAO,CAAmB;IAElC,YAAY,UAA4B,EAAE;QACxC,IAAI,CAAC,OAAO,GAAG;YACb,IAAI,EAAE,OAAO,C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AC;QAC5D,IAAI,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,MAAM;YAAE,GAAG,IAAI,oBAAoB,CAAC;QAC/D,IAAI,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,SAAS;YAAE,GAAG,IAAI,4BAA4B,CAAC;QAC1E,IAAI,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,aAAa;YAAE,GAAG,IAAI,+BAA+B,CAAC;QACjF,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface GlyphLocation {
|
|
2
|
+
u0: number;
|
|
3
|
+
v0: number;
|
|
4
|
+
u1: number;
|
|
5
|
+
v1: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class GlyphAtlas {
|
|
10
|
+
readonly width = 2048;
|
|
11
|
+
readonly height = 2048;
|
|
12
|
+
private canvas;
|
|
13
|
+
private ctx;
|
|
14
|
+
private glyphCache;
|
|
15
|
+
private nextX;
|
|
16
|
+
private nextY;
|
|
17
|
+
private rowHeight;
|
|
18
|
+
private dpr;
|
|
19
|
+
isDirty: boolean;
|
|
20
|
+
constructor(dpr?: number);
|
|
21
|
+
getCanvas(): HTMLCanvasElement | null;
|
|
22
|
+
getGlyph(char: string, font: string, fontSize: number, charWidth: number, charHeight: number): GlyphLocation;
|
|
23
|
+
private rasterizeGlyph;
|
|
24
|
+
clear(): void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=GlyphAtlas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlyphAtlas.d.ts","sourceRoot":"","sources":["../../src/renderer/GlyphAtlas.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,UAAU;IACrB,SAAgB,KAAK,QAAQ;IAC7B,SAAgB,MAAM,QAAQ;IAC9B,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,GAAG,CAAyC;IACpD,OAAO,CAAC,UAAU,CAAyC;IAE3D,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,GAAG,CAAK;IACT,OAAO,UAAS;gBAEX,GAAG,SAAI;IAcZ,SAAS,IAAI,iBAAiB,GAAG,IAAI;IAIrC,QAAQ,CACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,aAAa;IAQhB,OAAO,CAAC,cAAc;IAsDf,KAAK,IAAI,IAAI;CAWrB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export class GlyphAtlas {
|
|
2
|
+
width = 2048;
|
|
3
|
+
height = 2048;
|
|
4
|
+
canvas = null;
|
|
5
|
+
ctx = null;
|
|
6
|
+
glyphCache = new Map();
|
|
7
|
+
nextX = 0;
|
|
8
|
+
nextY = 0;
|
|
9
|
+
rowHeight = 0;
|
|
10
|
+
dpr = 1;
|
|
11
|
+
isDirty = false;
|
|
12
|
+
constructor(dpr = 1) {
|
|
13
|
+
this.dpr = dpr;
|
|
14
|
+
if (typeof document !== 'undefined') {
|
|
15
|
+
this.canvas = document.createElement('canvas');
|
|
16
|
+
this.canvas.width = this.width;
|
|
17
|
+
this.canvas.height = this.height;
|
|
18
|
+
this.ctx = this.canvas.getContext('2d', { willReadFrequently: true });
|
|
19
|
+
if (this.ctx) {
|
|
20
|
+
this.ctx.fillStyle = '#000000';
|
|
21
|
+
this.ctx.fillRect(0, 0, this.width, this.height);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
getCanvas() {
|
|
26
|
+
return this.canvas;
|
|
27
|
+
}
|
|
28
|
+
getGlyph(char, font, fontSize, charWidth, charHeight) {
|
|
29
|
+
const key = `${char}_${font}_${fontSize}`;
|
|
30
|
+
const cached = this.glyphCache.get(key);
|
|
31
|
+
if (cached)
|
|
32
|
+
return cached;
|
|
33
|
+
return this.rasterizeGlyph(char, font, fontSize, charWidth, charHeight, key);
|
|
34
|
+
}
|
|
35
|
+
rasterizeGlyph(char, font, fontSize, charWidth, charHeight, key) {
|
|
36
|
+
const glyphW = Math.ceil(charWidth * this.dpr);
|
|
37
|
+
const glyphH = Math.ceil(charHeight * this.dpr);
|
|
38
|
+
if (this.nextX + glyphW > this.width) {
|
|
39
|
+
this.nextX = 0;
|
|
40
|
+
this.nextY += this.rowHeight + 2;
|
|
41
|
+
this.rowHeight = 0;
|
|
42
|
+
}
|
|
43
|
+
if (this.nextY + glyphH > this.height) {
|
|
44
|
+
// Atlas is full; reset
|
|
45
|
+
this.clear();
|
|
46
|
+
}
|
|
47
|
+
const x = this.nextX;
|
|
48
|
+
const y = this.nextY;
|
|
49
|
+
this.nextX += glyphW + 2;
|
|
50
|
+
this.rowHeight = Math.max(this.rowHeight, glyphH);
|
|
51
|
+
if (this.ctx) {
|
|
52
|
+
this.ctx.save();
|
|
53
|
+
this.ctx.fillStyle = '#000000';
|
|
54
|
+
this.ctx.fillRect(x, y, glyphW, glyphH);
|
|
55
|
+
this.ctx.fillStyle = '#ffffff';
|
|
56
|
+
this.ctx.font = `${fontSize * this.dpr}px ${font}`;
|
|
57
|
+
this.ctx.textBaseline = 'middle';
|
|
58
|
+
this.ctx.textAlign = 'left';
|
|
59
|
+
this.ctx.fillText(char, x, y + glyphH / 2);
|
|
60
|
+
this.ctx.restore();
|
|
61
|
+
this.isDirty = true;
|
|
62
|
+
}
|
|
63
|
+
const location = {
|
|
64
|
+
u0: x / this.width,
|
|
65
|
+
v0: y / this.height,
|
|
66
|
+
u1: (x + glyphW) / this.width,
|
|
67
|
+
v1: (y + glyphH) / this.height,
|
|
68
|
+
width: charWidth,
|
|
69
|
+
height: charHeight,
|
|
70
|
+
};
|
|
71
|
+
this.glyphCache.set(key, location);
|
|
72
|
+
return location;
|
|
73
|
+
}
|
|
74
|
+
clear() {
|
|
75
|
+
this.glyphCache.clear();
|
|
76
|
+
this.nextX = 0;
|
|
77
|
+
this.nextY = 0;
|
|
78
|
+
this.rowHeight = 0;
|
|
79
|
+
if (this.ctx) {
|
|
80
|
+
this.ctx.fillStyle = '#000000';
|
|
81
|
+
this.ctx.fillRect(0, 0, this.width, this.height);
|
|
82
|
+
this.isDirty = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=GlyphAtlas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlyphAtlas.js","sourceRoot":"","sources":["../../src/renderer/GlyphAtlas.ts"],"names":[],"mappings":"AASA,MAAM,OAAO,UAAU;IACL,KAAK,GAAG,IAAI,CAAC;IACb,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,GAA6B,IAAI,CAAC;IACxC,GAAG,GAAoC,IAAI,CAAC;IAC5C,UAAU,GAA+B,IAAI,GAAG,EAAE,CAAC;IAEnD,KAAK,GAAG,CAAC,CAAC;IACV,KAAK,GAAG,CAAC,CAAC;IACV,SAAS,GAAG,CAAC,CAAC;IACd,GAAG,GAAG,CAAC,CAAC;IACT,OAAO,GAAG,KAAK,CAAC;IAEvB,YAAY,GAAG,GAAG,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;YACpC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;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AC;YACnB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,CAAC;QAED,MAAM,QAAQ,GAAkB;YAC9B,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK;YAClB,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM;YACnB,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK;YAC7B,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM;YAC9B,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,UAAU;SACnB,CAAC;QAEF,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACnC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC;YAC/B,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACjD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HoveredLink, ITerminalOptions, SearchMatch, SelectionRange, TerminalDiff, TerminalImage, TerminalTheme } from '@termaxjs/web-core';
|
|
2
|
+
export declare class WebGpuRenderer {
|
|
3
|
+
readonly canvas: HTMLCanvasElement;
|
|
4
|
+
private fallbackRenderer;
|
|
5
|
+
private isWebGpuSupported;
|
|
6
|
+
private adapter;
|
|
7
|
+
private device;
|
|
8
|
+
private context;
|
|
9
|
+
private pipeline;
|
|
10
|
+
private atlas;
|
|
11
|
+
charWidth: number;
|
|
12
|
+
charHeight: number;
|
|
13
|
+
private dpr;
|
|
14
|
+
private options;
|
|
15
|
+
constructor(options?: ITerminalOptions);
|
|
16
|
+
private initWebGpu;
|
|
17
|
+
attach(container: HTMLElement): void;
|
|
18
|
+
updateTheme(theme: TerminalTheme): void;
|
|
19
|
+
setSelection(selection: SelectionRange | null): void;
|
|
20
|
+
setSearchMatches(matches: SearchMatch[]): void;
|
|
21
|
+
setHoveredLink(link: HoveredLink | null): void;
|
|
22
|
+
setImages(images: TerminalImage[]): void;
|
|
23
|
+
updateScroll(viewportY: number, totalLines: number): void;
|
|
24
|
+
resize(cols: number, rows: number): void;
|
|
25
|
+
applyDiff(diff: TerminalDiff): void;
|
|
26
|
+
renderAll(): void;
|
|
27
|
+
measureFont(): void;
|
|
28
|
+
resizeCanvas(): void;
|
|
29
|
+
isSupported(): boolean;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=WebGpuRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebGpuRenderer.d.ts","sourceRoot":"","sources":["../../src/renderer/WebGpuRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,cAAc,EAGd,YAAY,EACZ,aAAa,EACb,aAAa,EACd,MAAM,oBAAoB,CAAC;AAqD5B,qBAAa,cAAc;IACzB,SAAgB,MAAM,EAAE,iBAAiB,CAAC;IAC1C,OAAO,CAAC,gBAAgB,CAAiB;IACzC,OAAO,CAAC,iBAAiB,CAAS;IAElC,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,KAAK,CAAa;IAEnB,SAAS,SAAK;IACd,UAAU,SAAM;IACvB,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,OAAO,CAAmB;gBAEtB,OAAO,GAAE,gBAAqB;YAQ5B,UAAU;IAsBjB,MAAM,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI;IAIpC,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAIvC,YAAY,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI,GAAG,IAAI;IAIpD,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI;IAI9C,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI;IAI9C,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI;IAIxC,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAIzD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAIxC,SAAS,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAInC,SAAS,IAAI,IAAI;IAIjB,WAAW,IAAI,IAAI;IAMnB,YAAY,IAAI,IAAI;IAIpB,WAAW,IAAI,OAAO;CAG9B"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { GlyphAtlas } from './GlyphAtlas.js';
|
|
2
|
+
import { CanvasRenderer } from './CanvasRenderer.js';
|
|
3
|
+
const TERMINAL_WGSL = `
|
|
4
|
+
struct Uniforms {
|
|
5
|
+
screenSize: vec2<f32>,
|
|
6
|
+
cellSize: vec2<f32>,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
struct VertexInput {
|
|
10
|
+
@location(0) position: vec2<f32>,
|
|
11
|
+
@location(1) uv: vec2<f32>,
|
|
12
|
+
@location(2) cellPos: vec2<f32>,
|
|
13
|
+
@location(3) glyphUV0: vec2<f32>,
|
|
14
|
+
@location(4) glyphUV1: vec2<f32>,
|
|
15
|
+
@location(5) fgColor: vec4<f32>,
|
|
16
|
+
@location(6) bgColor: vec4<f32>,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
struct VertexOutput {
|
|
20
|
+
@builtin(position) position: vec4<f32>,
|
|
21
|
+
@location(0) uv: vec2<f32>,
|
|
22
|
+
@location(1) fgColor: vec4<f32>,
|
|
23
|
+
@location(2) bgColor: vec4<f32>,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
@group(0) @binding(0) var<uniform> uniforms: Uniforms;
|
|
27
|
+
@group(0) @binding(1) var atlasTexture: texture_2d<f32>;
|
|
28
|
+
@group(0) @binding(2) var atlasSampler: sampler;
|
|
29
|
+
|
|
30
|
+
@vertex
|
|
31
|
+
fn vs_main(input: VertexInput) -> VertexOutput {
|
|
32
|
+
var output: VertexOutput;
|
|
33
|
+
|
|
34
|
+
let pixelPos = input.cellPos * uniforms.cellSize + input.position * uniforms.cellSize;
|
|
35
|
+
let ndc = (pixelPos / uniforms.screenSize) * 2.0 - 1.0;
|
|
36
|
+
output.position = vec4<f32>(ndc.x, -ndc.y, 0.0, 1.0);
|
|
37
|
+
|
|
38
|
+
output.uv = mix(input.glyphUV0, input.glyphUV1, input.uv);
|
|
39
|
+
output.fgColor = input.fgColor;
|
|
40
|
+
output.bgColor = input.bgColor;
|
|
41
|
+
return output;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@fragment
|
|
45
|
+
fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
|
|
46
|
+
let glyphAlpha = textureSample(atlasTexture, atlasSampler, input.uv).r;
|
|
47
|
+
let finalColor = mix(input.bgColor, input.fgColor, glyphAlpha);
|
|
48
|
+
return finalColor;
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
export class WebGpuRenderer {
|
|
52
|
+
canvas;
|
|
53
|
+
fallbackRenderer;
|
|
54
|
+
isWebGpuSupported = false;
|
|
55
|
+
adapter = null;
|
|
56
|
+
device = null;
|
|
57
|
+
context = null;
|
|
58
|
+
pipeline = null;
|
|
59
|
+
atlas;
|
|
60
|
+
charWidth = 9;
|
|
61
|
+
charHeight = 18;
|
|
62
|
+
dpr = 1;
|
|
63
|
+
options;
|
|
64
|
+
constructor(options = {}) {
|
|
65
|
+
this.options = options;
|
|
66
|
+
this.fallbackRenderer = new CanvasRenderer(options);
|
|
67
|
+
this.canvas = this.fallbackRenderer.canvas;
|
|
68
|
+
this.atlas = new GlyphAtlas(this.dpr);
|
|
69
|
+
this.initWebGpu();
|
|
70
|
+
}
|
|
71
|
+
async initWebGpu() {
|
|
72
|
+
if (typeof navigator === 'undefined' || !navigator.gpu) {
|
|
73
|
+
this.isWebGpuSupported = false;
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
this.adapter = await navigator.gpu.requestAdapter();
|
|
78
|
+
if (!this.adapter)
|
|
79
|
+
return false;
|
|
80
|
+
this.device = await this.adapter.requestDevice();
|
|
81
|
+
this.context = this.canvas.getContext('webgpu');
|
|
82
|
+
if (!this.context)
|
|
83
|
+
return false;
|
|
84
|
+
this.isWebGpuSupported = true;
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
this.isWebGpuSupported = false;
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
attach(container) {
|
|
93
|
+
this.fallbackRenderer.attach(container);
|
|
94
|
+
}
|
|
95
|
+
updateTheme(theme) {
|
|
96
|
+
this.fallbackRenderer.updateTheme(theme);
|
|
97
|
+
}
|
|
98
|
+
setSelection(selection) {
|
|
99
|
+
this.fallbackRenderer.setSelection(selection);
|
|
100
|
+
}
|
|
101
|
+
setSearchMatches(matches) {
|
|
102
|
+
this.fallbackRenderer.setSearchMatches(matches);
|
|
103
|
+
}
|
|
104
|
+
setHoveredLink(link) {
|
|
105
|
+
this.fallbackRenderer.setHoveredLink(link);
|
|
106
|
+
}
|
|
107
|
+
setImages(images) {
|
|
108
|
+
this.fallbackRenderer.setImages(images);
|
|
109
|
+
}
|
|
110
|
+
updateScroll(viewportY, totalLines) {
|
|
111
|
+
this.fallbackRenderer.updateScroll(viewportY, totalLines);
|
|
112
|
+
}
|
|
113
|
+
resize(cols, rows) {
|
|
114
|
+
this.fallbackRenderer.resize(cols, rows);
|
|
115
|
+
}
|
|
116
|
+
applyDiff(diff) {
|
|
117
|
+
this.fallbackRenderer.applyDiff(diff);
|
|
118
|
+
}
|
|
119
|
+
renderAll() {
|
|
120
|
+
this.fallbackRenderer.renderAll();
|
|
121
|
+
}
|
|
122
|
+
measureFont() {
|
|
123
|
+
this.fallbackRenderer.measureFont();
|
|
124
|
+
this.charWidth = this.fallbackRenderer.charWidth;
|
|
125
|
+
this.charHeight = this.fallbackRenderer.charHeight;
|
|
126
|
+
}
|
|
127
|
+
resizeCanvas() {
|
|
128
|
+
this.fallbackRenderer.resizeCanvas();
|
|
129
|
+
}
|
|
130
|
+
isSupported() {
|
|
131
|
+
return this.isWebGpuSupported;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=WebGpuRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebGpuRenderer.js","sourceRoot":"","sources":["../../src/renderer/WebGpuRenderer.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CrB,CAAC;AAEF,MAAM,OAAO,cAAc;IACT,MAAM,CAAoB;IAClC,gBAAgB,CAAiB;IACjC,iBAAiB,GAAG,KAAK,CAAC;IAE1B,OAAO,GAAQ,IAAI,CAAC;IACpB,MAAM,GAAQ,IAAI,CAAC;IACnB,OAAO,GAAQ,IAAI,CAAC;IACpB,QAAQ,GAAQ,IAAI,CAAC;IACrB,KAAK,CAAa;IA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,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC;IACvC,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@termaxjs/web-ui",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "High-performance Canvas/WebGL terminal renderer engine and Terminal controller for Termax",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@termaxjs/web-core": "0.1.1"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"typescript": "^5.7.2",
|
|
21
|
+
"vitest": "^3.0.5"
|
|
22
|
+
},
|
|
23
|
+
"license": "Apache-2.0",
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsc",
|
|
34
|
+
"check-types": "tsc --noEmit",
|
|
35
|
+
"test": "vitest run --passWithNoTests"
|
|
36
|
+
}
|
|
37
|
+
}
|