@crysound/crychart 1.0.5 → 1.0.7
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/README.md +24 -2
- package/README.zh-CN.md +24 -2
- package/dist/crychart.cjs +479 -38
- package/dist/crychart.global.js +479 -38
- package/dist/crychart.js +479 -38
- package/dist/types/adapters/opentest.d.ts +3 -1
- package/dist/types/chart.d.ts +9 -0
- package/dist/types/index.d.ts +13 -2
- package/dist/types/mesh3d.d.ts +1 -0
- package/dist/types/render-heatmap.d.ts +2 -0
- package/dist/types/render.d.ts +4 -0
- package/dist/types/shared-webgl-context.d.ts +83 -0
- package/docs/npm-usage.md +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ChartXY } from '../chart.js';
|
|
2
|
+
import type { SharedWebGLContext } from '../shared-webgl-context.js';
|
|
2
3
|
/** OpenTest's public data envelope, represented independently of its Vue host. */
|
|
3
4
|
export type NumericValues = readonly number[] | Float32Array | Float64Array | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array;
|
|
4
5
|
export interface DataEnvelope {
|
|
@@ -33,8 +34,9 @@ export interface FrameworkChartOptions {
|
|
|
33
34
|
fontSize?: number;
|
|
34
35
|
viewport?: ChartViewport;
|
|
35
36
|
showYCursor?: boolean;
|
|
37
|
+
sharedContext?: SharedWebGLContext;
|
|
36
38
|
}
|
|
37
|
-
export type FrameworkChartDisplayOptions = Partial<Omit<FrameworkChartOptions, 'xScale' | 'showYCursor'>>;
|
|
39
|
+
export type FrameworkChartDisplayOptions = Partial<Omit<FrameworkChartOptions, 'xScale' | 'showYCursor' | 'sharedContext'>>;
|
|
38
40
|
export interface FrameworkChartApi {
|
|
39
41
|
setData(data: DataEnvelope, options?: FrameworkSeriesOptions & {
|
|
40
42
|
append?: boolean;
|
package/dist/types/chart.d.ts
CHANGED
|
@@ -14,12 +14,15 @@ import { SurfaceGrid3D, SurfaceMesh3D, MeshModel3D, BoxSeries3D } from './mesh3d
|
|
|
14
14
|
import { type PolarLayout, type PolarInsets } from './polar-layout.js';
|
|
15
15
|
import { type AxisPosition, type PublicEventListener, type ChartEventListenerOptions } from './chart-events.js';
|
|
16
16
|
import { type Projection3D, type Vec3 } from './world-camera.js';
|
|
17
|
+
import { type SharedWebGLContext } from './shared-webgl-context.js';
|
|
17
18
|
export interface ChartOptions {
|
|
18
19
|
/** Artifact research switch; this candidate defaults to the world camera. */
|
|
19
20
|
experimental3DCameraModel?: 'world' | 'legacy';
|
|
20
21
|
container?: HTMLElement | string;
|
|
21
22
|
antialias?: boolean;
|
|
22
23
|
renderer?: 'auto' | 'webgl2' | 'canvas2d';
|
|
24
|
+
/** Share one WebGL2 context across charts (ChartXY/Polar only). null opts out when a cryChart() context injects one. */
|
|
25
|
+
sharedContext?: SharedWebGLContext | null;
|
|
23
26
|
/** Explicit diagnostic opt-in. Pixel and paired-performance validation is ongoing. */
|
|
24
27
|
experimentalLineBlocks?: boolean;
|
|
25
28
|
/** Display-only extrema candidate; disabled unless an explicit pixel span is supplied. */
|
|
@@ -129,6 +132,11 @@ export declare class ChartXY {
|
|
|
129
132
|
private observer?;
|
|
130
133
|
private overlayContext?;
|
|
131
134
|
private underlayContext?;
|
|
135
|
+
private sharedCore?;
|
|
136
|
+
private sharedPresent;
|
|
137
|
+
private sharedClient?;
|
|
138
|
+
private sharedOffscreen;
|
|
139
|
+
private sharedDeferred;
|
|
132
140
|
private heatmapRenderer?;
|
|
133
141
|
private heatmapPalettes;
|
|
134
142
|
private heatCache;
|
|
@@ -319,6 +327,7 @@ export declare class ChartXY {
|
|
|
319
327
|
protected cancelAxisScrollAnimations(): void;
|
|
320
328
|
protected hasPendingAnimationFrame(): boolean;
|
|
321
329
|
protected cancelScheduledAnimation(): void;
|
|
330
|
+
private setSharedOffscreen;
|
|
322
331
|
invalidate(): void;
|
|
323
332
|
renderNow(): void;
|
|
324
333
|
/** Internal post-render publication hook; consumer callbacks may request a new frame. */
|
package/dist/types/index.d.ts
CHANGED
|
@@ -24,13 +24,21 @@ export * from './polar-heatmap.js';
|
|
|
24
24
|
export * from './polar-series.js';
|
|
25
25
|
export * from './mesh3d.js';
|
|
26
26
|
export * from "./adapters/opentest.js";
|
|
27
|
+
export { SharedWebGLContext, type SharedContextOptions, type SharedWebGLContextStats, } from "./shared-webgl-context.js";
|
|
27
28
|
import { ChartXY, Chart3D, Polar, type ChartOptions } from "./chart.js";
|
|
28
29
|
import { Pie, Gauge, Spider, BarChart, TreeMapChart, ParallelCoordinateChart, DataGrid } from "./specialty.js";
|
|
29
30
|
import { SunBurstChart, Funnel, Pyramid } from "./hierarchy.js";
|
|
30
31
|
import { MapChart, type MapOptions } from "./map.js";
|
|
31
32
|
import { type EventListener } from './core/events.js';
|
|
33
|
+
import { SharedWebGLContext, type SharedContextOptions } from "./shared-webgl-context.js";
|
|
34
|
+
export interface CryChartOptions {
|
|
35
|
+
sharedContext?: SharedWebGLContext;
|
|
36
|
+
sharedContextOptions?: SharedContextOptions;
|
|
37
|
+
/** Compatible with LightningChart-style options (such as license); ignored. */
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
32
40
|
/** Create a CRYChart context that owns its chart instances. */
|
|
33
|
-
export declare function cryChart(
|
|
41
|
+
export declare function cryChart(options?: CryChartOptions): {
|
|
34
42
|
ChartXY: (o?: ChartOptions) => ChartXY;
|
|
35
43
|
Chart3D: (o?: ChartOptions) => Chart3D;
|
|
36
44
|
Polar: (o?: ChartOptions) => Polar;
|
|
@@ -50,10 +58,13 @@ export declare function cryChart(_options?: Record<string, unknown>): {
|
|
|
50
58
|
isDisposed: () => boolean;
|
|
51
59
|
/** Live charts owned by this context; disposed charts are released immediately. */
|
|
52
60
|
getChartCount: () => number;
|
|
61
|
+
/** Shared WebGL2 context used by this context; undefined when not enabled. */
|
|
62
|
+
getSharedContext: () => SharedWebGLContext | undefined;
|
|
53
63
|
};
|
|
54
|
-
export declare const version = "1.0.
|
|
64
|
+
export declare const version = "1.0.7";
|
|
55
65
|
export declare class Dashboard {
|
|
56
66
|
readonly root: HTMLDivElement;
|
|
67
|
+
private readonly sharedContext?;
|
|
57
68
|
private cells;
|
|
58
69
|
private children;
|
|
59
70
|
private events;
|
package/dist/types/mesh3d.d.ts
CHANGED
|
@@ -115,6 +115,7 @@ export declare class MeshSeries3D extends Series3DBase {
|
|
|
115
115
|
protected dirty: DirtyRange[];
|
|
116
116
|
protected styleDirty: boolean;
|
|
117
117
|
private compiled?;
|
|
118
|
+
private wireTopology?;
|
|
118
119
|
private boundsCache?;
|
|
119
120
|
setGeometry(input: MeshGeometry3D): this;
|
|
120
121
|
setData(input: MeshGeometry3D | readonly MeshVertex3D[]): this;
|
|
@@ -79,6 +79,7 @@ export declare class DataRendererHeatmap {
|
|
|
79
79
|
readonly canvas: HTMLCanvasElement;
|
|
80
80
|
readonly options: {
|
|
81
81
|
clipPolicy?: GpuClipPolicy;
|
|
82
|
+
contextEvents?: EventTarget;
|
|
82
83
|
};
|
|
83
84
|
readonly stats: {
|
|
84
85
|
frames: number;
|
|
@@ -102,6 +103,7 @@ export declare class DataRendererHeatmap {
|
|
|
102
103
|
private disposed;
|
|
103
104
|
constructor(gl: WebGL2RenderingContext, canvas: HTMLCanvasElement, options?: {
|
|
104
105
|
clipPolicy?: GpuClipPolicy;
|
|
106
|
+
contextEvents?: EventTarget;
|
|
105
107
|
});
|
|
106
108
|
/** Undefined until data has reached the current, live WebGL context. */
|
|
107
109
|
getUploadedRevision(id: number): number | undefined;
|
package/dist/types/render.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DrawPacket, Rect } from "./contracts.js";
|
|
2
2
|
import { type GpuClipPolicy, type RasterTarget } from './raster-clip.js';
|
|
3
|
+
import { type SharedWebGLContext } from './shared-webgl-context.js';
|
|
3
4
|
export declare class DataRenderer {
|
|
4
5
|
readonly canvas: HTMLCanvasElement;
|
|
5
6
|
readonly backend: "webgl2" | "canvas2d";
|
|
@@ -30,6 +31,8 @@ export declare class DataRenderer {
|
|
|
30
31
|
private lost;
|
|
31
32
|
private iconPipeline?;
|
|
32
33
|
private readonly iconTextures;
|
|
34
|
+
readonly sharedContext?: SharedWebGLContext;
|
|
35
|
+
readonly contextEvents: EventTarget;
|
|
33
36
|
readonly stats: {
|
|
34
37
|
frames: number;
|
|
35
38
|
uploads: number;
|
|
@@ -46,6 +49,7 @@ export declare class DataRenderer {
|
|
|
46
49
|
lineCoverageStateScope?: 'draw' | 'frame';
|
|
47
50
|
ownedCoverageFrame?: boolean;
|
|
48
51
|
gpuClipPolicy?: GpuClipPolicy;
|
|
52
|
+
sharedContext?: SharedWebGLContext;
|
|
49
53
|
});
|
|
50
54
|
private onLost;
|
|
51
55
|
private clearIcons;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export interface SharedContextOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Optional externally owned canvas used to host the shared WebGL2 context.
|
|
4
|
+
* Must be a dedicated canvas not currently bound to another active SharedWebGLContext.
|
|
5
|
+
* When omitted, an offscreen detached canvas is created via document.createElement('canvas').
|
|
6
|
+
* Reusing an external canvas after dispose() retains the browser's existing WebGL2 context
|
|
7
|
+
* attributes; changing antialias requires passing a fresh canvas.
|
|
8
|
+
*/
|
|
9
|
+
canvas?: HTMLCanvasElement;
|
|
10
|
+
/** Whether the shared WebGL2 context enables MSAA. Defaults to false (matching ChartXY). */
|
|
11
|
+
antialias?: boolean;
|
|
12
|
+
/** Pause scheduled redraws for charts outside the viewport. Defaults to true (implemented in WP5). */
|
|
13
|
+
cullOffscreen?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface SharedWebGLContextStats {
|
|
16
|
+
available: boolean;
|
|
17
|
+
disposed: boolean;
|
|
18
|
+
registeredCharts: number;
|
|
19
|
+
offscreenCharts: number;
|
|
20
|
+
backingWidth: number;
|
|
21
|
+
backingHeight: number;
|
|
22
|
+
chartDraws: number;
|
|
23
|
+
blits: number;
|
|
24
|
+
backingResizes: number;
|
|
25
|
+
contextLosses: number;
|
|
26
|
+
contextRestores: number;
|
|
27
|
+
}
|
|
28
|
+
/** @internal Used by chart.ts and render.ts; must not be re-exported from src/index.ts. */
|
|
29
|
+
export interface SharedChartClient {
|
|
30
|
+
readonly root: HTMLElement;
|
|
31
|
+
setOffscreen?(offscreen: boolean): void;
|
|
32
|
+
}
|
|
33
|
+
/** @internal Resolve the private core for a SharedWebGLContext; must not be re-exported from src/index.ts. */
|
|
34
|
+
export declare function sharedContextCore(context: SharedWebGLContext): SharedContextCore;
|
|
35
|
+
/** @internal Private backing implementation for SharedWebGLContext. */
|
|
36
|
+
export declare class SharedContextCore {
|
|
37
|
+
readonly canvas: HTMLCanvasElement | undefined;
|
|
38
|
+
readonly cullOffscreen: boolean;
|
|
39
|
+
private readonly antialias;
|
|
40
|
+
private readonly ownsCanvas;
|
|
41
|
+
private readonly clients;
|
|
42
|
+
private observer?;
|
|
43
|
+
private readonly observedRoots;
|
|
44
|
+
private readonly offscreenClients;
|
|
45
|
+
private gl;
|
|
46
|
+
private attempted;
|
|
47
|
+
private disposed;
|
|
48
|
+
private maxVertexAttribs;
|
|
49
|
+
private pendingPresent?;
|
|
50
|
+
private chartDraws;
|
|
51
|
+
private blits;
|
|
52
|
+
private backingResizes;
|
|
53
|
+
private contextLosses;
|
|
54
|
+
private contextRestores;
|
|
55
|
+
private readonly onLost;
|
|
56
|
+
private readonly onRestore;
|
|
57
|
+
constructor(options: SharedContextOptions | undefined);
|
|
58
|
+
acquire(): WebGL2RenderingContext | null;
|
|
59
|
+
isAvailable(): boolean;
|
|
60
|
+
isDisposed(): boolean;
|
|
61
|
+
getChartCount(): number;
|
|
62
|
+
getStats(): SharedWebGLContextStats;
|
|
63
|
+
register(client: SharedChartClient): void;
|
|
64
|
+
unregister(client: SharedChartClient): void;
|
|
65
|
+
beginChartDraw(pixelWidth: number, pixelHeight: number): boolean;
|
|
66
|
+
present(target: CanvasRenderingContext2D | null, pixelWidth: number, pixelHeight: number): void;
|
|
67
|
+
dispose(): void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Coordinates a single shared WebGL2 rendering context across multiple 2D charts.
|
|
71
|
+
* Always dispose charts registered to this context before calling dispose() on the context itself.
|
|
72
|
+
*/
|
|
73
|
+
export declare class SharedWebGLContext {
|
|
74
|
+
constructor(options?: SharedContextOptions);
|
|
75
|
+
/** Lazily acquires the shared WebGL2 context on first call and caches the result without retrying. */
|
|
76
|
+
isAvailable(): boolean;
|
|
77
|
+
isDisposed(): boolean;
|
|
78
|
+
/** Number of charts currently registered with this shared context. */
|
|
79
|
+
getChartCount(): number;
|
|
80
|
+
getStats(): SharedWebGLContextStats;
|
|
81
|
+
/** Idempotently disposes the shared context. Dispose all registered charts first. */
|
|
82
|
+
dispose(): void;
|
|
83
|
+
}
|
package/docs/npm-usage.md
CHANGED