chartgpu-angular 21.0.0 → 22.0.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/fesm2022/chartgpu-angular.mjs +653 -404
- package/fesm2022/chartgpu-angular.mjs.map +1 -1
- package/package.json +3 -3
- package/types/chartgpu-angular.d.ts +247 -202
|
@@ -1,260 +1,324 @@
|
|
|
1
|
-
import { NgStyle } from
|
|
2
|
-
import * as i0 from
|
|
3
|
-
import {
|
|
4
|
-
import { ChartGPU, connectCharts, createPipelineCache } from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
1
|
+
import { NgStyle } from "@angular/common";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { ChangeDetectionStrategy, Component, Directive, Injectable, afterNextRender, computed, effect, input, makeEnvironmentProviders, output, signal, untracked, viewChild } from "@angular/core";
|
|
4
|
+
import { ChartGPU, connectCharts, createPipelineCache } from "chartgpu";
|
|
5
|
+
var ChartGpuAngularComponent = class ChartGpuAngularComponent {
|
|
6
|
+
destroyRef;
|
|
7
|
+
options = input.required(...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
|
|
8
|
+
gpuContext = input(null, ...ngDevMode ? [{ debugName: "gpuContext" }] : /* istanbul ignore next */ []);
|
|
9
|
+
theme = input(void 0, ...ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []);
|
|
10
|
+
className = input(...ngDevMode ? [void 0, { debugName: "className" }] : /* istanbul ignore next */ []);
|
|
11
|
+
style = input(...ngDevMode ? [void 0, { debugName: "style" }] : /* istanbul ignore next */ []);
|
|
12
|
+
ready = output();
|
|
13
|
+
chartReady = output();
|
|
14
|
+
chartDispose = output();
|
|
15
|
+
resize = output();
|
|
16
|
+
click = output();
|
|
17
|
+
chartClick = output();
|
|
18
|
+
mouseOver = output();
|
|
19
|
+
mouseOut = output();
|
|
20
|
+
crosshairMove = output();
|
|
21
|
+
dataAppend = output();
|
|
22
|
+
zoomChange = output();
|
|
23
|
+
zoomRangeChange = output();
|
|
24
|
+
deviceLost = output();
|
|
25
|
+
chartError = output();
|
|
26
|
+
host = viewChild("host", ...ngDevMode ? [{ debugName: "host" }] : /* istanbul ignore next */ []);
|
|
27
|
+
canvasHost = viewChild("canvasHost", ...ngDevMode ? [{ debugName: "canvasHost" }] : /* istanbul ignore next */ []);
|
|
28
|
+
chartInstance = signal(null, ...ngDevMode ? [{ debugName: "chartInstance" }] : /* istanbul ignore next */ []);
|
|
29
|
+
initializationError = signal(null, ...ngDevMode ? [{ debugName: "initializationError" }] : /* istanbul ignore next */ []);
|
|
30
|
+
chartContainer;
|
|
31
|
+
createdWithOptions;
|
|
32
|
+
resizeTimeout;
|
|
33
|
+
resizeObserver;
|
|
34
|
+
removeChartListeners;
|
|
35
|
+
destroying = false;
|
|
36
|
+
constructor(destroyRef) {
|
|
37
|
+
this.destroyRef = destroyRef;
|
|
38
|
+
this.destroyRef.onDestroy(() => {
|
|
39
|
+
this.resizeObserver?.disconnect();
|
|
40
|
+
if (this.resizeTimeout !== void 0) clearTimeout(this.resizeTimeout);
|
|
41
|
+
this.disposeChart();
|
|
42
|
+
});
|
|
43
|
+
afterNextRender(() => {
|
|
44
|
+
const container = this.host()?.nativeElement;
|
|
45
|
+
if (container) this.observeResize(container);
|
|
46
|
+
});
|
|
47
|
+
effect((onCleanup) => {
|
|
48
|
+
const container = this.canvasHost()?.nativeElement;
|
|
49
|
+
const options = this.options();
|
|
50
|
+
const gpuContext = this.gpuContext();
|
|
51
|
+
const theme = this.theme();
|
|
52
|
+
this.initializationError.set(null);
|
|
53
|
+
if (!container) {
|
|
54
|
+
this.disposeChart();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (typeof navigator === "undefined" || !("gpu" in navigator)) {
|
|
58
|
+
this.reportError(/* @__PURE__ */ new Error("WebGPU not supported in this browser"));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (untracked(() => this.chartInstance()) && this.chartContainer === container) return;
|
|
62
|
+
let cancelled = false;
|
|
63
|
+
let createdInstance;
|
|
64
|
+
const initialOptions = this.getEffectiveOptions(options, theme);
|
|
65
|
+
(gpuContext ? ChartGPU.create(container, initialOptions, gpuContext) : ChartGPU.create(container, initialOptions)).then((instance) => {
|
|
66
|
+
createdInstance = instance;
|
|
67
|
+
if (cancelled) {
|
|
68
|
+
instance.dispose();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
try {
|
|
72
|
+
const latest = untracked(() => ({
|
|
73
|
+
options: this.options(),
|
|
74
|
+
theme: this.theme()
|
|
75
|
+
}));
|
|
76
|
+
if (latest.options !== options || latest.theme !== theme) instance.setOption(this.getEffectiveOptions(latest.options, latest.theme));
|
|
77
|
+
this.createdWithOptions = latest;
|
|
78
|
+
this.chartContainer = container;
|
|
79
|
+
this.chartInstance.set(instance);
|
|
80
|
+
this.removeChartListeners = this.listenToChart(instance);
|
|
81
|
+
this.ready.emit({ container });
|
|
82
|
+
this.chartReady.emit(instance);
|
|
83
|
+
const range = instance.getZoomRange();
|
|
84
|
+
if (range) this.emitZoomRange(range);
|
|
85
|
+
} catch (cause) {
|
|
86
|
+
instance.dispose();
|
|
87
|
+
throw cause;
|
|
88
|
+
}
|
|
89
|
+
}).catch((cause) => {
|
|
90
|
+
if (cancelled) return;
|
|
91
|
+
if (createdInstance && this.chartInstance() !== createdInstance && !createdInstance.disposed) createdInstance.dispose();
|
|
92
|
+
this.reportError(cause);
|
|
93
|
+
});
|
|
94
|
+
onCleanup(() => {
|
|
95
|
+
cancelled = true;
|
|
96
|
+
if (this.chartContainer === container) this.disposeChart();
|
|
97
|
+
});
|
|
98
|
+
}, { allowSignalWrites: true });
|
|
99
|
+
effect(() => {
|
|
100
|
+
const options = this.options();
|
|
101
|
+
const theme = this.theme();
|
|
102
|
+
const instance = this.chartInstance();
|
|
103
|
+
if (!instance || instance.disposed) return;
|
|
104
|
+
if (this.createdWithOptions?.options === options && this.createdWithOptions.theme === theme) {
|
|
105
|
+
this.createdWithOptions = void 0;
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
instance.setOption(this.getEffectiveOptions(options, theme));
|
|
110
|
+
} catch (cause) {
|
|
111
|
+
this.reportError(cause);
|
|
112
|
+
}
|
|
113
|
+
}, { allowSignalWrites: true });
|
|
114
|
+
}
|
|
115
|
+
emitClick(event) {
|
|
116
|
+
this.click.emit({
|
|
117
|
+
x: event.offsetX,
|
|
118
|
+
y: event.offsetY
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
ngOnDestroy() {
|
|
122
|
+
this.destroying = true;
|
|
123
|
+
}
|
|
124
|
+
getChart() {
|
|
125
|
+
const instance = this.chartInstance();
|
|
126
|
+
return instance && !instance.disposed ? instance : null;
|
|
127
|
+
}
|
|
128
|
+
getContainer() {
|
|
129
|
+
return this.canvasHost()?.nativeElement ?? null;
|
|
130
|
+
}
|
|
131
|
+
appendData(seriesIndex, newPoints, options) {
|
|
132
|
+
this.getChart()?.appendData(seriesIndex, newPoints, options);
|
|
133
|
+
}
|
|
134
|
+
renderFrame() {
|
|
135
|
+
return this.getChart()?.renderFrame() ?? false;
|
|
136
|
+
}
|
|
137
|
+
needsRender() {
|
|
138
|
+
return this.getChart()?.needsRender() ?? false;
|
|
139
|
+
}
|
|
140
|
+
getRenderMode() {
|
|
141
|
+
return this.getChart()?.getRenderMode() ?? "auto";
|
|
142
|
+
}
|
|
143
|
+
setRenderMode(mode) {
|
|
144
|
+
this.getChart()?.setRenderMode(mode);
|
|
145
|
+
}
|
|
146
|
+
setOption(options) {
|
|
147
|
+
this.getChart()?.setOption(options);
|
|
148
|
+
}
|
|
149
|
+
setZoomRange(start, end, source) {
|
|
150
|
+
this.getChart()?.setZoomRange(start, end, source);
|
|
151
|
+
}
|
|
152
|
+
setInteractionX(x, source) {
|
|
153
|
+
this.getChart()?.setInteractionX(x, source);
|
|
154
|
+
}
|
|
155
|
+
getInteractionX() {
|
|
156
|
+
return this.getChart()?.getInteractionX() ?? null;
|
|
157
|
+
}
|
|
158
|
+
hitTest(event) {
|
|
159
|
+
return this.getChart()?.hitTest(event) ?? null;
|
|
160
|
+
}
|
|
161
|
+
getEffectiveOptions(options, theme) {
|
|
162
|
+
return theme !== void 0 ? {
|
|
163
|
+
...options,
|
|
164
|
+
theme
|
|
165
|
+
} : options;
|
|
166
|
+
}
|
|
167
|
+
listenToChart(instance) {
|
|
168
|
+
const click = (payload) => this.chartClick.emit(payload);
|
|
169
|
+
const mouseOver = (payload) => this.mouseOver.emit(payload);
|
|
170
|
+
const mouseOut = (payload) => this.mouseOut.emit(payload);
|
|
171
|
+
const crosshairMove = (payload) => this.crosshairMove.emit(payload);
|
|
172
|
+
const dataAppend = (payload) => this.dataAppend.emit(payload);
|
|
173
|
+
const zoomChange = (payload) => this.emitZoomRange(payload);
|
|
174
|
+
const deviceLost = (payload) => this.deviceLost.emit(payload);
|
|
175
|
+
instance.on("click", click);
|
|
176
|
+
instance.on("mouseover", mouseOver);
|
|
177
|
+
instance.on("mouseout", mouseOut);
|
|
178
|
+
instance.on("crosshairMove", crosshairMove);
|
|
179
|
+
instance.on("dataAppend", dataAppend);
|
|
180
|
+
instance.on("zoomRangeChange", zoomChange);
|
|
181
|
+
instance.on("deviceLost", deviceLost);
|
|
182
|
+
return () => {
|
|
183
|
+
if (instance.disposed) return;
|
|
184
|
+
instance.off("click", click);
|
|
185
|
+
instance.off("mouseover", mouseOver);
|
|
186
|
+
instance.off("mouseout", mouseOut);
|
|
187
|
+
instance.off("crosshairMove", crosshairMove);
|
|
188
|
+
instance.off("dataAppend", dataAppend);
|
|
189
|
+
instance.off("zoomRangeChange", zoomChange);
|
|
190
|
+
instance.off("deviceLost", deviceLost);
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
emitZoomRange(range) {
|
|
194
|
+
this.zoomChange.emit({ range: {
|
|
195
|
+
start: range.start,
|
|
196
|
+
end: range.end
|
|
197
|
+
} });
|
|
198
|
+
this.zoomRangeChange.emit({
|
|
199
|
+
start: range.start,
|
|
200
|
+
end: range.end
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
observeResize(container) {
|
|
204
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
205
|
+
this.resizeObserver = new ResizeObserver((entries) => {
|
|
206
|
+
const entry = entries[0];
|
|
207
|
+
if (!entry) return;
|
|
208
|
+
const { width, height } = entry.contentRect;
|
|
209
|
+
this.resize.emit({
|
|
210
|
+
width,
|
|
211
|
+
height,
|
|
212
|
+
container
|
|
213
|
+
});
|
|
214
|
+
if (this.resizeTimeout !== void 0) clearTimeout(this.resizeTimeout);
|
|
215
|
+
this.resizeTimeout = setTimeout(() => {
|
|
216
|
+
this.chartInstance()?.resize();
|
|
217
|
+
this.resizeTimeout = void 0;
|
|
218
|
+
}, 100);
|
|
219
|
+
});
|
|
220
|
+
this.resizeObserver.observe(container);
|
|
221
|
+
}
|
|
222
|
+
reportError(cause) {
|
|
223
|
+
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
224
|
+
this.initializationError.set(error);
|
|
225
|
+
this.chartError.emit(error);
|
|
226
|
+
}
|
|
227
|
+
disposeChart() {
|
|
228
|
+
const instance = this.chartInstance();
|
|
229
|
+
this.removeChartListeners?.();
|
|
230
|
+
this.removeChartListeners = void 0;
|
|
231
|
+
if (instance && !instance.disposed) {
|
|
232
|
+
instance.dispose();
|
|
233
|
+
if (!this.destroying) this.chartDispose.emit();
|
|
234
|
+
}
|
|
235
|
+
this.chartInstance.set(null);
|
|
236
|
+
this.chartContainer = void 0;
|
|
237
|
+
this.createdWithOptions = void 0;
|
|
238
|
+
}
|
|
239
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
240
|
+
minVersion: "12.0.0",
|
|
241
|
+
version: "22.2.3",
|
|
242
|
+
ngImport: i0,
|
|
243
|
+
type: ChartGpuAngularComponent,
|
|
244
|
+
deps: [{ token: i0.DestroyRef }],
|
|
245
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
246
|
+
});
|
|
247
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
248
|
+
minVersion: "17.0.0",
|
|
249
|
+
version: "22.2.3",
|
|
250
|
+
type: ChartGpuAngularComponent,
|
|
251
|
+
isStandalone: true,
|
|
252
|
+
selector: "lib-chartgpu-angular",
|
|
253
|
+
inputs: {
|
|
254
|
+
options: {
|
|
255
|
+
classPropertyName: "options",
|
|
256
|
+
publicName: "options",
|
|
257
|
+
isSignal: true,
|
|
258
|
+
isRequired: true,
|
|
259
|
+
transformFunction: null
|
|
260
|
+
},
|
|
261
|
+
gpuContext: {
|
|
262
|
+
classPropertyName: "gpuContext",
|
|
263
|
+
publicName: "gpuContext",
|
|
264
|
+
isSignal: true,
|
|
265
|
+
isRequired: false,
|
|
266
|
+
transformFunction: null
|
|
267
|
+
},
|
|
268
|
+
theme: {
|
|
269
|
+
classPropertyName: "theme",
|
|
270
|
+
publicName: "theme",
|
|
271
|
+
isSignal: true,
|
|
272
|
+
isRequired: false,
|
|
273
|
+
transformFunction: null
|
|
274
|
+
},
|
|
275
|
+
className: {
|
|
276
|
+
classPropertyName: "className",
|
|
277
|
+
publicName: "className",
|
|
278
|
+
isSignal: true,
|
|
279
|
+
isRequired: false,
|
|
280
|
+
transformFunction: null
|
|
281
|
+
},
|
|
282
|
+
style: {
|
|
283
|
+
classPropertyName: "style",
|
|
284
|
+
publicName: "style",
|
|
285
|
+
isSignal: true,
|
|
286
|
+
isRequired: false,
|
|
287
|
+
transformFunction: null
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
outputs: {
|
|
291
|
+
ready: "ready",
|
|
292
|
+
chartReady: "chartReady",
|
|
293
|
+
chartDispose: "chartDispose",
|
|
294
|
+
resize: "resize",
|
|
295
|
+
click: "click",
|
|
296
|
+
chartClick: "chartClick",
|
|
297
|
+
mouseOver: "mouseOver",
|
|
298
|
+
mouseOut: "mouseOut",
|
|
299
|
+
crosshairMove: "crosshairMove",
|
|
300
|
+
dataAppend: "dataAppend",
|
|
301
|
+
zoomChange: "zoomChange",
|
|
302
|
+
zoomRangeChange: "zoomRangeChange",
|
|
303
|
+
deviceLost: "deviceLost",
|
|
304
|
+
chartError: "chartError"
|
|
305
|
+
},
|
|
306
|
+
host: { classAttribute: "chartgpu-angular" },
|
|
307
|
+
viewQueries: [{
|
|
308
|
+
propertyName: "host",
|
|
309
|
+
first: true,
|
|
310
|
+
predicate: ["host"],
|
|
311
|
+
descendants: true,
|
|
312
|
+
isSignal: true
|
|
313
|
+
}, {
|
|
314
|
+
propertyName: "canvasHost",
|
|
315
|
+
first: true,
|
|
316
|
+
predicate: ["canvasHost"],
|
|
317
|
+
descendants: true,
|
|
318
|
+
isSignal: true
|
|
319
|
+
}],
|
|
320
|
+
ngImport: i0,
|
|
321
|
+
template: `
|
|
258
322
|
<div
|
|
259
323
|
#host
|
|
260
324
|
class="chartgpu-host"
|
|
@@ -267,11 +331,32 @@ class ChartGpuAngularComponent {
|
|
|
267
331
|
<div class="chartgpu-error" role="alert">{{ error.message }}</div>
|
|
268
332
|
}
|
|
269
333
|
</div>
|
|
270
|
-
`,
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
334
|
+
`,
|
|
335
|
+
isInline: true,
|
|
336
|
+
styles: [":host{display:block;width:100%;height:100%}.chartgpu-host{position:relative;width:100%;height:100%}.chartgpu-canvas-host{position:absolute;inset:0}.chartgpu-error{position:absolute;inset:0;display:grid;place-items:center;padding:1rem;text-align:center}\n"],
|
|
337
|
+
dependencies: [{
|
|
338
|
+
kind: "directive",
|
|
339
|
+
type: NgStyle,
|
|
340
|
+
selector: "[ngStyle]",
|
|
341
|
+
inputs: ["ngStyle"]
|
|
342
|
+
}],
|
|
343
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
344
|
+
});
|
|
345
|
+
};
|
|
346
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
347
|
+
minVersion: "12.0.0",
|
|
348
|
+
version: "22.2.3",
|
|
349
|
+
ngImport: i0,
|
|
350
|
+
type: ChartGpuAngularComponent,
|
|
351
|
+
decorators: [{
|
|
352
|
+
type: Component,
|
|
353
|
+
args: [{
|
|
354
|
+
selector: "lib-chartgpu-angular",
|
|
355
|
+
standalone: true,
|
|
356
|
+
imports: [NgStyle],
|
|
357
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
358
|
+
host: { class: "chartgpu-angular" },
|
|
359
|
+
template: `
|
|
275
360
|
<div
|
|
276
361
|
#host
|
|
277
362
|
class="chartgpu-host"
|
|
@@ -284,150 +369,314 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
284
369
|
<div class="chartgpu-error" role="alert">{{ error.message }}</div>
|
|
285
370
|
}
|
|
286
371
|
</div>
|
|
287
|
-
`,
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
372
|
+
`,
|
|
373
|
+
styles: [":host{display:block;width:100%;height:100%}.chartgpu-host{position:relative;width:100%;height:100%}.chartgpu-canvas-host{position:absolute;inset:0}.chartgpu-error{position:absolute;inset:0;display:grid;place-items:center;padding:1rem;text-align:center}\n"]
|
|
374
|
+
}]
|
|
375
|
+
}],
|
|
376
|
+
ctorParameters: () => [{ type: i0.DestroyRef }],
|
|
377
|
+
propDecorators: {
|
|
378
|
+
options: [{
|
|
379
|
+
type: i0.Input,
|
|
380
|
+
args: [{
|
|
381
|
+
isSignal: true,
|
|
382
|
+
alias: "options",
|
|
383
|
+
required: true
|
|
384
|
+
}]
|
|
385
|
+
}],
|
|
386
|
+
gpuContext: [{
|
|
387
|
+
type: i0.Input,
|
|
388
|
+
args: [{
|
|
389
|
+
isSignal: true,
|
|
390
|
+
alias: "gpuContext",
|
|
391
|
+
required: false
|
|
392
|
+
}]
|
|
393
|
+
}],
|
|
394
|
+
theme: [{
|
|
395
|
+
type: i0.Input,
|
|
396
|
+
args: [{
|
|
397
|
+
isSignal: true,
|
|
398
|
+
alias: "theme",
|
|
399
|
+
required: false
|
|
400
|
+
}]
|
|
401
|
+
}],
|
|
402
|
+
className: [{
|
|
403
|
+
type: i0.Input,
|
|
404
|
+
args: [{
|
|
405
|
+
isSignal: true,
|
|
406
|
+
alias: "className",
|
|
407
|
+
required: false
|
|
408
|
+
}]
|
|
409
|
+
}],
|
|
410
|
+
style: [{
|
|
411
|
+
type: i0.Input,
|
|
412
|
+
args: [{
|
|
413
|
+
isSignal: true,
|
|
414
|
+
alias: "style",
|
|
415
|
+
required: false
|
|
416
|
+
}]
|
|
417
|
+
}],
|
|
418
|
+
ready: [{
|
|
419
|
+
type: i0.Output,
|
|
420
|
+
args: ["ready"]
|
|
421
|
+
}],
|
|
422
|
+
chartReady: [{
|
|
423
|
+
type: i0.Output,
|
|
424
|
+
args: ["chartReady"]
|
|
425
|
+
}],
|
|
426
|
+
chartDispose: [{
|
|
427
|
+
type: i0.Output,
|
|
428
|
+
args: ["chartDispose"]
|
|
429
|
+
}],
|
|
430
|
+
resize: [{
|
|
431
|
+
type: i0.Output,
|
|
432
|
+
args: ["resize"]
|
|
433
|
+
}],
|
|
434
|
+
click: [{
|
|
435
|
+
type: i0.Output,
|
|
436
|
+
args: ["click"]
|
|
437
|
+
}],
|
|
438
|
+
chartClick: [{
|
|
439
|
+
type: i0.Output,
|
|
440
|
+
args: ["chartClick"]
|
|
441
|
+
}],
|
|
442
|
+
mouseOver: [{
|
|
443
|
+
type: i0.Output,
|
|
444
|
+
args: ["mouseOver"]
|
|
445
|
+
}],
|
|
446
|
+
mouseOut: [{
|
|
447
|
+
type: i0.Output,
|
|
448
|
+
args: ["mouseOut"]
|
|
449
|
+
}],
|
|
450
|
+
crosshairMove: [{
|
|
451
|
+
type: i0.Output,
|
|
452
|
+
args: ["crosshairMove"]
|
|
453
|
+
}],
|
|
454
|
+
dataAppend: [{
|
|
455
|
+
type: i0.Output,
|
|
456
|
+
args: ["dataAppend"]
|
|
457
|
+
}],
|
|
458
|
+
zoomChange: [{
|
|
459
|
+
type: i0.Output,
|
|
460
|
+
args: ["zoomChange"]
|
|
461
|
+
}],
|
|
462
|
+
zoomRangeChange: [{
|
|
463
|
+
type: i0.Output,
|
|
464
|
+
args: ["zoomRangeChange"]
|
|
465
|
+
}],
|
|
466
|
+
deviceLost: [{
|
|
467
|
+
type: i0.Output,
|
|
468
|
+
args: ["deviceLost"]
|
|
469
|
+
}],
|
|
470
|
+
chartError: [{
|
|
471
|
+
type: i0.Output,
|
|
472
|
+
args: ["chartError"]
|
|
473
|
+
}],
|
|
474
|
+
host: [{
|
|
475
|
+
type: i0.ViewChild,
|
|
476
|
+
args: ["host", { isSignal: true }]
|
|
477
|
+
}],
|
|
478
|
+
canvasHost: [{
|
|
479
|
+
type: i0.ViewChild,
|
|
480
|
+
args: ["canvasHost", { isSignal: true }]
|
|
481
|
+
}]
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
var ChartgpuConnectChartsDirective = class ChartgpuConnectChartsDirective {
|
|
485
|
+
charts = input([], {
|
|
486
|
+
...ngDevMode ? { debugName: "charts" } : /* istanbul ignore next */ {},
|
|
487
|
+
alias: "libChartgpuConnectCharts"
|
|
488
|
+
});
|
|
489
|
+
syncOptions = input(...ngDevMode ? [void 0, { debugName: "syncOptions" }] : /* istanbul ignore next */ []);
|
|
490
|
+
connectionError = output();
|
|
491
|
+
ids = /* @__PURE__ */ new WeakMap();
|
|
492
|
+
nextId = 1;
|
|
493
|
+
signature;
|
|
494
|
+
constructor() {
|
|
495
|
+
effect((onCleanup) => {
|
|
496
|
+
const charts = this.charts();
|
|
497
|
+
const options = this.syncOptions();
|
|
498
|
+
const optionsSignature = options ? `crosshair=${options.syncCrosshair ?? ""},zoom=${options.syncZoom ?? ""}` : "";
|
|
499
|
+
const signature = `${charts.map((chart) => {
|
|
500
|
+
if (!chart) return "null";
|
|
501
|
+
let id = this.ids.get(chart);
|
|
502
|
+
if (id === void 0) {
|
|
503
|
+
id = this.nextId++;
|
|
504
|
+
this.ids.set(chart, id);
|
|
505
|
+
}
|
|
506
|
+
return `${id}:${chart.disposed ? 1 : 0}`;
|
|
507
|
+
}).join("|")}|${optionsSignature}`;
|
|
508
|
+
if (signature === this.signature) return;
|
|
509
|
+
this.signature = signature;
|
|
510
|
+
if (charts.length === 0 || charts.some((chart) => !chart || chart.disposed)) return;
|
|
511
|
+
const resolved = [];
|
|
512
|
+
for (const chart of charts) {
|
|
513
|
+
if (!chart || chart.disposed) return;
|
|
514
|
+
resolved.push(chart);
|
|
515
|
+
}
|
|
516
|
+
try {
|
|
517
|
+
onCleanup(connectCharts(resolved, options));
|
|
518
|
+
} catch (cause) {
|
|
519
|
+
this.connectionError.emit(cause instanceof Error ? cause : new Error(String(cause)));
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
524
|
+
minVersion: "12.0.0",
|
|
525
|
+
version: "22.2.3",
|
|
526
|
+
ngImport: i0,
|
|
527
|
+
type: ChartgpuConnectChartsDirective,
|
|
528
|
+
deps: [],
|
|
529
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
530
|
+
});
|
|
531
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
532
|
+
minVersion: "17.1.0",
|
|
533
|
+
version: "22.2.3",
|
|
534
|
+
type: ChartgpuConnectChartsDirective,
|
|
535
|
+
isStandalone: true,
|
|
536
|
+
selector: "[libChartgpuConnectCharts]",
|
|
537
|
+
inputs: {
|
|
538
|
+
charts: {
|
|
539
|
+
classPropertyName: "charts",
|
|
540
|
+
publicName: "libChartgpuConnectCharts",
|
|
541
|
+
isSignal: true,
|
|
542
|
+
isRequired: false,
|
|
543
|
+
transformFunction: null
|
|
544
|
+
},
|
|
545
|
+
syncOptions: {
|
|
546
|
+
classPropertyName: "syncOptions",
|
|
547
|
+
publicName: "syncOptions",
|
|
548
|
+
isSignal: true,
|
|
549
|
+
isRequired: false,
|
|
550
|
+
transformFunction: null
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
outputs: { connectionError: "connectionError" },
|
|
554
|
+
ngImport: i0
|
|
555
|
+
});
|
|
556
|
+
};
|
|
557
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
558
|
+
minVersion: "12.0.0",
|
|
559
|
+
version: "22.2.3",
|
|
560
|
+
ngImport: i0,
|
|
561
|
+
type: ChartgpuConnectChartsDirective,
|
|
562
|
+
decorators: [{
|
|
563
|
+
type: Directive,
|
|
564
|
+
args: [{
|
|
565
|
+
selector: "[libChartgpuConnectCharts]",
|
|
566
|
+
standalone: true
|
|
567
|
+
}]
|
|
568
|
+
}],
|
|
569
|
+
ctorParameters: () => [],
|
|
570
|
+
propDecorators: {
|
|
571
|
+
charts: [{
|
|
572
|
+
type: i0.Input,
|
|
573
|
+
args: [{
|
|
574
|
+
isSignal: true,
|
|
575
|
+
alias: "libChartgpuConnectCharts",
|
|
576
|
+
required: false
|
|
577
|
+
}]
|
|
578
|
+
}],
|
|
579
|
+
syncOptions: [{
|
|
580
|
+
type: i0.Input,
|
|
581
|
+
args: [{
|
|
582
|
+
isSignal: true,
|
|
583
|
+
alias: "syncOptions",
|
|
584
|
+
required: false
|
|
585
|
+
}]
|
|
586
|
+
}],
|
|
587
|
+
connectionError: [{
|
|
588
|
+
type: i0.Output,
|
|
589
|
+
args: ["connectionError"]
|
|
590
|
+
}]
|
|
591
|
+
}
|
|
592
|
+
});
|
|
349
593
|
const INITIAL_STATE = {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
594
|
+
adapter: null,
|
|
595
|
+
device: null,
|
|
596
|
+
pipelineCache: null,
|
|
597
|
+
error: null,
|
|
598
|
+
isReady: false
|
|
355
599
|
};
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
600
|
+
var ChartgpuGPUContextService = class ChartgpuGPUContextService {
|
|
601
|
+
state = signal(INITIAL_STATE, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
602
|
+
context = computed(() => {
|
|
603
|
+
const state = this.state();
|
|
604
|
+
if (!state.adapter || !state.device || !state.pipelineCache) return null;
|
|
605
|
+
return {
|
|
606
|
+
adapter: state.adapter,
|
|
607
|
+
device: state.device,
|
|
608
|
+
pipelineCache: state.pipelineCache
|
|
609
|
+
};
|
|
610
|
+
}, ...ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []);
|
|
611
|
+
initialization;
|
|
612
|
+
initialize() {
|
|
613
|
+
if (!this.initialization) this.initialization = this.createContext();
|
|
614
|
+
return this.initialization;
|
|
615
|
+
}
|
|
616
|
+
async createContext() {
|
|
617
|
+
try {
|
|
618
|
+
if (typeof navigator === "undefined" || !("gpu" in navigator)) throw new Error("WebGPU not supported in this browser");
|
|
619
|
+
const gpu = navigator.gpu;
|
|
620
|
+
if (!gpu) throw new Error("WebGPU not supported in this browser");
|
|
621
|
+
const adapter = await gpu.requestAdapter({ powerPreference: "high-performance" });
|
|
622
|
+
if (!adapter) {
|
|
623
|
+
const error = /* @__PURE__ */ new Error("WebGPU is not available. No compatible GPUAdapter was found.");
|
|
624
|
+
const state = {
|
|
625
|
+
...INITIAL_STATE,
|
|
626
|
+
error
|
|
627
|
+
};
|
|
628
|
+
this.state.set(state);
|
|
629
|
+
return state;
|
|
630
|
+
}
|
|
631
|
+
const device = await adapter.requestDevice();
|
|
632
|
+
const state = {
|
|
633
|
+
adapter,
|
|
634
|
+
device,
|
|
635
|
+
pipelineCache: createPipelineCache(device),
|
|
636
|
+
error: null,
|
|
637
|
+
isReady: true
|
|
638
|
+
};
|
|
639
|
+
this.state.set(state);
|
|
640
|
+
return state;
|
|
641
|
+
} catch (cause) {
|
|
642
|
+
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
643
|
+
const state = {
|
|
644
|
+
...INITIAL_STATE,
|
|
645
|
+
error
|
|
646
|
+
};
|
|
647
|
+
this.state.set(state);
|
|
648
|
+
return state;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
652
|
+
minVersion: "12.0.0",
|
|
653
|
+
version: "22.2.3",
|
|
654
|
+
ngImport: i0,
|
|
655
|
+
type: ChartgpuGPUContextService,
|
|
656
|
+
deps: [],
|
|
657
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
658
|
+
});
|
|
659
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
660
|
+
minVersion: "12.0.0",
|
|
661
|
+
version: "22.2.3",
|
|
662
|
+
ngImport: i0,
|
|
663
|
+
type: ChartgpuGPUContextService,
|
|
664
|
+
providedIn: "root"
|
|
665
|
+
});
|
|
666
|
+
};
|
|
667
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
668
|
+
minVersion: "12.0.0",
|
|
669
|
+
version: "22.2.3",
|
|
670
|
+
ngImport: i0,
|
|
671
|
+
type: ChartgpuGPUContextService,
|
|
672
|
+
decorators: [{
|
|
673
|
+
type: Injectable,
|
|
674
|
+
args: [{ providedIn: "root" }]
|
|
675
|
+
}]
|
|
676
|
+
});
|
|
424
677
|
function provideChartGpuContext() {
|
|
425
|
-
|
|
678
|
+
return makeEnvironmentProviders([ChartgpuGPUContextService]);
|
|
426
679
|
}
|
|
427
|
-
|
|
428
|
-
/**
|
|
429
|
-
* Generated bundle index. Do not edit.
|
|
430
|
-
*/
|
|
431
|
-
|
|
432
680
|
export { ChartGpuAngularComponent, ChartgpuConnectChartsDirective, ChartgpuGPUContextService, provideChartGpuContext };
|
|
433
|
-
|
|
681
|
+
|
|
682
|
+
//# sourceMappingURL=chartgpu-angular.mjs.map
|