@opentui/core 0.1.43 → 0.1.44
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/3d/WGPURenderer.d.ts +2 -0
- package/3d/canvas.d.ts +2 -0
- package/3d.js +33 -2
- package/3d.js.map +4 -4
- package/{index-23t1sg60.js → index-bd7k864e.js} +1332 -4
- package/{index-23t1sg60.js.map → index-bd7k864e.js.map} +5 -5
- package/index.js +2 -3
- package/index.js.map +3 -3
- package/lib/ascii.font.d.ts +208 -1
- package/package.json +7 -7
- package/renderer.d.ts +2 -1
- package/testing.js +1 -1
package/3d/WGPURenderer.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export declare class ThreeCliRenderer {
|
|
|
35
35
|
private doRenderStats;
|
|
36
36
|
private resizeHandler;
|
|
37
37
|
private debugToggleHandler;
|
|
38
|
+
private destroyHandler;
|
|
38
39
|
private renderTimeMs;
|
|
39
40
|
private readbackTimeMs;
|
|
40
41
|
private totalDrawTimeMs;
|
|
@@ -52,6 +53,7 @@ export declare class ThreeCliRenderer {
|
|
|
52
53
|
setSize(width: number, height: number, forceUpdate?: boolean): void;
|
|
53
54
|
drawScene(root: Scene, buffer: OptimizedBuffer, deltaTime: number): Promise<void>;
|
|
54
55
|
private rendering;
|
|
56
|
+
private destroyed;
|
|
55
57
|
doDrawScene(root: Scene, camera: PerspectiveCamera | OrthographicCamera, buffer: OptimizedBuffer, deltaTime: number): Promise<void>;
|
|
56
58
|
toggleSuperSampling(): void;
|
|
57
59
|
renderStats(buffer: OptimizedBuffer): void;
|
package/3d/canvas.d.ts
CHANGED
|
@@ -22,7 +22,9 @@ export declare class CLICanvas {
|
|
|
22
22
|
private updateScheduled;
|
|
23
23
|
private screenshotGPUBuffer;
|
|
24
24
|
private superSampleAlgorithm;
|
|
25
|
+
private destroyed;
|
|
25
26
|
constructor(device: GPUDevice, width: number, height: number, superSample: SuperSampleType, sampleAlgo?: SuperSampleAlgorithm);
|
|
27
|
+
destroy(): void;
|
|
26
28
|
setSuperSampleAlgorithm(superSampleAlgorithm: SuperSampleAlgorithm): void;
|
|
27
29
|
getSuperSampleAlgorithm(): SuperSampleAlgorithm;
|
|
28
30
|
getContext(type: string, attrs?: WebGLContextAttributes): GPUCanvasContextMock;
|
package/3d.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
__export,
|
|
6
6
|
__require,
|
|
7
7
|
__toESM
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-bd7k864e.js";
|
|
9
9
|
|
|
10
10
|
// ../../node_modules/omggif/omggif.js
|
|
11
11
|
var require_omggif = __commonJS((exports) => {
|
|
@@ -31480,6 +31480,7 @@ class CLICanvas {
|
|
|
31480
31480
|
updateScheduled = false;
|
|
31481
31481
|
screenshotGPUBuffer = null;
|
|
31482
31482
|
superSampleAlgorithm = 0 /* STANDARD */;
|
|
31483
|
+
destroyed = false;
|
|
31483
31484
|
constructor(device, width, height, superSample, sampleAlgo = 0 /* STANDARD */) {
|
|
31484
31485
|
this.device = device;
|
|
31485
31486
|
this.width = width;
|
|
@@ -31488,6 +31489,9 @@ class CLICanvas {
|
|
|
31488
31489
|
this.gpuCanvasContext = new GPUCanvasContextMock(this, width, height);
|
|
31489
31490
|
this.superSampleAlgorithm = sampleAlgo;
|
|
31490
31491
|
}
|
|
31492
|
+
destroy() {
|
|
31493
|
+
this.destroyed = true;
|
|
31494
|
+
}
|
|
31491
31495
|
setSuperSampleAlgorithm(superSampleAlgorithm) {
|
|
31492
31496
|
this.superSampleAlgorithm = superSampleAlgorithm;
|
|
31493
31497
|
this.scheduleUpdateComputeBuffers();
|
|
@@ -31659,6 +31663,9 @@ class CLICanvas {
|
|
|
31659
31663
|
});
|
|
31660
31664
|
}
|
|
31661
31665
|
async runComputeShaderSuperSampling(texture, buffer) {
|
|
31666
|
+
if (this.destroyed) {
|
|
31667
|
+
return;
|
|
31668
|
+
}
|
|
31662
31669
|
if (this.updateScheduled) {
|
|
31663
31670
|
this.updateScheduled = false;
|
|
31664
31671
|
await this.device.queue.onSubmittedWorkDone();
|
|
@@ -31695,6 +31702,10 @@ class CLICanvas {
|
|
|
31695
31702
|
const commandBuffer = commandEncoder.finish();
|
|
31696
31703
|
this.device.queue.submit([commandBuffer]);
|
|
31697
31704
|
await this.computeReadbackBuffer.mapAsync(GPUMapMode.READ);
|
|
31705
|
+
if (this.destroyed) {
|
|
31706
|
+
this.computeReadbackBuffer.unmap();
|
|
31707
|
+
return;
|
|
31708
|
+
}
|
|
31698
31709
|
const resultsPtr = this.computeReadbackBuffer.getMappedRangePtr();
|
|
31699
31710
|
const size = this.computeReadbackBuffer.size;
|
|
31700
31711
|
this.mapAsyncTimeMs = performance.now() - mapAsyncStart;
|
|
@@ -31718,6 +31729,9 @@ class CLICanvas {
|
|
|
31718
31729
|
});
|
|
31719
31730
|
}
|
|
31720
31731
|
async readPixelsIntoBuffer(buffer) {
|
|
31732
|
+
if (this.destroyed) {
|
|
31733
|
+
return;
|
|
31734
|
+
}
|
|
31721
31735
|
const texture = this.gpuCanvasContext.getCurrentTexture();
|
|
31722
31736
|
this.gpuCanvasContext.switchTextures();
|
|
31723
31737
|
if (this.superSample === "gpu" /* GPU */) {
|
|
@@ -31743,6 +31757,10 @@ class CLICanvas {
|
|
|
31743
31757
|
const mapStart = performance.now();
|
|
31744
31758
|
await textureBuffer.mapAsync(GPUMapMode.READ, 0, textureBuffer.size);
|
|
31745
31759
|
this.mapAsyncTimeMs = performance.now() - mapStart;
|
|
31760
|
+
if (this.destroyed) {
|
|
31761
|
+
textureBuffer.unmap();
|
|
31762
|
+
return;
|
|
31763
|
+
}
|
|
31746
31764
|
const mappedRangePtr = textureBuffer.getMappedRangePtr(0, textureBuffer.size);
|
|
31747
31765
|
const bufPtr = mappedRangePtr;
|
|
31748
31766
|
if (this.superSample === "cpu" /* CPU */) {
|
|
@@ -31809,6 +31827,7 @@ class ThreeCliRenderer {
|
|
|
31809
31827
|
doRenderStats = false;
|
|
31810
31828
|
resizeHandler;
|
|
31811
31829
|
debugToggleHandler;
|
|
31830
|
+
destroyHandler;
|
|
31812
31831
|
renderTimeMs = 0;
|
|
31813
31832
|
readbackTimeMs = 0;
|
|
31814
31833
|
totalDrawTimeMs = 0;
|
|
@@ -31848,10 +31867,14 @@ class ThreeCliRenderer {
|
|
|
31848
31867
|
this.debugToggleHandler = (enabled) => {
|
|
31849
31868
|
this.doRenderStats = enabled;
|
|
31850
31869
|
};
|
|
31870
|
+
this.destroyHandler = () => {
|
|
31871
|
+
this.destroy();
|
|
31872
|
+
};
|
|
31851
31873
|
if (options.autoResize !== false) {
|
|
31852
31874
|
this.cliRenderer.on("resize", this.resizeHandler);
|
|
31853
31875
|
}
|
|
31854
31876
|
this.cliRenderer.on("debugOverlay:toggle" /* DEBUG_OVERLAY_TOGGLE */, this.debugToggleHandler);
|
|
31877
|
+
this.cliRenderer.on("destroy" /* DESTROY */, this.destroyHandler);
|
|
31855
31878
|
setupGlobals({ libPath: options.libPath });
|
|
31856
31879
|
}
|
|
31857
31880
|
toggleDebugStats() {
|
|
@@ -31921,11 +31944,15 @@ class ThreeCliRenderer {
|
|
|
31921
31944
|
}
|
|
31922
31945
|
}
|
|
31923
31946
|
rendering = false;
|
|
31947
|
+
destroyed = false;
|
|
31924
31948
|
async doDrawScene(root, camera, buffer, deltaTime) {
|
|
31925
31949
|
if (this.rendering) {
|
|
31926
31950
|
console.warn("ThreeCliRenderer.drawScene was called concurrently, which is not supported.");
|
|
31927
31951
|
return;
|
|
31928
31952
|
}
|
|
31953
|
+
if (this.destroyed) {
|
|
31954
|
+
return;
|
|
31955
|
+
}
|
|
31929
31956
|
try {
|
|
31930
31957
|
this.rendering = true;
|
|
31931
31958
|
const totalStart = performance.now();
|
|
@@ -31971,8 +31998,12 @@ class ThreeCliRenderer {
|
|
|
31971
31998
|
});
|
|
31972
31999
|
}
|
|
31973
32000
|
destroy() {
|
|
32001
|
+
this.destroyed = true;
|
|
31974
32002
|
this.cliRenderer.off("resize", this.resizeHandler);
|
|
31975
32003
|
this.cliRenderer.off("debugOverlay:toggle" /* DEBUG_OVERLAY_TOGGLE */, this.debugToggleHandler);
|
|
32004
|
+
if (this.canvas) {
|
|
32005
|
+
this.canvas.destroy();
|
|
32006
|
+
}
|
|
31976
32007
|
if (this.threeRenderer) {
|
|
31977
32008
|
this.threeRenderer.dispose();
|
|
31978
32009
|
this.threeRenderer = undefined;
|
|
@@ -33843,5 +33874,5 @@ export {
|
|
|
33843
33874
|
CLICanvas
|
|
33844
33875
|
};
|
|
33845
33876
|
|
|
33846
|
-
//# debugId=
|
|
33877
|
+
//# debugId=FCEC1E4FDF9F8DF664756E2164756E21
|
|
33847
33878
|
//# sourceMappingURL=3d.js.map
|