@crysound/crychart 0.0.0-stage → 1.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.
Files changed (82) hide show
  1. package/LICENSE.md +288 -0
  2. package/LICENSE.zh-CN.md +290 -0
  3. package/README.md +83 -3
  4. package/README.zh-CN.md +79 -0
  5. package/dist/crychart.cjs +25234 -0
  6. package/dist/crychart.global.js +25236 -0
  7. package/dist/crychart.js +25211 -0
  8. package/dist/themes.js +357 -0
  9. package/dist/types/adapters/opentest.d.ts +69 -0
  10. package/dist/types/annotation-interaction.d.ts +36 -0
  11. package/dist/types/axis-canvas.d.ts +78 -0
  12. package/dist/types/axis-layout.d.ts +10 -0
  13. package/dist/types/axis-scroll-animation.d.ts +16 -0
  14. package/dist/types/axis.d.ts +532 -0
  15. package/dist/types/axis3d-label-layout.d.ts +45 -0
  16. package/dist/types/chart-events.d.ts +89 -0
  17. package/dist/types/chart.d.ts +674 -0
  18. package/dist/types/compatibility-types.d.ts +55 -0
  19. package/dist/types/component-highlight.d.ts +21 -0
  20. package/dist/types/contracts.d.ts +88 -0
  21. package/dist/types/core/data.d.ts +204 -0
  22. package/dist/types/core/events.d.ts +16 -0
  23. package/dist/types/core/line-delta-certificate.d.ts +70 -0
  24. package/dist/types/core/paged-columns.d.ts +180 -0
  25. package/dist/types/core/styles.d.ts +350 -0
  26. package/dist/types/css-text-fonts.d.ts +13 -0
  27. package/dist/types/cursor-api.d.ts +47 -0
  28. package/dist/types/custom-icon.d.ts +46 -0
  29. package/dist/types/data-bounds.d.ts +28 -0
  30. package/dist/types/data-order.d.ts +49 -0
  31. package/dist/types/data-runs.d.ts +15 -0
  32. package/dist/types/date-time-formatting.d.ts +32 -0
  33. package/dist/types/date-time-grid.d.ts +56 -0
  34. package/dist/types/formatting-functions.d.ts +16 -0
  35. package/dist/types/geometry.d.ts +378 -0
  36. package/dist/types/gradients.d.ts +37 -0
  37. package/dist/types/grid-layout.d.ts +10 -0
  38. package/dist/types/heatmap-stream.d.ts +38 -0
  39. package/dist/types/hierarchy.d.ts +191 -0
  40. package/dist/types/index.d.ts +75 -0
  41. package/dist/types/interaction-policy.d.ts +56 -0
  42. package/dist/types/line-block-cache.d.ts +146 -0
  43. package/dist/types/line-coverage-geometry.d.ts +28 -0
  44. package/dist/types/line-display-arena.d.ts +64 -0
  45. package/dist/types/line-display-cache.d.ts +144 -0
  46. package/dist/types/line-display-packets.d.ts +43 -0
  47. package/dist/types/line-extrema-pair-proof.d.ts +23 -0
  48. package/dist/types/line-palette-3d.d.ts +6 -0
  49. package/dist/types/line-selection-ledger.d.ts +143 -0
  50. package/dist/types/map.d.ts +219 -0
  51. package/dist/types/mesh3d.d.ts +306 -0
  52. package/dist/types/native-legend.d.ts +208 -0
  53. package/dist/types/point-fill.d.ts +14 -0
  54. package/dist/types/point-stroke-geometry.d.ts +12 -0
  55. package/dist/types/polar-heatmap.d.ts +68 -0
  56. package/dist/types/polar-layout.d.ts +100 -0
  57. package/dist/types/polar-series.d.ts +79 -0
  58. package/dist/types/raster-clip.d.ts +37 -0
  59. package/dist/types/render-heatmap.d.ts +117 -0
  60. package/dist/types/render-line-coverage.d.ts +95 -0
  61. package/dist/types/render-line-direction.d.ts +27 -0
  62. package/dist/types/render-line-offsets.d.ts +61 -0
  63. package/dist/types/render-line-strip.d.ts +102 -0
  64. package/dist/types/render-line-texture.d.ts +30 -0
  65. package/dist/types/render.d.ts +66 -0
  66. package/dist/types/render3d.d.ts +137 -0
  67. package/dist/types/result-table-layout.d.ts +39 -0
  68. package/dist/types/series-attributes.d.ts +7 -0
  69. package/dist/types/series.d.ts +404 -0
  70. package/dist/types/specialty.d.ts +551 -0
  71. package/dist/types/streaming-line-policy.d.ts +11 -0
  72. package/dist/types/stroke-geometry.d.ts +5 -0
  73. package/dist/types/themes.d.ts +32 -0
  74. package/dist/types/time-formatting.d.ts +23 -0
  75. package/dist/types/time-grid.d.ts +26 -0
  76. package/dist/types/ui.d.ts +207 -0
  77. package/dist/types/viewport.d.ts +18 -0
  78. package/dist/types/world-axis.d.ts +21 -0
  79. package/dist/types/world-camera.d.ts +88 -0
  80. package/dist/types/zoom-clock.d.ts +36 -0
  81. package/docs/npm-usage.md +31 -0
  82. package/package.json +68 -6
package/dist/themes.js ADDED
@@ -0,0 +1,357 @@
1
+ // src/core/styles.ts
2
+ var resolveValue = (value, previous) => typeof value === "function" ? value(previous) : value;
3
+ var SimpleShadingStyle = class {
4
+ type = "simple";
5
+ constructor() {
6
+ Object.freeze(this);
7
+ }
8
+ };
9
+ var ColorShadingStyles = Object.freeze({ Simple: SimpleShadingStyle });
10
+ var clamp = (value, lo = 0, hi = 1) => Math.max(lo, Math.min(hi, Number.isFinite(value) ? value : lo));
11
+ var byte = (value) => Math.round(clamp(value) * 255);
12
+ var Color = class _Color {
13
+ r;
14
+ g;
15
+ b;
16
+ a;
17
+ constructor(r = 0, g = 0, b = 0, a = 1) {
18
+ const p = typeof r === "number" ? { r, g, b, a } : r;
19
+ this.r = clamp(p.r ?? 0);
20
+ this.g = clamp(p.g ?? 0);
21
+ this.b = clamp(p.b ?? 0);
22
+ this.a = clamp(p.a ?? 1);
23
+ Object.freeze(this);
24
+ }
25
+ getR() {
26
+ return this.r * 255;
27
+ }
28
+ getG() {
29
+ return this.g * 255;
30
+ }
31
+ getB() {
32
+ return this.b * 255;
33
+ }
34
+ getA() {
35
+ return this.a * 255;
36
+ }
37
+ setR(value) {
38
+ return new _Color(value / 255, this.g, this.b, this.a);
39
+ }
40
+ setG(value) {
41
+ return new _Color(this.r, value / 255, this.b, this.a);
42
+ }
43
+ setB(value) {
44
+ return new _Color(this.r, this.g, value / 255, this.a);
45
+ }
46
+ setA(value) {
47
+ return new _Color(this.r, this.g, this.b, value / 255);
48
+ }
49
+ toCSS() {
50
+ return `rgba(${byte(this.r)}, ${byte(this.g)}, ${byte(this.b)}, ${this.a})`;
51
+ }
52
+ toRGBAString() {
53
+ return this.toCSS();
54
+ }
55
+ toString() {
56
+ return this.toCSS();
57
+ }
58
+ toUint32() {
59
+ return (byte(this.r) << 24 | byte(this.g) << 16 | byte(this.b) << 8 | byte(this.a)) >>> 0;
60
+ }
61
+ getLighter() {
62
+ return new _Color(this.r + (1 - this.r) * 0.2, this.g + (1 - this.g) * 0.2, this.b + (1 - this.b) * 0.2, this.a);
63
+ }
64
+ getDarker() {
65
+ return new _Color(this.r * 0.8, this.g * 0.8, this.b * 0.8, this.a);
66
+ }
67
+ getHighlight() {
68
+ return this.r * 0.2126 + this.g * 0.7152 + this.b * 0.0722 > 0.5 ? this.getDarker() : this.getLighter();
69
+ }
70
+ };
71
+ function ColorRGBA(r, g, b, a = 255) {
72
+ return new Color(r / 255, g / 255, b / 255, a / 255);
73
+ }
74
+ function ColorHEX(value) {
75
+ let hex = value.trim().replace(/^#/, "");
76
+ if (hex.length === 3 || hex.length === 4) hex = [...hex].map((c) => c + c).join("");
77
+ if (!/^(?:[\da-f]{6}|[\da-f]{8})$/i.test(hex)) throw new TypeError(`Invalid hexadecimal color: ${value}`);
78
+ return ColorRGBA(parseInt(hex.slice(0, 2), 16), parseInt(hex.slice(2, 4), 16), parseInt(hex.slice(4, 6), 16), hex.length === 8 ? parseInt(hex.slice(6, 8), 16) : 255);
79
+ }
80
+ var SolidFill = class _SolidFill {
81
+ kind = "solid";
82
+ color;
83
+ constructor(options = {}) {
84
+ this.color = options.color ?? ColorRGBA(255, 255, 255);
85
+ Object.freeze(this);
86
+ }
87
+ getColor() {
88
+ return this.color;
89
+ }
90
+ setColor(value) {
91
+ return new _SolidFill({ color: resolveValue(value, this.color) });
92
+ }
93
+ setR(value) {
94
+ return this.setColor(this.color.setR(value));
95
+ }
96
+ setG(value) {
97
+ return this.setColor(this.color.setG(value));
98
+ }
99
+ setB(value) {
100
+ return this.setColor(this.color.setB(value));
101
+ }
102
+ setA(value) {
103
+ return this.setColor(this.color.setA(value));
104
+ }
105
+ };
106
+ var EmptyFill = class {
107
+ kind = "empty";
108
+ };
109
+ var emptyFill = Object.freeze(new EmptyFill());
110
+ var transparentFill = new SolidFill({ color: ColorRGBA(255, 255, 255, 0) });
111
+ var SolidLine = class _SolidLine {
112
+ kind = "solid";
113
+ fillStyle;
114
+ thickness;
115
+ constructor(options = {}) {
116
+ this.fillStyle = options.fillStyle ?? new SolidFill();
117
+ this.thickness = options.thickness ?? 1;
118
+ if (new.target === _SolidLine) Object.freeze(this);
119
+ }
120
+ copy(options) {
121
+ return new _SolidLine(options);
122
+ }
123
+ getFillStyle() {
124
+ return this.fillStyle;
125
+ }
126
+ setFillStyle(value) {
127
+ return this.copy({ fillStyle: resolveValue(value, this.fillStyle), thickness: this.thickness });
128
+ }
129
+ getThickness() {
130
+ return this.thickness;
131
+ }
132
+ setThickness(value) {
133
+ return this.copy({ fillStyle: this.fillStyle, thickness: resolveValue(value, this.thickness) });
134
+ }
135
+ };
136
+ var StipplePatterns = Object.freeze({ Dotted: [1, 3], DottedDense: [1, 1], Dashed: [6, 3], DashedEqual: [4, 4], DashedLoose: [6, 6], DashDotted: [6, 3, 1, 3] });
137
+ var emptyLine = new SolidLine({ fillStyle: emptyFill, thickness: 0 });
138
+ var FontSettings = class _FontSettings {
139
+ size;
140
+ family;
141
+ weight;
142
+ style;
143
+ variant;
144
+ constructor(options = {}) {
145
+ this.size = options.size ?? 12;
146
+ this.family = options.family ?? "sans-serif";
147
+ this.weight = options.weight ?? "normal";
148
+ this.style = options.style ?? "normal";
149
+ this.variant = options.variant ?? "normal";
150
+ Object.freeze(this);
151
+ }
152
+ setSize(size) {
153
+ return new _FontSettings({ ...this, size: resolveValue(size, this.size) });
154
+ }
155
+ getSize() {
156
+ return this.size;
157
+ }
158
+ setFamily(family) {
159
+ return new _FontSettings({ ...this, family: resolveValue(family, this.family) });
160
+ }
161
+ getFamily() {
162
+ return this.family;
163
+ }
164
+ setWeight(weight) {
165
+ return new _FontSettings({ ...this, weight: resolveValue(weight, this.weight) });
166
+ }
167
+ getWeight() {
168
+ return this.weight;
169
+ }
170
+ setStyle(style) {
171
+ return new _FontSettings({ ...this, style: resolveValue(style, this.style) });
172
+ }
173
+ getStyle() {
174
+ return this.style;
175
+ }
176
+ setVariant(variant) {
177
+ return new _FontSettings({ ...this, variant: resolveValue(variant, this.variant) });
178
+ }
179
+ getVariant() {
180
+ return this.variant;
181
+ }
182
+ toCSS() {
183
+ return `${this.style} ${this.variant} ${this.weight} ${this.size}px ${this.family}`;
184
+ }
185
+ };
186
+ var AxisTickStrategies = Object.freeze({ Empty: "Empty", Numeric: "Numeric", DateTime: "DateTime", Time: "Time" });
187
+ function scrollStrategy(kind) {
188
+ return Object.freeze(Object.assign((options = {}) => Object.freeze({ ...options, kind }), { kind }));
189
+ }
190
+ var AxisScrollStrategies = Object.freeze({ fitting: scrollStrategy("fitting"), expansion: scrollStrategy("expansion"), progressive: scrollStrategy("progressive"), regressive: scrollStrategy("regressive"), scrolling: scrollStrategy("scrolling") });
191
+ var PointShape = Object.freeze({ Square: 0, Circle: 1, Triangle: 2, Cross: 3, Diamond: 4, Plus: 5, Minus: 6, Arrow: 7, Star: 8 });
192
+ var TriangulatedPoints3D = class _TriangulatedPoints3D {
193
+ fillStyle;
194
+ size;
195
+ shape;
196
+ constructor(options = {}) {
197
+ this.fillStyle = options.fillStyle ?? new SolidFill();
198
+ this.size = options.size ?? 5;
199
+ this.shape = options.shape ?? "sphere";
200
+ }
201
+ setFillStyle(value) {
202
+ return new _TriangulatedPoints3D({ ...this, fillStyle: resolveValue(value, this.fillStyle) });
203
+ }
204
+ getFillStyle() {
205
+ return this.fillStyle;
206
+ }
207
+ setSize(value) {
208
+ return new _TriangulatedPoints3D({ ...this, size: resolveValue(value, this.size) });
209
+ }
210
+ getSize() {
211
+ return this.size;
212
+ }
213
+ setShape(shape) {
214
+ return new _TriangulatedPoints3D({ ...this, shape });
215
+ }
216
+ getShape() {
217
+ return this.shape;
218
+ }
219
+ };
220
+ var PixelatedPoints3D = class extends TriangulatedPoints3D {
221
+ };
222
+ var PointStyle3D = Object.freeze({ Triangulated: TriangulatedPoints3D, Pixelated: PixelatedPoints3D });
223
+ var UIBuilder = class _UIBuilder {
224
+ kind;
225
+ type;
226
+ options;
227
+ constructor(kind, options = {}) {
228
+ this.kind = kind;
229
+ this.type = kind;
230
+ this.options = Object.freeze({ ...options });
231
+ Object.freeze(this);
232
+ }
233
+ setFont(font) {
234
+ return new _UIBuilder(this.kind, { ...this.options, font: resolveValue(font, this.options.font ?? new FontSettings()) });
235
+ }
236
+ setTextFillStyle(style) {
237
+ return new _UIBuilder(this.kind, { ...this.options, textFillStyle: style });
238
+ }
239
+ setBackground(style) {
240
+ return new _UIBuilder(this.kind, { ...this.options, background: style });
241
+ }
242
+ };
243
+ var UIElementBuilders = Object.freeze({ TextBox: new UIBuilder("TextBox"), CheckBox: new UIBuilder("CheckBox"), ButtonBox: new UIBuilder("ButtonBox"), PointableTextBox: new UIBuilder("PointableTextBox"), AxisTickMajor: new UIBuilder("AxisTickMajor"), AxisTickMinor: new UIBuilder("AxisTickMinor"), LUTRange: new UIBuilder("LUTRange") });
244
+ var UILayoutBuilders = Object.freeze({ Column: new UIBuilder("Column"), Row: new UIBuilder("Row") });
245
+ var UIOrigins = Object.freeze({ LeftBottom: { x: 0, y: 0 }, CenterBottom: { x: 0.5, y: 0 }, RightBottom: { x: 1, y: 0 }, LeftCenter: { x: 0, y: 0.5 }, Center: { x: 0.5, y: 0.5 }, RightCenter: { x: 1, y: 0.5 }, LeftTop: { x: 0, y: 1 }, CenterTop: { x: 0.5, y: 1 }, RightTop: { x: 1, y: 1 } });
246
+ var palette = ["#20b8f0", "#f5b942", "#e879a2", "#43c6a2", "#9a85ed", "#f18b53"].map(ColorHEX);
247
+ var heatmapDarkGoldColors = ["#ffff5b", "#ffcd5b", "#ff9b5b", "#ffc4bc", "#ff94b8", "#db94c6", "#ebc4e0", "#a994c6", "#94e2c6", "#94ffb0", "#b4ffa5"];
248
+ var heatmapLightColors = ["#1cb58c", "#ff8400", "#f02727", "#5679fb", "#02b5d5", "#0dd49e", "#16a703", "#ea67e8", "#3eb7b3", "#8c5d03", "#9b9eba"];
249
+ function heatmapFillPalette(colors) {
250
+ const fills = colors.map((color) => new SolidFill({ color: ColorHEX(color) }));
251
+ return (index) => fills[index % fills.length];
252
+ }
253
+ function makeTheme(name, background, foreground, heatmapColors) {
254
+ const bg = new SolidFill({ color: ColorHEX(background) }), fg = new SolidFill({ color: ColorHEX(foreground) });
255
+ const heatmapFill = heatmapColors ? heatmapFillPalette(heatmapColors) : void 0;
256
+ const heatmapWireframe = heatmapFill ? new SolidLine({ thickness: 1, fillStyle: new SolidFill({ color: name === "light" ? ColorRGBA(168, 186, 199, 50) : ColorRGBA(50, 50, 50, 50) }) }) : void 0;
257
+ return Object.freeze({
258
+ name,
259
+ backgroundFillStyle: bg,
260
+ panelBackgroundFillStyle: bg,
261
+ chartTitleFillStyle: fg,
262
+ axisTitleFillStyle: fg,
263
+ axisStrokeStyle: new SolidLine({ fillStyle: fg }),
264
+ dataColors: Object.freeze([...palette]),
265
+ textColor: fg.color,
266
+ backgroundColor: bg.color,
267
+ ...heatmapFill ? { pointSeriesFillStyle: heatmapFill, pointSeriesStrokeStyle: new SolidLine({ thickness: 1, fillStyle: new SolidFill({ color: name === "light" ? ColorRGBA(0, 0, 0) : ColorRGBA(255, 255, 255) }) }), heatmapGridSeriesFillStyle: heatmapFill, heatmapScrollingGridSeriesFillStyle: heatmapFill, polarHeatmapSeriesFillStyle: heatmapFill, heatmapGridSeriesWireframeStyle: heatmapWireframe, heatmapScrollingGridSeriesWireframeStyle: heatmapWireframe } : {}
268
+ });
269
+ }
270
+ var Themes = Object.freeze({ darkGold: makeTheme("darkGold", "#101923", "#e7edf4", heatmapDarkGoldColors), dark: makeTheme("dark", "#101923", "#e7edf4", heatmapDarkGoldColors), light: makeTheme("light", "#ffffff", "#243447", heatmapLightColors), lightNature: makeTheme("lightNature", "#f5faf5", "#293f35"), turquoiseHexagon: makeTheme("turquoiseHexagon", "#102b31", "#d4f8f3"), cyberSpace: makeTheme("cyberSpace", "#17152c", "#ebe6ff") });
271
+ var htmlTextRenderer = Object.freeze({ kind: "html", type: "html-text-renderer", createElement(text, documentRef = document) {
272
+ const element = documentRef.createElement("span");
273
+ element.textContent = text;
274
+ return element;
275
+ } });
276
+
277
+ // src/themes.ts
278
+ function makeCustomTheme(options = {}) {
279
+ const base = options.isDark ? Themes.dark : Themes.light;
280
+ const text = options.textColor ?? base.textColor;
281
+ const inputBackground = options.backgroundColor;
282
+ const background = inputBackground == null ? base.backgroundFillStyle : "kind" in inputBackground ? inputBackground : new SolidFill({ color: inputBackground });
283
+ const grid = options.gridLineColor ?? ColorHEX(options.isDark ? "#314353" : "#dce3e8");
284
+ const axis = options.axisColor ?? text;
285
+ const sizes = typeof options.fontSize === "number" ? { chartTitle: options.fontSize, axisTitle: options.fontSize, legendTitle: options.fontSize, other: options.fontSize } : options.fontSize ?? {};
286
+ const family = options.fontFamily ?? "Arial";
287
+ const textFill = new SolidFill({ color: text });
288
+ const chartTitleFont = new FontSettings({ size: sizes.chartTitle ?? 16, family });
289
+ const axisTitleFont = new FontSettings({ size: sizes.axisTitle ?? 12, family });
290
+ const dataColors = options.dataColors ? [...options.dataColors] : void 0;
291
+ const seriesStyles = {};
292
+ if (dataColors?.length) {
293
+ const colorAt = (index) => dataColors[(Math.trunc(index) % dataColors.length + dataColors.length) % dataColors.length];
294
+ const fillAt = (index) => new SolidFill({ color: colorAt(index) });
295
+ seriesStyles.lineSeriesStrokeStyle = options.lineSeriesStrokeStyle ?? ((index) => new SolidLine({ thickness: 2, fillStyle: fillAt(index) }));
296
+ seriesStyles.pointSeriesFillStyle = options.pointSeriesFillStyle ?? fillAt;
297
+ seriesStyles.pointSeriesStrokeStyle = options.pointSeriesStrokeStyle ?? new SolidLine({ thickness: 1, fillStyle: new SolidFill({ color: ColorHEX("#ffffff") }) });
298
+ }
299
+ const colors3D = dataColors?.length ? dataColors : base.dataColors;
300
+ const fill3D = (index) => new SolidFill({ color: colors3D[(Math.trunc(index) % colors3D.length + colors3D.length) % colors3D.length] });
301
+ const styles3D = {
302
+ lineSeries3DStrokeStyle: options.lineSeries3DStrokeStyle ?? base.lineSeries3DStrokeStyle ?? ((index) => new SolidLine({ thickness: 2, fillStyle: fill3D(index) })),
303
+ pointSeries3DPointStyle: options.pointSeries3DPointStyle ?? base.pointSeries3DPointStyle ?? ((index) => new TriangulatedPoints3D({ size: 10, fillStyle: fill3D(index) }))
304
+ };
305
+ return {
306
+ ...base,
307
+ name: "custom",
308
+ ...options,
309
+ backgroundColor: background.getColor?.() ?? ColorHEX("#00000000"),
310
+ textColor: text,
311
+ ...seriesStyles,
312
+ ...styles3D,
313
+ backgroundFillStyle: background,
314
+ panelBackgroundFillStyle: background,
315
+ chartTitleFillStyle: textFill,
316
+ axisTitleFillStyle: textFill,
317
+ legendTitleFillStyle: textFill,
318
+ chartTitleFont,
319
+ axisTitleFont,
320
+ // Public XY theme properties are also consumed directly by OpenTest.
321
+ chartXYBackgroundFillStyle: background,
322
+ chartXYTitleFillStyle: textFill,
323
+ chartXYTitleFont: chartTitleFont,
324
+ xAxisTitleFillStyle: textFill,
325
+ yAxisTitleFillStyle: textFill,
326
+ zAxisTitleFillStyle: textFill,
327
+ xAxisTitleFont: axisTitleFont,
328
+ yAxisTitleFont: axisTitleFont,
329
+ zAxisTitleFont: axisTitleFont,
330
+ legendTitleFont: new FontSettings({ size: sizes.legendTitle ?? 12, family }),
331
+ font: new FontSettings({ size: sizes.other ?? 14, family }),
332
+ uiTextFont: new FontSettings({ size: sizes.other ?? 14, family }),
333
+ uiTextFillStyle: textFill,
334
+ legendPadding: 5,
335
+ legendLUTLengthHorizontal: 160,
336
+ legendLUTThicknessHorizontal: 15,
337
+ legendLUTLengthVertical: 140,
338
+ legendLUTThicknessVertical: 25,
339
+ legendLUTLabelMargin: 7,
340
+ legendLUTUnitLabelMargin: 7,
341
+ axisTickStrokeStyle: options.axisTickStrokeStyle ?? emptyLine,
342
+ minorTickGridStrokeStyle: options.minorTickGridStrokeStyle ?? emptyLine,
343
+ tickLabelFillStyle: textFill,
344
+ axisStrokeStyle: new SolidLine({ fillStyle: new SolidFill({ color: axis }) }),
345
+ tickGridStrokeStyle: new SolidLine({ fillStyle: new SolidFill({ color: grid }) }),
346
+ chartXYSeriesBackgroundStrokeStyle: new SolidLine({ fillStyle: new SolidFill({ color: axis }) }),
347
+ chartXYSeriesBackgroundFillStyle: emptyFill,
348
+ uiBackgroundFillStyle: new SolidFill({ color: options.uiBackgroundColor ?? base.backgroundColor }),
349
+ uiBorderStrokeStyle: new SolidLine({ fillStyle: new SolidFill({ color: options.uiBorderColor ?? axis }) }),
350
+ dataColors: dataColors ?? [...base.dataColors],
351
+ effectsDisabled: options.effects === false
352
+ };
353
+ }
354
+ export {
355
+ Themes,
356
+ makeCustomTheme
357
+ };
@@ -0,0 +1,69 @@
1
+ import { ChartXY } from '../chart.js';
2
+ /** OpenTest's public data envelope, represented independently of its Vue host. */
3
+ export type NumericValues = readonly number[] | Float32Array | Float64Array | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array;
4
+ export interface DataEnvelope {
5
+ schemaVersion: 1;
6
+ seriesId: string;
7
+ kind: 'xy' | 'uniform';
8
+ yValues: NumericValues;
9
+ xValues?: NumericValues;
10
+ xStart?: number;
11
+ xStep?: number;
12
+ xUnit?: string;
13
+ yUnit?: string;
14
+ }
15
+ export interface ChartRange {
16
+ start: number;
17
+ end: number;
18
+ }
19
+ export interface ChartViewport {
20
+ x?: ChartRange;
21
+ y?: ChartRange;
22
+ }
23
+ export interface FrameworkSeriesOptions {
24
+ name?: string;
25
+ color?: string;
26
+ width?: number;
27
+ }
28
+ export interface FrameworkChartOptions {
29
+ title?: string;
30
+ xTitle?: string;
31
+ yTitle?: string;
32
+ xScale?: 'linear' | 'logarithmic';
33
+ fontSize?: number;
34
+ viewport?: ChartViewport;
35
+ showYCursor?: boolean;
36
+ }
37
+ export type FrameworkChartDisplayOptions = Partial<Omit<FrameworkChartOptions, 'xScale' | 'showYCursor'>>;
38
+ export interface FrameworkChartApi {
39
+ setData(data: DataEnvelope, options?: FrameworkSeriesOptions & {
40
+ append?: boolean;
41
+ }): void;
42
+ setOptions(options: FrameworkChartDisplayOptions): void;
43
+ setViewport(viewport: ChartViewport): void;
44
+ getViewport(): ChartViewport;
45
+ setSeriesVisible(seriesId: string, visible: boolean): void;
46
+ clear(seriesId?: string): void;
47
+ fitToData(): void;
48
+ resize(): void;
49
+ exportImage(): Promise<void>;
50
+ captureImage(): Promise<Blob>;
51
+ dispose(): void;
52
+ }
53
+ export interface CRYChartAdapter extends FrameworkChartApi {
54
+ /** Allows host integrations to attach their own controls without owning disposal. */
55
+ getChart(): ChartXY;
56
+ /** Original values are distinct from the finite-or-NaN rendering column. */
57
+ getSeriesSnapshot(seriesId: string): {
58
+ xValues: Float64Array;
59
+ yValues: Float64Array;
60
+ renderYValues: Float32Array;
61
+ } | undefined;
62
+ }
63
+ export declare function validateDataEnvelope(data: DataEnvelope): void;
64
+ /**
65
+ * Replacement for OpenTest's FrameworkChartFactory. No Vue, transport, license,
66
+ * native save dialog, or OpenTest source dependency is included in this module.
67
+ * This facade does not itself replace the legacy host's other direct chart calls.
68
+ */
69
+ export declare function createCRYChartAdapter(container?: HTMLElement | string, options?: FrameworkChartOptions): CRYChartAdapter;
@@ -0,0 +1,36 @@
1
+ import type { Annotation, Axis } from './axis.js';
2
+ import type { Rect } from './contracts.js';
3
+ export interface AnnotationDrag {
4
+ annotation: Annotation;
5
+ mode: 'line' | 'move-band' | 'start' | 'end';
6
+ pointerValue: number;
7
+ value: number;
8
+ start: number;
9
+ end: number;
10
+ interactionRevision: number;
11
+ active: boolean;
12
+ release?: () => void;
13
+ }
14
+ /** Pointer-enabled annotations are ordered exactly like their painted layers.
15
+ * Disabled covers are skipped, allowing the annotation underneath to be hit. */
16
+ export declare function pickAnnotation(axes: readonly Axis[], point: {
17
+ x: number;
18
+ y: number;
19
+ }, plot: Rect): Annotation | undefined;
20
+ export declare function updateAnnotationHover(axes: readonly Axis[], point: {
21
+ x: number;
22
+ y: number;
23
+ } | undefined, plot: Rect): Annotation | undefined;
24
+ /** Stop the subscription on pointer-up/cancel as well as on configuration
25
+ * changes. A disabled drag cannot resume from its stale initial grab position. */
26
+ export declare function finishAnnotationDrag(drag: AnnotationDrag): void;
27
+ /** Pick draggable annotation geometry, after overlay UI but before chart gestures. */
28
+ export declare function beginAnnotationDrag(axes: readonly Axis[], point: {
29
+ x: number;
30
+ y: number;
31
+ }, plot: Rect, onCancelled?: (drag: AnnotationDrag) => void): AnnotationDrag | undefined;
32
+ /** Publish one value/bounds event per pointer update; data and axis intervals stay untouched. */
33
+ export declare function updateAnnotationDrag(drag: AnnotationDrag, point: {
34
+ x: number;
35
+ y: number;
36
+ }, plot: Rect): boolean;
@@ -0,0 +1,78 @@
1
+ import type { Axis, TickStyle } from './axis';
2
+ import type { Rect } from './contracts';
3
+ import { type FillStyle, type FontSettings, type LineStyle } from './core/styles';
4
+ export interface AxisCanvasMetrics {
5
+ measured: boolean;
6
+ labelFont: FontSettings;
7
+ titleFont: FontSettings;
8
+ lane: number;
9
+ laneOffset: number;
10
+ laneSize: number;
11
+ labelOffset: number;
12
+ titleOffset: number;
13
+ tickLength: number;
14
+ labelWidth: number;
15
+ labelAscent: number;
16
+ labelDescent: number;
17
+ titleWidth: number;
18
+ titleAscent: number;
19
+ titleDescent: number;
20
+ rotation: number;
21
+ lineBoxTitleBaseline?: number;
22
+ }
23
+ export interface AxisCanvasLayout {
24
+ contentMargins?: {
25
+ left: number;
26
+ right: number;
27
+ top: number;
28
+ bottom: number;
29
+ };
30
+ extraMargins: {
31
+ left: number;
32
+ right: number;
33
+ top: number;
34
+ bottom: number;
35
+ };
36
+ axes: Map<Axis, AxisCanvasMetrics>;
37
+ }
38
+ export interface AxisCanvasOptions {
39
+ plot: Rect;
40
+ axesX: readonly Axis[];
41
+ axesY: readonly Axis[];
42
+ light?: boolean;
43
+ width?: number;
44
+ height?: number;
45
+ layout?: AxisCanvasLayout;
46
+ theme?: AxisCanvasTheme;
47
+ resolveFont?: (font: FontSettings) => FontSettings;
48
+ paintFrame?: () => void;
49
+ }
50
+ export interface AxisCanvasTheme {
51
+ font?: FontSettings;
52
+ tickLabelFillStyle?: FillStyle;
53
+ tickGridStrokeStyle?: LineStyle;
54
+ minorTickGridStrokeStyle?: LineStyle;
55
+ axisTitleFillStyle?: FillStyle;
56
+ xAxisTitleFillStyle?: FillStyle;
57
+ yAxisTitleFillStyle?: FillStyle;
58
+ zAxisTitleFillStyle?: FillStyle;
59
+ }
60
+ /** Content occupied by a one-line title, measured independently of axis labels.
61
+ * Canvas glyph bounds include the baseline row in a positive descent; count it
62
+ * once when converting that raster extent back to CSS pixels. Four CSS pixels
63
+ * above and below keep the title's content box separate from its outer margin.
64
+ */
65
+ export declare function measureChartTitleContent(ctx: CanvasRenderingContext2D | undefined, text: string, font: FontSettings, dpr?: number): number;
66
+ type TickLevel = 'great' | 'major' | 'minor';
67
+ export declare function resolvedTickFill(axis: Axis, level: TickLevel, style: TickStyle, theme?: AxisCanvasTheme, forDrawing?: boolean): any;
68
+ /** Additional space only; callers retain their existing default 44/54px lanes. */
69
+ export declare function measureAxisCanvasLayout(ctx: CanvasRenderingContext2D | undefined, axesX: readonly Axis[], axesY: readonly Axis[], theme?: AxisCanvasTheme, resolveFont?: (font: FontSettings) => FontSettings, contentLayout?: boolean): AxisCanvasLayout;
70
+ export declare function axisCanvasLaneOffset(layout: AxisCanvasLayout, axis: Axis): number;
71
+ /** Keep the actual ink inside the physical axis range, without changing text.
72
+ * A label wider than that range cannot fit: align its nearer end and retain
73
+ * normal Canvas clipping. This deliberately does not remove or shrink ticks.
74
+ */
75
+ export declare function boundAxisLabelX(ctx: CanvasRenderingContext2D, text: string, anchor: number, start: number, end: number, measured?: TextMetrics): number;
76
+ /** Original XY axis renderer; keeps axis painting separate from chart lifetime. */
77
+ export declare function drawAxisCanvas(ctx: CanvasRenderingContext2D, options: AxisCanvasOptions): AxisCanvasLayout;
78
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { Axis } from './axis.js';
2
+ import type { Interval } from './contracts.js';
3
+ /** Each parallel axis column partitions its own stacks on one plotting surface. */
4
+ export declare function layoutAxisStacks(axes: readonly Axis[], length: number): Map<Axis, {
5
+ range: Interval;
6
+ lane: number;
7
+ }>;
8
+ export declare function parallelAxisCount(axes: readonly Axis[], opposite: boolean): number;
9
+ /** Expand a data domain so a shared GPU viewport maps it into one axis stack. */
10
+ export declare function domainForStack(domain: Interval, range: Interval): Interval;
@@ -0,0 +1,16 @@
1
+ export interface ScrollInterval {
2
+ start: number;
3
+ end: number;
4
+ }
5
+ /** A bounded, time-based approach to an automatic viewport target. The target
6
+ * is independent of the displayed interval, so retargeting a live stream does
7
+ * not mutate samples or restart the response from an obsolete viewport. */
8
+ export declare class AxisScrollAnimation {
9
+ private target;
10
+ private previousTime;
11
+ private stableFrames;
12
+ request(target: ScrollInterval): void;
13
+ pending(): boolean;
14
+ cancel(): void;
15
+ advance(current: ScrollInterval, timestamp: number, pixelLength: number, logarithmic?: boolean): ScrollInterval | undefined;
16
+ }