minerva-design 1.1.0 → 1.2.0
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/CHANGELOG.md +8 -0
- package/dist/charts/canvas.d.cts +7 -0
- package/dist/charts/canvas.d.ts +7 -0
- package/dist/charts/core.cjs +1 -1
- package/dist/charts/core.d.cts +5 -1
- package/dist/charts/core.d.ts +5 -1
- package/dist/charts/core.js +4 -1
- package/dist/charts/engine/canvas.cjs +2 -0
- package/dist/charts/engine/canvas.cjs.map +1 -0
- package/dist/charts/engine/canvas.d.cts +85 -0
- package/dist/charts/engine/canvas.d.ts +85 -0
- package/dist/charts/engine/canvas.js +165 -0
- package/dist/charts/engine/canvas.js.map +1 -0
- package/dist/charts/engine/chart.cjs +2 -2
- package/dist/charts/engine/chart.cjs.map +1 -1
- package/dist/charts/engine/chart.js +382 -440
- package/dist/charts/engine/chart.js.map +1 -1
- package/dist/charts/engine/color.cjs +1 -1
- package/dist/charts/engine/color.cjs.map +1 -1
- package/dist/charts/engine/color.d.cts +10 -0
- package/dist/charts/engine/color.d.ts +10 -0
- package/dist/charts/engine/color.js +75 -3
- package/dist/charts/engine/color.js.map +1 -1
- package/dist/charts/engine/controller.cjs +3 -0
- package/dist/charts/engine/controller.cjs.map +1 -0
- package/dist/charts/engine/controller.d.cts +182 -0
- package/dist/charts/engine/controller.d.ts +182 -0
- package/dist/charts/engine/controller.js +528 -0
- package/dist/charts/engine/controller.js.map +1 -0
- package/dist/charts/engine/model.cjs +1 -1
- package/dist/charts/engine/model.cjs.map +1 -1
- package/dist/charts/engine/model.d.cts +2 -2
- package/dist/charts/engine/model.d.ts +2 -2
- package/dist/charts/engine/model.js +72 -72
- package/dist/charts/engine/model.js.map +1 -1
- package/dist/charts/engine/overlay.cjs +1 -1
- package/dist/charts/engine/overlay.cjs.map +1 -1
- package/dist/charts/engine/overlay.d.cts +17 -1
- package/dist/charts/engine/overlay.d.ts +17 -1
- package/dist/charts/engine/overlay.js +63 -49
- package/dist/charts/engine/overlay.js.map +1 -1
- package/dist/charts/engine/presets.cjs +3 -0
- package/dist/charts/engine/presets.cjs.map +1 -0
- package/dist/charts/engine/presets.d.cts +103 -0
- package/dist/charts/engine/presets.d.ts +103 -0
- package/dist/charts/engine/presets.js +153 -0
- package/dist/charts/engine/presets.js.map +1 -0
- package/dist/charts/engine/renderers/canvas2d.cjs +1 -1
- package/dist/charts/engine/renderers/canvas2d.cjs.map +1 -1
- package/dist/charts/engine/renderers/canvas2d.d.cts +17 -1
- package/dist/charts/engine/renderers/canvas2d.d.ts +17 -1
- package/dist/charts/engine/renderers/canvas2d.js +88 -51
- package/dist/charts/engine/renderers/canvas2d.js.map +1 -1
- package/dist/charts/engine/scene.cjs +2 -0
- package/dist/charts/engine/scene.cjs.map +1 -0
- package/dist/charts/engine/scene.d.cts +89 -0
- package/dist/charts/engine/scene.d.ts +89 -0
- package/dist/charts/engine/scene.js +241 -0
- package/dist/charts/engine/scene.js.map +1 -0
- package/dist/charts/engine/theme.cjs +1 -1
- package/dist/charts/engine/theme.cjs.map +1 -1
- package/dist/charts/engine/theme.d.cts +25 -1
- package/dist/charts/engine/theme.d.ts +25 -1
- package/dist/charts/engine/theme.js +42 -26
- package/dist/charts/engine/theme.js.map +1 -1
- package/dist/charts/engine/types.d.cts +69 -2
- package/dist/charts/engine/types.d.ts +69 -2
- package/dist/charts/index.cjs +1 -1
- package/dist/charts/index.d.cts +1 -1
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/index.js +5 -2
- package/dist/charts/react/Chart.cjs +1 -1
- package/dist/charts/react/Chart.cjs.map +1 -1
- package/dist/charts/react/Chart.d.cts +11 -4
- package/dist/charts/react/Chart.d.ts +11 -4
- package/dist/charts/react/Chart.js +81 -39
- package/dist/charts/react/Chart.js.map +1 -1
- package/dist/charts/react/charts.cjs +1 -1
- package/dist/charts/react/charts.cjs.map +1 -1
- package/dist/charts/react/charts.d.cts +1 -1
- package/dist/charts/react/charts.d.ts +1 -1
- package/dist/charts/react/charts.js +99 -145
- package/dist/charts/react/charts.js.map +1 -1
- package/dist/charts/react/types.d.cts +29 -61
- package/dist/charts/react/types.d.ts +29 -61
- package/dist/native/charts/src/canvas.cjs +1 -0
- package/dist/native/charts/src/canvas.js +6 -0
- package/dist/native/charts/src/engine/axis.cjs +2 -0
- package/dist/native/charts/src/engine/axis.cjs.map +1 -0
- package/dist/native/charts/src/engine/axis.js +38 -0
- package/dist/native/charts/src/engine/axis.js.map +1 -0
- package/dist/native/charts/src/engine/canvas.cjs +1 -0
- package/dist/native/charts/src/engine/canvas.js +1 -0
- package/dist/native/charts/src/engine/color.cjs +2 -0
- package/dist/native/charts/src/engine/color.cjs.map +1 -0
- package/dist/native/charts/src/engine/color.js +130 -0
- package/dist/native/charts/src/engine/color.js.map +1 -0
- package/dist/native/charts/src/engine/controller.cjs +3 -0
- package/dist/native/charts/src/engine/controller.cjs.map +1 -0
- package/dist/native/charts/src/engine/controller.js +528 -0
- package/dist/native/charts/src/engine/controller.js.map +1 -0
- package/dist/native/charts/src/engine/data.cjs +2 -0
- package/dist/native/charts/src/engine/data.cjs.map +1 -0
- package/dist/native/charts/src/engine/data.js +104 -0
- package/dist/native/charts/src/engine/data.js.map +1 -0
- package/dist/native/charts/src/engine/decimate.cjs +2 -0
- package/dist/native/charts/src/engine/decimate.cjs.map +1 -0
- package/dist/native/charts/src/engine/decimate.js +28 -0
- package/dist/native/charts/src/engine/decimate.js.map +1 -0
- package/dist/native/charts/src/engine/format.cjs +2 -0
- package/dist/native/charts/src/engine/format.cjs.map +1 -0
- package/dist/native/charts/src/engine/format.js +34 -0
- package/dist/native/charts/src/engine/format.js.map +1 -0
- package/dist/native/charts/src/engine/layout.cjs +2 -0
- package/dist/native/charts/src/engine/layout.cjs.map +1 -0
- package/dist/native/charts/src/engine/layout.js +26 -0
- package/dist/native/charts/src/engine/layout.js.map +1 -0
- package/dist/native/charts/src/engine/model.cjs +2 -0
- package/dist/native/charts/src/engine/model.cjs.map +1 -0
- package/dist/native/charts/src/engine/model.js +175 -0
- package/dist/native/charts/src/engine/model.js.map +1 -0
- package/dist/native/charts/src/engine/overlay.cjs +2 -0
- package/dist/native/charts/src/engine/overlay.cjs.map +1 -0
- package/dist/native/charts/src/engine/overlay.js +49 -0
- package/dist/native/charts/src/engine/overlay.js.map +1 -0
- package/dist/native/charts/src/engine/presets.cjs +3 -0
- package/dist/native/charts/src/engine/presets.cjs.map +1 -0
- package/dist/native/charts/src/engine/presets.js +147 -0
- package/dist/native/charts/src/engine/presets.js.map +1 -0
- package/dist/native/charts/src/engine/scale.cjs +2 -0
- package/dist/native/charts/src/engine/scale.cjs.map +1 -0
- package/dist/native/charts/src/engine/scale.js +37 -0
- package/dist/native/charts/src/engine/scale.js.map +1 -0
- package/dist/native/charts/src/engine/scene.cjs +2 -0
- package/dist/native/charts/src/engine/scene.cjs.map +1 -0
- package/dist/native/charts/src/engine/scene.js +241 -0
- package/dist/native/charts/src/engine/scene.js.map +1 -0
- package/dist/native/charts/src/engine/spatial.cjs +2 -0
- package/dist/native/charts/src/engine/spatial.cjs.map +1 -0
- package/dist/native/charts/src/engine/spatial.js +53 -0
- package/dist/native/charts/src/engine/spatial.js.map +1 -0
- package/dist/native/charts/src/engine/theme.cjs +2 -0
- package/dist/native/charts/src/engine/theme.cjs.map +1 -0
- package/dist/native/charts/src/engine/theme.js +62 -0
- package/dist/native/charts/src/engine/theme.js.map +1 -0
- package/dist/native/charts/src/engine/time.cjs +2 -0
- package/dist/native/charts/src/engine/time.cjs.map +1 -0
- package/dist/native/charts/src/engine/time.js +189 -0
- package/dist/native/charts/src/engine/time.js.map +1 -0
- package/dist/native/charts/src/engine/viewport.cjs +2 -0
- package/dist/native/charts/src/engine/viewport.cjs.map +1 -0
- package/dist/native/charts/src/engine/viewport.js +12 -0
- package/dist/native/charts/src/engine/viewport.js.map +1 -0
- package/dist/native/components/Chart/ChartBase.cjs +2 -0
- package/dist/native/components/Chart/ChartBase.cjs.map +1 -0
- package/dist/native/components/Chart/ChartBase.d.cts +29 -0
- package/dist/native/components/Chart/ChartBase.d.ts +29 -0
- package/dist/native/components/Chart/ChartBase.js +287 -0
- package/dist/native/components/Chart/ChartBase.js.map +1 -0
- package/dist/native/components/Chart/charts.cjs +2 -0
- package/dist/native/components/Chart/charts.cjs.map +1 -0
- package/dist/native/components/Chart/charts.d.cts +19 -0
- package/dist/native/components/Chart/charts.d.ts +19 -0
- package/dist/native/components/Chart/charts.js +173 -0
- package/dist/native/components/Chart/charts.js.map +1 -0
- package/dist/native/components/Chart/index.cjs +1 -0
- package/dist/native/components/Chart/index.d.cts +2 -0
- package/dist/native/components/Chart/index.d.ts +2 -0
- package/dist/native/components/Chart/index.js +2 -0
- package/dist/native/components/Chart/measure.cjs +2 -0
- package/dist/native/components/Chart/measure.cjs.map +1 -0
- package/dist/native/components/Chart/measure.d.cts +5 -0
- package/dist/native/components/Chart/measure.d.ts +5 -0
- package/dist/native/components/Chart/measure.js +11 -0
- package/dist/native/components/Chart/measure.js.map +1 -0
- package/dist/native/components/Chart/scene.cjs +2 -0
- package/dist/native/components/Chart/scene.cjs.map +1 -0
- package/dist/native/components/Chart/scene.d.cts +41 -0
- package/dist/native/components/Chart/scene.d.ts +41 -0
- package/dist/native/components/Chart/scene.js +419 -0
- package/dist/native/components/Chart/scene.js.map +1 -0
- package/dist/native/components/Chart/theme.cjs +2 -0
- package/dist/native/components/Chart/theme.cjs.map +1 -0
- package/dist/native/components/Chart/theme.d.cts +10 -0
- package/dist/native/components/Chart/theme.d.ts +10 -0
- package/dist/native/components/Chart/theme.js +10 -0
- package/dist/native/components/Chart/theme.js.map +1 -0
- package/dist/native/components/Chart/types.d.cts +129 -0
- package/dist/native/components/Chart/types.d.ts +129 -0
- package/dist/native/index.cjs +1 -1
- package/dist/native/index.d.cts +1 -0
- package/dist/native/index.d.ts +1 -0
- package/dist/native/index.js +6 -4
- package/dist/native/manifest.d.cts +7 -0
- package/dist/native/manifest.d.ts +7 -0
- package/dist/native/source/components/Chart/ChartBase.tsx +545 -0
- package/dist/native/source/components/Chart/charts.tsx +291 -0
- package/dist/native/source/components/Chart/index.ts +8 -0
- package/dist/native/source/components/Chart/measure.ts +50 -0
- package/dist/native/source/components/Chart/scene.tsx +987 -0
- package/dist/native/source/components/Chart/theme.ts +16 -0
- package/dist/native/source/components/Chart/types.ts +194 -0
- package/dist/native/source/index.ts +1 -0
- package/dist/native/source/manifest.ts +14 -0
- package/dist/taro/charts.d.ts +144 -0
- package/dist/taro/index.d.ts +1 -0
- package/dist/taro/index.js +3064 -618
- package/dist/uni/BarChart.vue +75 -0
- package/dist/uni/BarChart.vue.d.ts +111 -0
- package/dist/uni/Chart.vue +68 -0
- package/dist/uni/Chart.vue.d.ts +100 -0
- package/dist/uni/LineChart.vue +75 -0
- package/dist/uni/LineChart.vue.d.ts +111 -0
- package/dist/uni/ProgressIndicator.vue.d.ts +1 -1
- package/dist/uni/QuadrantChart.vue +184 -0
- package/dist/uni/QuadrantChart.vue.d.ts +173 -0
- package/dist/uni/ScatterChart.vue +69 -0
- package/dist/uni/ScatterChart.vue.d.ts +100 -0
- package/dist/uni/chart-canvas.d.ts +68 -0
- package/dist/uni/chart-canvas.js +363 -0
- package/dist/uni/chart-types.d.ts +135 -0
- package/dist/uni/chart-types.js +84 -0
- package/dist/uni/charts-canvas.d.ts +1 -0
- package/dist/uni/charts-canvas.js +8 -0
- package/dist/uni/index.d.ts +6 -0
- package/dist/uni/index.js +6 -0
- package/dist/weapp/bar-chart/index.js +1 -0
- package/dist/weapp/bar-chart/index.json +1 -0
- package/dist/weapp/bar-chart/index.wxml +1 -0
- package/dist/weapp/bar-chart/index.wxss +1 -0
- package/dist/weapp/chart/index.js +1 -0
- package/dist/weapp/chart/index.json +1 -0
- package/dist/weapp/chart/index.wxml +1 -0
- package/dist/weapp/chart/index.wxss +1 -0
- package/dist/weapp/controls.js +4019 -266
- package/dist/weapp/line-chart/index.js +1 -0
- package/dist/weapp/line-chart/index.json +1 -0
- package/dist/weapp/line-chart/index.wxml +1 -0
- package/dist/weapp/line-chart/index.wxss +1 -0
- package/dist/weapp/quadrant-chart/index.js +1 -0
- package/dist/weapp/quadrant-chart/index.json +1 -0
- package/dist/weapp/quadrant-chart/index.wxml +1 -0
- package/dist/weapp/quadrant-chart/index.wxss +1 -0
- package/dist/weapp/scatter-chart/index.js +1 -0
- package/dist/weapp/scatter-chart/index.json +1 -0
- package/dist/weapp/scatter-chart/index.wxml +1 -0
- package/dist/weapp/scatter-chart/index.wxss +1 -0
- package/dist/weapp/types.d.ts +295 -0
- package/package.json +21 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# minerva-design
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- docs(charts): document canvas charts, mini-program and React Native charts
|
|
8
|
+
feat(charts): add charts for Taro, uni-app, WeChat and React Native
|
|
9
|
+
feat(charts): add headless controller, canvas renderer and draggable points
|
|
10
|
+
|
|
3
11
|
## 1.1.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createCanvasChart, drawScene, type CanvasChartConfig, type CanvasChartInstance, type ChartCanvas, type ChartTouch, } from './engine/canvas.cjs';
|
|
2
|
+
export { createChartController, scenePrimitives, type ChartAreaPrimitive, type ChartBarPrimitive, type ChartController, type ChartControllerConfig, type ChartControllerEventMap, type ChartDotPrimitive, type ChartHoverLayout, type ChartLegendEntry, type ChartLegendLayout, type ChartLinePrimitive, type ChartPointerOptions, type ChartPrimitive, type ChartPrimitiveOptions, type ChartScene, type ChartTooltipLayout, } from './engine/controller.cjs';
|
|
3
|
+
export { formatCompact } from './engine/format.cjs';
|
|
4
|
+
export { barSeries, DEFAULT_QUADRANT_COLORS, lineSeries, quadrantCenter, quadrantChartOptions, quadrantOf, scatterSeries, type QuadrantAxisLabels, type QuadrantConfig, type QuadrantCorner, type QuadrantPoint, type QuadrantRegion, type QuadrantRegions, } from './engine/presets.cjs';
|
|
5
|
+
export { toCss } from './engine/color.cjs';
|
|
6
|
+
export type { ChartThemeInput } from './engine/theme.cjs';
|
|
7
|
+
export type * from './engine/types.cjs';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createCanvasChart, drawScene, type CanvasChartConfig, type CanvasChartInstance, type ChartCanvas, type ChartTouch, } from './engine/canvas.js';
|
|
2
|
+
export { createChartController, scenePrimitives, type ChartAreaPrimitive, type ChartBarPrimitive, type ChartController, type ChartControllerConfig, type ChartControllerEventMap, type ChartDotPrimitive, type ChartHoverLayout, type ChartLegendEntry, type ChartLegendLayout, type ChartLinePrimitive, type ChartPointerOptions, type ChartPrimitive, type ChartPrimitiveOptions, type ChartScene, type ChartTooltipLayout, } from './engine/controller.js';
|
|
3
|
+
export { formatCompact } from './engine/format.js';
|
|
4
|
+
export { barSeries, DEFAULT_QUADRANT_COLORS, lineSeries, quadrantCenter, quadrantChartOptions, quadrantOf, scatterSeries, type QuadrantAxisLabels, type QuadrantConfig, type QuadrantCorner, type QuadrantPoint, type QuadrantRegion, type QuadrantRegions, } from './engine/presets.js';
|
|
5
|
+
export { toCss } from './engine/color.js';
|
|
6
|
+
export type { ChartThemeInput } from './engine/theme.js';
|
|
7
|
+
export type * from './engine/types.js';
|
package/dist/charts/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./engine/format.cjs"),t=require("./engine/chart.cjs");exports.createChart=t.createChart,exports.formatCompact=e.formatCompact;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./engine/format.cjs"),t=require("./engine/chart.cjs"),n=require("./engine/presets.cjs"),r=require("./engine/controller.cjs"),i=require("./engine/canvas.cjs");exports.createCanvasChart=i.createCanvasChart,exports.createChart=t.createChart,exports.createChartController=r.createChartController,exports.formatCompact=e.formatCompact,exports.quadrantCenter=n.quadrantCenter,exports.quadrantChartOptions=n.quadrantChartOptions,exports.quadrantOf=n.quadrantOf,exports.scenePrimitives=r.scenePrimitives;
|
package/dist/charts/core.d.cts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export { createChart } from './engine/chart.cjs';
|
|
2
|
+
export { createCanvasChart, type CanvasChartConfig, type CanvasChartInstance, type ChartCanvas, type ChartTouch, } from './engine/canvas.cjs';
|
|
3
|
+
export { createChartController, scenePrimitives, type ChartAreaPrimitive, type ChartBarPrimitive, type ChartController, type ChartControllerConfig, type ChartControllerEventMap, type ChartDotPrimitive, type ChartHoverLayout, type ChartLegendEntry, type ChartLegendLayout, type ChartLinePrimitive, type ChartPointerOptions, type ChartPrimitive, type ChartPrimitiveOptions, type ChartScene, type ChartTooltipLayout, } from './engine/controller.cjs';
|
|
2
4
|
export { formatCompact } from './engine/format.cjs';
|
|
3
|
-
export
|
|
5
|
+
export { quadrantCenter, quadrantChartOptions, quadrantOf, type QuadrantAxisLabels, type QuadrantConfig, type QuadrantCorner, type QuadrantPoint, type QuadrantRegion, type QuadrantRegions, } from './engine/presets.cjs';
|
|
6
|
+
export type { ChartThemeInput } from './engine/theme.cjs';
|
|
7
|
+
export type { ChartAnnotation, ChartAxisOptions, ChartAxisType, ChartColumnData, ChartDragEvent, ChartEventMap, ChartHoverEvent, ChartHoverItem, ChartInstance, ChartInteractionOptions, ChartLabelPosition, ChartLegendOptions, ChartLineAnnotation, ChartOptions, ChartPadding, ChartPlotClickEvent, ChartPointDatum, ChartRect, ChartRectAnnotation, ChartRendererKind, ChartRendererPreference, ChartSeries, ChartSeriesData, ChartSeriesType, ChartTextAnnotation, ChartTooltipOptions, ChartView, ChartXValue, } from './engine/types.cjs';
|
package/dist/charts/core.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export { createChart } from './engine/chart.js';
|
|
2
|
+
export { createCanvasChart, type CanvasChartConfig, type CanvasChartInstance, type ChartCanvas, type ChartTouch, } from './engine/canvas.js';
|
|
3
|
+
export { createChartController, scenePrimitives, type ChartAreaPrimitive, type ChartBarPrimitive, type ChartController, type ChartControllerConfig, type ChartControllerEventMap, type ChartDotPrimitive, type ChartHoverLayout, type ChartLegendEntry, type ChartLegendLayout, type ChartLinePrimitive, type ChartPointerOptions, type ChartPrimitive, type ChartPrimitiveOptions, type ChartScene, type ChartTooltipLayout, } from './engine/controller.js';
|
|
2
4
|
export { formatCompact } from './engine/format.js';
|
|
3
|
-
export
|
|
5
|
+
export { quadrantCenter, quadrantChartOptions, quadrantOf, type QuadrantAxisLabels, type QuadrantConfig, type QuadrantCorner, type QuadrantPoint, type QuadrantRegion, type QuadrantRegions, } from './engine/presets.js';
|
|
6
|
+
export type { ChartThemeInput } from './engine/theme.js';
|
|
7
|
+
export type { ChartAnnotation, ChartAxisOptions, ChartAxisType, ChartColumnData, ChartDragEvent, ChartEventMap, ChartHoverEvent, ChartHoverItem, ChartInstance, ChartInteractionOptions, ChartLabelPosition, ChartLegendOptions, ChartLineAnnotation, ChartOptions, ChartPadding, ChartPlotClickEvent, ChartPointDatum, ChartRect, ChartRectAnnotation, ChartRendererKind, ChartRendererPreference, ChartSeries, ChartSeriesData, ChartSeriesType, ChartTextAnnotation, ChartTooltipOptions, ChartView, ChartXValue, } from './engine/types.js';
|
package/dist/charts/core.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { formatCompact as e } from "./engine/format.js";
|
|
2
2
|
import { createChart as t } from "./engine/chart.js";
|
|
3
|
-
|
|
3
|
+
import { quadrantCenter as n, quadrantChartOptions as r, quadrantOf as i } from "./engine/presets.js";
|
|
4
|
+
import { createChartController as a, scenePrimitives as o } from "./engine/controller.js";
|
|
5
|
+
import { createCanvasChart as s } from "./engine/canvas.js";
|
|
6
|
+
export { s as createCanvasChart, t as createChart, a as createChartController, e as formatCompact, n as quadrantCenter, r as quadrantChartOptions, i as quadrantOf, o as scenePrimitives };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./color.cjs"),t=require("./items.cjs"),n=require("./overlay.cjs"),r=require("./renderers/canvas2d.cjs"),i=require("./controller.cjs");var a=e=>(e[0]+e[1])/2,o=(e,t,n,r,i,a)=>{e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.arcTo(t+r,n,t+r,n+a,a),e.lineTo(t+r,n+i-a),e.arcTo(t+r,n+i,t+r-a,n+i,a),e.lineTo(t+a,n+i),e.arcTo(t,n+i,t,n+i-a,a),e.lineTo(t,n+a),e.arcTo(t,n,t+a,n,a),e.closePath()},s=(t,i,a,s,c,l=r.createCanvas2dPainter(t))=>{let{width:u,height:d,theme:f,model:p,view:m,layout:h}=i,{plot:g,scales:_}=h,v=c;if(t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,Math.ceil(u*v),Math.ceil(d*v)),t.setTransform(v,0,0,v,0,0),n.drawBackground(t,{width:u,height:d,scales:_,x:p.x,y:p.y,xTicks:h.xTicks,yTicks:h.yTicks,theme:f,annotations:i.annotations}),i.legend){t.font=n.font(f,12),t.textBaseline=`middle`,t.textAlign=`left`;for(let n of i.legend.entries){let r=n.box.y+n.box.height/2;if(t.globalAlpha=n.hidden?.45:1,t.fillStyle=n.color,n.shape===`dot`?(t.beginPath(),t.arc(n.box.x+5,r,4,0,Math.PI*2),t.fill()):n.shape===`line`?t.fillRect(n.box.x,r-1,10,2):t.fillRect(n.box.x+1,r-4,8,8),t.fillStyle=e.toCss(f.textMuted),t.fillText(n.name,n.box.x+14,r),n.hidden){let e=n.box.width-22;t.fillRect(n.box.x+14,r,e,1)}}t.globalAlpha=1}let y=(e,t,n)=>{let r=2/(e[1]-e[0]),i=(t-e[0])*r-1;return n?[-r,-i]:[r,i]},[b,x]=y(m.x,s.x,p.x.reverse),[S,C]=y(m.y,s.y,p.y.reverse);if(l.paint(a,{transform:{xScale:b,xOffset:x,yScale:S,yOffset:C},width:Math.max(1,Math.round(g.width*v)),height:Math.max(1,Math.round(g.height*v)),dpr:v},Math.round(g.x*v),Math.round(g.y*v)),t.setTransform(v,0,0,v,0,0),n.drawForeground(t,{width:u,height:d,scales:_,theme:f,annotations:i.annotations,pointLabels:[],clear:!1}),i.pointLabels.length){t.save(),t.font=n.font(f),t.textAlign=`left`,t.textBaseline=`middle`,t.lineWidth=3,t.lineJoin=`round`,t.strokeStyle=e.toCss(f.background,.9),t.fillStyle=e.toCss(f.text,.85);for(let{label:e,box:n}of i.pointLabels)t.strokeText(e.text,n.x,n.y+n.height/2),t.fillText(e.text,n.x,n.y+n.height/2);t.restore()}let w=i.hover;if(w){if(w.crosshairX!==null){t.save(),t.strokeStyle=e.toCss(f.textMuted,.55),t.lineWidth=1,t.setLineDash([3,3]),t.beginPath();let n=Math.round(w.crosshairX)+.5;t.moveTo(n,g.y),t.lineTo(n,g.y+g.height),t.stroke(),t.restore()}for(let n of w.marks){if(n.kind===`bar`){t.fillStyle=e.toCss(f.text,.08),t.fillRect(n.x-2,n.y-2,n.width+4,n.height+2);continue}t.beginPath(),t.arc(n.x,n.y,n.size/2,0,Math.PI*2),t.fillStyle=n.color,t.fill(),t.lineWidth=2,t.strokeStyle=e.toCss(f.background),t.stroke()}}if(i.dragging){let n=i.dragging;t.beginPath(),t.arc(n.x,n.y,n.size/2,0,Math.PI*2),t.fillStyle=n.color,t.globalAlpha=.85,t.fill(),t.globalAlpha=1,t.lineWidth=2,t.strokeStyle=e.toCss(f.background),t.stroke()}let T=w?.tooltip;if(T){let{box:r,lineHeight:i,padding:a}=T;t.save(),t.shadowColor=`rgba(15, 23, 42, 0.18)`,t.shadowBlur=16,t.shadowOffsetY=6,o(t,r.x,r.y,r.width,r.height,8),t.fillStyle=e.toCss(f.background),t.fill(),t.restore(),o(t,r.x+.5,r.y+.5,r.width-1,r.height-1,8),t.strokeStyle=e.toCss(f.axis),t.lineWidth=1,t.stroke(),t.textBaseline=`middle`;let s=r.y+a+i/2,c=r.x+a+2,l=r.x+r.width-a-2;if(T.text){t.font=n.font(f,12),t.fillStyle=e.toCss(f.text),t.textAlign=`left`;for(let e of T.text)t.fillText(e,c,s),s+=i}else{let{content:r}=T,a=c;r.titleColor&&(t.fillStyle=r.titleColor,t.beginPath(),t.arc(a+4,s,4,0,Math.PI*2),t.fill(),a+=14),t.font=n.font(f,12,600),t.fillStyle=e.toCss(f.text),t.textAlign=`left`,t.fillText(r.title,a,s),s+=i;for(let o of r.rows)a=c,o.color&&(t.fillStyle=o.color,t.beginPath(),t.arc(a+4,s,4,0,Math.PI*2),t.fill(),a+=14),t.font=n.font(f,12),t.textAlign=`left`,t.fillStyle=e.toCss(f.textMuted),t.fillText(o.name,a,s),t.font=n.font(f,12,600),t.textAlign=`right`,t.fillStyle=e.toCss(f.text),t.fillText(o.value,l,s),s+=i}}},c=e=>{let{canvas:n}=e,o=n.getContext(`2d`),c=e.width,l=e.height,u=e.pixelRatio??1,d=!1,f=null,p=[],m=null,h={x:0,y:0},g=0,_=``,v=(e,t)=>o?(t!==_&&(o.font=t,_=t),o.measureText(e).width):e.length*6.5,y=o?r.createCanvas2dPainter(o):null,b=globalThis,x=()=>{if(f=null,d||!o||!y)return;let e=C.getScene();if(!e)return;let r=Math.max(1,Math.round(c*u)),i=Math.max(1,Math.round(l*u));n.width!==r&&(n.width=r),n.height!==i&&(n.height=i),_=``,m!==e.model&&(m=e.model,h={x:a(e.model.base.x),y:a(e.model.base.y)},p=t.buildItems(e.model,h,++g)),s(o,e,p,h,u,y),_=``},S=()=>{d||f!==null||(f=n.requestAnimationFrame?n.requestAnimationFrame(x):b.requestAnimationFrame?b.requestAnimationFrame(x):setTimeout(x,16))},C=i.createChartController({options:e.options,theme:e.theme,measureText:v,onInvalidate:S});C.setSize(c,l);let w=(e,t)=>({id:e.identifier??t,touch:!0});return{setOptions:e=>C.setOptions(e),setTheme:e=>C.setTheme(e),resize(e,t,n){c=e,l=t,n&&(u=n),C.setSize(e,t),S()},render(){f!==null&&(n.cancelAnimationFrame?n.cancelAnimationFrame(f):b.cancelAnimationFrame?b.cancelAnimationFrame(f):clearTimeout(f)),x()},touchStart(e){e.forEach((e,t)=>C.pointerDown(e.x,e.y,w(e,t)))},touchMove(e){e.forEach((e,t)=>C.pointerMove(e.x,e.y,w(e,t)))},touchEnd(e){e.forEach((e,t)=>C.pointerUp(e.x,e.y,w(e,t)))},touchCancel(e=[{x:0,y:0}]){e.forEach((e,t)=>C.pointerCancel(w(e,t)))},pointerDown:(e,t,n)=>C.pointerDown(e,t,n),pointerMove:(e,t,n)=>C.pointerMove(e,t,n),pointerUp:(e,t,n)=>C.pointerUp(e,t,n),pointerLeave:()=>C.pointerLeave(),zoomAt:(e,t,n)=>C.zoomAt(e,t,n),resetZoom:()=>C.resetZoom(),getView:()=>C.getView(),setView:e=>C.setView(e),toggleSeries:e=>C.toggleSeries(e),clearHover:()=>C.clearHover(),getPlotRect:()=>C.getPlotRect(),toPixel:(e,t)=>C.toPixel(e,t),fromPixel:(e,t)=>C.fromPixel(e,t),getController:()=>C,on:(e,t)=>C.on(e,t),destroy(){d||(d=!0,f!==null&&(n.cancelAnimationFrame?n.cancelAnimationFrame(f):b.cancelAnimationFrame?b.cancelAnimationFrame(f):clearTimeout(f)),y?.destroy(),C.destroy())}}};exports.createCanvasChart=c,exports.drawScene=s;
|
|
2
|
+
//# sourceMappingURL=canvas.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.cjs","names":["createCanvas2dPainter","font","toCss","buildItems","createChartController","require_color","require_items","require_overlay","require_canvas2d","require_controller","mid","r","roundedRect","ctx","x","y","w","h","drawScene","scene","layout","dpr","pixelRatio","width","height","model","theme","e","cy","scale","s","range","offset","o","reverse","xScale","xOffset","view","origin","yScale","yOffset","painter","items","plot","label","box","hover","cx","mark","d","tip","padding","lineHeight","left","right","line","content","row","createCanvasChart","config","canvas","destroyed","frameId","itemsModel","version","fontSet","measureText","f","text","g","render","controller","pw","ph","schedule","touchOptions","t","i","ratio","touches","v","id","type","listener"],"sources":["../../../../charts/src/engine/canvas.ts"],"sourcesContent":["// createCanvasChart: a whole chart drawn on one 2D canvas without any DOM:\n// WeChat / Alipay / ByteDance mini-programs (`<canvas type=\"2d\">`), Taro,\n// uni-app, OffscreenCanvas, or a plain browser canvas. The host forwards\n// touches / pointer events; everything else is handled here.\n\nimport { toCss } from \"./color\";\nimport {\n createChartController,\n type ChartController,\n type ChartControllerEventMap,\n type ChartPointerOptions,\n type ChartScene,\n} from \"./controller\";\nimport { buildItems, type Origin } from \"./items\";\nimport { drawBackground, drawForeground, font } from \"./overlay\";\nimport { createCanvas2dPainter } from \"./renderers/canvas2d\";\nimport type { RenderItem } from \"./renderers/types\";\nimport type { ChartThemeInput } from \"./theme\";\nimport type { ChartOptions, ChartRect, ChartView } from \"./types\";\n\n/**\n * The canvas a chart draws on: a browser `HTMLCanvasElement`, an\n * `OffscreenCanvas` or the node of a mini-program `<canvas type=\"2d\">`\n * (`SelectorQuery.fields({ node: true })`)\n */\nexport interface ChartCanvas {\n width: number;\n height: number;\n getContext(type: \"2d\"): unknown;\n /** Mini-program canvases schedule their frames themselves */\n requestAnimationFrame?: (callback: () => void) => number;\n cancelAnimationFrame?: (id: number) => void;\n}\n\n/** A touch point relative to the canvas (`x` / `y`) with its identifier */\nexport interface ChartTouch {\n x: number;\n y: number;\n identifier?: number;\n}\n\nexport interface CanvasChartConfig {\n canvas: ChartCanvas;\n /** Size of the canvas in CSS pixels (rpx converted by the host) */\n width: number;\n height: number;\n /**\n * Device pixel ratio (`wx.getWindowInfo().pixelRatio` in mini-programs)\n * @default 1\n */\n pixelRatio?: number;\n options: ChartOptions;\n /** Colors and fonts: values of the Minerva CSS variables */\n theme?: ChartThemeInput;\n}\n\nexport interface CanvasChartInstance {\n setOptions(options: ChartOptions): void;\n setTheme(theme: ChartThemeInput | undefined): void;\n /** New CSS size (and pixel ratio) of the canvas */\n resize(width: number, height: number, pixelRatio?: number): void;\n /** Draws now (frames are otherwise scheduled automatically) */\n render(): void;\n /** Touch handlers: pass the `touches` / `changedTouches` of the event */\n touchStart(touches: readonly ChartTouch[]): void;\n touchMove(touches: readonly ChartTouch[]): void;\n touchEnd(changedTouches: readonly ChartTouch[]): void;\n touchCancel(changedTouches?: readonly ChartTouch[]): void;\n /** Mouse / pen handlers (H5, desktop mini-programs) */\n pointerDown(x: number, y: number, options?: ChartPointerOptions): void;\n pointerMove(x: number, y: number, options?: ChartPointerOptions): void;\n pointerUp(x: number, y: number, options?: ChartPointerOptions): void;\n pointerLeave(): void;\n /** Zooms around a pixel (factor < 1 zooms in) */\n zoomAt(x: number, y: number, factor: number): void;\n resetZoom(): void;\n getView(): ChartView;\n setView(view: Partial<ChartView>): void;\n toggleSeries(id: string): void;\n clearHover(): void;\n getPlotRect(): ChartRect | null;\n toPixel(x: number, y: number): { x: number; y: number } | null;\n fromPixel(x: number, y: number): { x: number; y: number } | null;\n /** The platform-free controller (scene, gestures) */\n getController(): ChartController;\n on<K extends keyof ChartControllerEventMap>(\n type: K,\n listener: (event: ChartControllerEventMap[K]) => void,\n ): () => void;\n destroy(): void;\n}\n\nconst mid = (r: [number, number]) => (r[0] + r[1]) / 2;\n\nconst roundedRect = (\n ctx: CanvasRenderingContext2D,\n x: number,\n y: number,\n w: number,\n h: number,\n r: number,\n) => {\n ctx.beginPath();\n ctx.moveTo(x + r, y);\n ctx.lineTo(x + w - r, y);\n ctx.arcTo(x + w, y, x + w, y + r, r);\n ctx.lineTo(x + w, y + h - r);\n ctx.arcTo(x + w, y + h, x + w - r, y + h, r);\n ctx.lineTo(x + r, y + h);\n ctx.arcTo(x, y + h, x, y + h - r, r);\n ctx.lineTo(x, y + r);\n ctx.arcTo(x, y, x + r, y, r);\n ctx.closePath();\n};\n\n/** Draws a scene (legend, axes, data, labels, hover) on a 2D context */\nexport const drawScene = (\n ctx: CanvasRenderingContext2D,\n scene: ChartScene,\n items: readonly RenderItem[],\n origin: Origin,\n pixelRatio: number,\n painter = createCanvas2dPainter(ctx),\n) => {\n const { width, height, theme, model, view, layout } = scene;\n const { plot, scales } = layout;\n const dpr = pixelRatio;\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.clearRect(0, 0, Math.ceil(width * dpr), Math.ceil(height * dpr));\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n drawBackground(ctx, {\n width,\n height,\n scales,\n x: model.x,\n y: model.y,\n xTicks: layout.xTicks,\n yTicks: layout.yTicks,\n theme,\n annotations: scene.annotations,\n });\n\n // legend\n if (scene.legend) {\n ctx.font = font(theme, 12);\n ctx.textBaseline = \"middle\";\n ctx.textAlign = \"left\";\n for (const e of scene.legend.entries) {\n const cy = e.box.y + e.box.height / 2;\n ctx.globalAlpha = e.hidden ? 0.45 : 1;\n ctx.fillStyle = e.color;\n if (e.shape === \"dot\") {\n ctx.beginPath();\n ctx.arc(e.box.x + 5, cy, 4, 0, Math.PI * 2);\n ctx.fill();\n } else if (e.shape === \"line\") {\n ctx.fillRect(e.box.x, cy - 1, 10, 2);\n } else {\n ctx.fillRect(e.box.x + 1, cy - 4, 8, 8);\n }\n ctx.fillStyle = toCss(theme.textMuted);\n ctx.fillText(e.name, e.box.x + 14, cy);\n if (e.hidden) {\n const w = e.box.width - 22;\n ctx.fillRect(e.box.x + 14, cy, w, 1);\n }\n }\n ctx.globalAlpha = 1;\n }\n\n // data\n const scale = (range: [number, number], o: number, reverse: boolean) => {\n const s = 2 / (range[1] - range[0]);\n const offset = (o - range[0]) * s - 1;\n return reverse ? [-s, -offset] : [s, offset];\n };\n const [xScale, xOffset] = scale(view.x, origin.x, model.x.reverse);\n const [yScale, yOffset] = scale(view.y, origin.y, model.y.reverse);\n painter.paint(\n items,\n {\n transform: { xScale, xOffset, yScale, yOffset },\n width: Math.max(1, Math.round(plot.width * dpr)),\n height: Math.max(1, Math.round(plot.height * dpr)),\n dpr,\n },\n Math.round(plot.x * dpr),\n Math.round(plot.y * dpr),\n );\n\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n drawForeground(ctx, {\n width,\n height,\n scales,\n theme,\n annotations: scene.annotations,\n pointLabels: [],\n clear: false,\n });\n // dot labels placed by the scene\n if (scene.pointLabels.length) {\n ctx.save();\n ctx.font = font(theme);\n ctx.textAlign = \"left\";\n ctx.textBaseline = \"middle\";\n ctx.lineWidth = 3;\n ctx.lineJoin = \"round\";\n ctx.strokeStyle = toCss(theme.background, 0.9);\n ctx.fillStyle = toCss(theme.text, 0.85);\n for (const { label, box } of scene.pointLabels) {\n ctx.strokeText(label.text, box.x, box.y + box.height / 2);\n ctx.fillText(label.text, box.x, box.y + box.height / 2);\n }\n ctx.restore();\n }\n\n // hover\n const hover = scene.hover;\n if (hover) {\n if (hover.crosshairX !== null) {\n ctx.save();\n ctx.strokeStyle = toCss(theme.textMuted, 0.55);\n ctx.lineWidth = 1;\n ctx.setLineDash([3, 3]);\n ctx.beginPath();\n const cx = Math.round(hover.crosshairX) + 0.5;\n ctx.moveTo(cx, plot.y);\n ctx.lineTo(cx, plot.y + plot.height);\n ctx.stroke();\n ctx.restore();\n }\n for (const mark of hover.marks) {\n if (mark.kind === \"bar\") {\n ctx.fillStyle = toCss(theme.text, 0.08);\n ctx.fillRect(mark.x - 2, mark.y - 2, mark.width + 4, mark.height + 2);\n continue;\n }\n ctx.beginPath();\n ctx.arc(mark.x, mark.y, mark.size / 2, 0, Math.PI * 2);\n ctx.fillStyle = mark.color;\n ctx.fill();\n ctx.lineWidth = 2;\n ctx.strokeStyle = toCss(theme.background);\n ctx.stroke();\n }\n }\n if (scene.dragging) {\n const d = scene.dragging;\n ctx.beginPath();\n ctx.arc(d.x, d.y, d.size / 2, 0, Math.PI * 2);\n ctx.fillStyle = d.color;\n ctx.globalAlpha = 0.85;\n ctx.fill();\n ctx.globalAlpha = 1;\n ctx.lineWidth = 2;\n ctx.strokeStyle = toCss(theme.background);\n ctx.stroke();\n }\n const tip = hover?.tooltip;\n if (tip) {\n const { box, lineHeight, padding } = tip;\n ctx.save();\n ctx.shadowColor = \"rgba(15, 23, 42, 0.18)\";\n ctx.shadowBlur = 16;\n ctx.shadowOffsetY = 6;\n roundedRect(ctx, box.x, box.y, box.width, box.height, 8);\n ctx.fillStyle = toCss(theme.background);\n ctx.fill();\n ctx.restore();\n roundedRect(\n ctx,\n box.x + 0.5,\n box.y + 0.5,\n box.width - 1,\n box.height - 1,\n 8,\n );\n ctx.strokeStyle = toCss(theme.axis);\n ctx.lineWidth = 1;\n ctx.stroke();\n ctx.textBaseline = \"middle\";\n let y = box.y + padding + lineHeight / 2;\n const left = box.x + padding + 2;\n const right = box.x + box.width - padding - 2;\n if (tip.text) {\n ctx.font = font(theme, 12);\n ctx.fillStyle = toCss(theme.text);\n ctx.textAlign = \"left\";\n for (const line of tip.text) {\n ctx.fillText(line, left, y);\n y += lineHeight;\n }\n } else {\n const { content } = tip;\n let x = left;\n if (content.titleColor) {\n ctx.fillStyle = content.titleColor;\n ctx.beginPath();\n ctx.arc(x + 4, y, 4, 0, Math.PI * 2);\n ctx.fill();\n x += 14;\n }\n ctx.font = font(theme, 12, 600);\n ctx.fillStyle = toCss(theme.text);\n ctx.textAlign = \"left\";\n ctx.fillText(content.title, x, y);\n y += lineHeight;\n for (const row of content.rows) {\n x = left;\n if (row.color) {\n ctx.fillStyle = row.color;\n ctx.beginPath();\n ctx.arc(x + 4, y, 4, 0, Math.PI * 2);\n ctx.fill();\n x += 14;\n }\n ctx.font = font(theme, 12);\n ctx.textAlign = \"left\";\n ctx.fillStyle = toCss(theme.textMuted);\n ctx.fillText(row.name, x, y);\n ctx.font = font(theme, 12, 600);\n ctx.textAlign = \"right\";\n ctx.fillStyle = toCss(theme.text);\n ctx.fillText(row.value, right, y);\n y += lineHeight;\n }\n }\n }\n};\n\n/**\n * Creates a chart drawn on a 2D canvas: line, area, bar and scatter series,\n * annotations, legend and tooltip, tap / drag / pinch gestures. Works\n * without a DOM (mini-programs); see `createChart` for the GPU version of\n * the web.\n */\nexport const createCanvasChart = (\n config: CanvasChartConfig,\n): CanvasChartInstance => {\n const { canvas } = config;\n const ctx = canvas.getContext(\"2d\") as CanvasRenderingContext2D | null;\n let width = config.width;\n let height = config.height;\n let dpr = config.pixelRatio ?? 1;\n let destroyed = false;\n let frameId: number | null = null;\n let items: RenderItem[] = [];\n let itemsModel: unknown = null;\n let origin: Origin = { x: 0, y: 0 };\n let version = 0;\n let fontSet = \"\";\n\n const measureText = (text: string, f: string) => {\n if (!ctx) return text.length * 6.5;\n if (f !== fontSet) {\n ctx.font = f;\n fontSet = f;\n }\n return ctx.measureText(text).width;\n };\n\n const painter = ctx ? createCanvas2dPainter(ctx) : null;\n\n const g = globalThis as {\n requestAnimationFrame?: (cb: () => void) => number;\n cancelAnimationFrame?: (id: number) => void;\n };\n\n const render = () => {\n frameId = null;\n if (destroyed || !ctx || !painter) return;\n const scene = controller.getScene();\n if (!scene) return;\n const pw = Math.max(1, Math.round(width * dpr));\n const ph = Math.max(1, Math.round(height * dpr));\n if (canvas.width !== pw) canvas.width = pw;\n if (canvas.height !== ph) canvas.height = ph;\n fontSet = \"\";\n if (itemsModel !== scene.model) {\n itemsModel = scene.model;\n origin = { x: mid(scene.model.base.x), y: mid(scene.model.base.y) };\n items = buildItems(scene.model, origin, ++version);\n }\n drawScene(ctx, scene, items, origin, dpr, painter);\n fontSet = \"\";\n };\n\n const schedule = () => {\n if (destroyed || frameId !== null) return;\n if (canvas.requestAnimationFrame)\n frameId = canvas.requestAnimationFrame(render);\n else if (g.requestAnimationFrame) frameId = g.requestAnimationFrame(render);\n else frameId = setTimeout(render, 16) as unknown as number;\n };\n\n const controller = createChartController({\n options: config.options,\n theme: config.theme,\n measureText,\n onInvalidate: schedule,\n });\n controller.setSize(width, height);\n\n const touchOptions = (t: ChartTouch, i: number): ChartPointerOptions => ({\n id: t.identifier ?? i,\n touch: true,\n });\n\n return {\n setOptions: (o) => controller.setOptions(o),\n setTheme: (t) => controller.setTheme(t),\n resize(w, h, ratio) {\n width = w;\n height = h;\n if (ratio) dpr = ratio;\n controller.setSize(w, h);\n schedule();\n },\n render() {\n if (frameId !== null) {\n if (canvas.cancelAnimationFrame) canvas.cancelAnimationFrame(frameId);\n else if (g.cancelAnimationFrame) g.cancelAnimationFrame(frameId);\n else clearTimeout(frameId);\n }\n render();\n },\n touchStart(touches) {\n touches.forEach((t, i) =>\n controller.pointerDown(t.x, t.y, touchOptions(t, i)),\n );\n },\n touchMove(touches) {\n touches.forEach((t, i) =>\n controller.pointerMove(t.x, t.y, touchOptions(t, i)),\n );\n },\n touchEnd(touches) {\n touches.forEach((t, i) =>\n controller.pointerUp(t.x, t.y, touchOptions(t, i)),\n );\n },\n touchCancel(touches = [{ x: 0, y: 0 }]) {\n touches.forEach((t, i) => controller.pointerCancel(touchOptions(t, i)));\n },\n pointerDown: (x, y, o) => controller.pointerDown(x, y, o),\n pointerMove: (x, y, o) => controller.pointerMove(x, y, o),\n pointerUp: (x, y, o) => controller.pointerUp(x, y, o),\n pointerLeave: () => controller.pointerLeave(),\n zoomAt: (x, y, f) => controller.zoomAt(x, y, f),\n resetZoom: () => controller.resetZoom(),\n getView: () => controller.getView(),\n setView: (v) => controller.setView(v),\n toggleSeries: (id) => controller.toggleSeries(id),\n clearHover: () => controller.clearHover(),\n getPlotRect: () => controller.getPlotRect(),\n toPixel: (x, y) => controller.toPixel(x, y),\n fromPixel: (x, y) => controller.fromPixel(x, y),\n getController: () => controller,\n on: (type, listener) => controller.on(type, listener),\n destroy() {\n if (destroyed) return;\n destroyed = true;\n if (frameId !== null) {\n if (canvas.cancelAnimationFrame) canvas.cancelAnimationFrame(frameId);\n else if (g.cancelAnimationFrame) g.cancelAnimationFrame(frameId);\n else clearTimeout(frameId);\n }\n painter?.destroy();\n controller.destroy();\n },\n };\n};\n"],"mappings":"uJA4FA,IAAMU,EAAO,IAAyBC,EAAE,GAAKA,EAAE,IAAM,EAE/CC,GACJ,EACA,EACA,EACA,EACA,EACA,IACG,CACHC,EAAI,UAAU,EACdA,EAAI,OAAOC,EAAIH,EAAGI,CAAC,EACnBF,E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YAAY,EAAU,CAAC,CAAE,EAAG,EAAG,EAAG,CAAE,CAAC,EAAG,CACtCE,EAAQ,SAAS,EAAG,IAAMR,EAAW,cAAcI,EAAaC,EAAGC,CAAC,CAAC,CAAC,CACxE,EACA,aAAc,EAAG,EAAG,IAAMN,EAAW,YAAYzD,EAAGC,EAAGkB,CAAC,EACxD,aAAc,EAAG,EAAG,IAAMsC,EAAW,YAAYzD,EAAGC,EAAGkB,CAAC,EACxD,WAAY,EAAG,EAAG,IAAMsC,EAAW,UAAUzD,EAAGC,EAAGkB,CAAC,EACpD,iBAAoBsC,EAAW,aAAa,EAC5C,QAAS,EAAG,EAAG,IAAMA,EAAW,OAAOzD,EAAGC,EAAGoD,CAAC,EAC9C,cAAiBI,EAAW,UAAU,EACtC,YAAeA,EAAW,QAAQ,EAClC,QAAU,GAAMA,EAAW,QAAQS,CAAC,EACpC,aAAe,GAAOT,EAAW,aAAaU,CAAE,EAChD,eAAkBV,EAAW,WAAW,EACxC,gBAAmBA,EAAW,YAAY,EAC1C,SAAU,EAAG,IAAMA,EAAW,QAAQzD,EAAGC,CAAC,EAC1C,WAAY,EAAG,IAAMwD,EAAW,UAAUzD,EAAGC,CAAC,EAC9C,kBAAqBwD,EACrB,IAAK,EAAM,IAAaA,EAAW,GAAGW,EAAMC,CAAQ,EACpD,SAAU,CACJtB,IACJ,EAAY,GACRC,IAAY,OACVF,EAAO,qBAAsBA,EAAO,qBAAqBE,CAAO,EAC3DO,EAAE,qBAAsBA,EAAE,qBAAqBP,CAAO,EAC1D,aAAaA,CAAO,GAE3BrB,GAAS,QAAQ,EACjB8B,EAAW,QAAQ,EACrB,CACF,CACF"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ChartController, ChartControllerEventMap, ChartPointerOptions, ChartScene } from './controller.cjs';
|
|
2
|
+
import { Origin } from './items.cjs';
|
|
3
|
+
import { RenderItem } from './renderers/types.cjs';
|
|
4
|
+
import { ChartThemeInput } from './theme.cjs';
|
|
5
|
+
import { ChartOptions, ChartRect, ChartView } from './types.cjs';
|
|
6
|
+
/**
|
|
7
|
+
* The canvas a chart draws on: a browser `HTMLCanvasElement`, an
|
|
8
|
+
* `OffscreenCanvas` or the node of a mini-program `<canvas type="2d">`
|
|
9
|
+
* (`SelectorQuery.fields({ node: true })`)
|
|
10
|
+
*/
|
|
11
|
+
export interface ChartCanvas {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
getContext(type: "2d"): unknown;
|
|
15
|
+
/** Mini-program canvases schedule their frames themselves */
|
|
16
|
+
requestAnimationFrame?: (callback: () => void) => number;
|
|
17
|
+
cancelAnimationFrame?: (id: number) => void;
|
|
18
|
+
}
|
|
19
|
+
/** A touch point relative to the canvas (`x` / `y`) with its identifier */
|
|
20
|
+
export interface ChartTouch {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
identifier?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface CanvasChartConfig {
|
|
26
|
+
canvas: ChartCanvas;
|
|
27
|
+
/** Size of the canvas in CSS pixels (rpx converted by the host) */
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
/**
|
|
31
|
+
* Device pixel ratio (`wx.getWindowInfo().pixelRatio` in mini-programs)
|
|
32
|
+
* @default 1
|
|
33
|
+
*/
|
|
34
|
+
pixelRatio?: number;
|
|
35
|
+
options: ChartOptions;
|
|
36
|
+
/** Colors and fonts: values of the Minerva CSS variables */
|
|
37
|
+
theme?: ChartThemeInput;
|
|
38
|
+
}
|
|
39
|
+
export interface CanvasChartInstance {
|
|
40
|
+
setOptions(options: ChartOptions): void;
|
|
41
|
+
setTheme(theme: ChartThemeInput | undefined): void;
|
|
42
|
+
/** New CSS size (and pixel ratio) of the canvas */
|
|
43
|
+
resize(width: number, height: number, pixelRatio?: number): void;
|
|
44
|
+
/** Draws now (frames are otherwise scheduled automatically) */
|
|
45
|
+
render(): void;
|
|
46
|
+
/** Touch handlers: pass the `touches` / `changedTouches` of the event */
|
|
47
|
+
touchStart(touches: readonly ChartTouch[]): void;
|
|
48
|
+
touchMove(touches: readonly ChartTouch[]): void;
|
|
49
|
+
touchEnd(changedTouches: readonly ChartTouch[]): void;
|
|
50
|
+
touchCancel(changedTouches?: readonly ChartTouch[]): void;
|
|
51
|
+
/** Mouse / pen handlers (H5, desktop mini-programs) */
|
|
52
|
+
pointerDown(x: number, y: number, options?: ChartPointerOptions): void;
|
|
53
|
+
pointerMove(x: number, y: number, options?: ChartPointerOptions): void;
|
|
54
|
+
pointerUp(x: number, y: number, options?: ChartPointerOptions): void;
|
|
55
|
+
pointerLeave(): void;
|
|
56
|
+
/** Zooms around a pixel (factor < 1 zooms in) */
|
|
57
|
+
zoomAt(x: number, y: number, factor: number): void;
|
|
58
|
+
resetZoom(): void;
|
|
59
|
+
getView(): ChartView;
|
|
60
|
+
setView(view: Partial<ChartView>): void;
|
|
61
|
+
toggleSeries(id: string): void;
|
|
62
|
+
clearHover(): void;
|
|
63
|
+
getPlotRect(): ChartRect | null;
|
|
64
|
+
toPixel(x: number, y: number): {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
} | null;
|
|
68
|
+
fromPixel(x: number, y: number): {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
} | null;
|
|
72
|
+
/** The platform-free controller (scene, gestures) */
|
|
73
|
+
getController(): ChartController;
|
|
74
|
+
on<K extends keyof ChartControllerEventMap>(type: K, listener: (event: ChartControllerEventMap[K]) => void): () => void;
|
|
75
|
+
destroy(): void;
|
|
76
|
+
}
|
|
77
|
+
/** Draws a scene (legend, axes, data, labels, hover) on a 2D context */
|
|
78
|
+
export declare const drawScene: (ctx: CanvasRenderingContext2D, scene: ChartScene, items: readonly RenderItem[], origin: Origin, pixelRatio: number, painter?: import('./renderers/canvas2d.cjs').Canvas2dPainter) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Creates a chart drawn on a 2D canvas: line, area, bar and scatter series,
|
|
81
|
+
* annotations, legend and tooltip, tap / drag / pinch gestures. Works
|
|
82
|
+
* without a DOM (mini-programs); see `createChart` for the GPU version of
|
|
83
|
+
* the web.
|
|
84
|
+
*/
|
|
85
|
+
export declare const createCanvasChart: (config: CanvasChartConfig) => CanvasChartInstance;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ChartController, ChartControllerEventMap, ChartPointerOptions, ChartScene } from './controller.js';
|
|
2
|
+
import { Origin } from './items.js';
|
|
3
|
+
import { RenderItem } from './renderers/types.js';
|
|
4
|
+
import { ChartThemeInput } from './theme.js';
|
|
5
|
+
import { ChartOptions, ChartRect, ChartView } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* The canvas a chart draws on: a browser `HTMLCanvasElement`, an
|
|
8
|
+
* `OffscreenCanvas` or the node of a mini-program `<canvas type="2d">`
|
|
9
|
+
* (`SelectorQuery.fields({ node: true })`)
|
|
10
|
+
*/
|
|
11
|
+
export interface ChartCanvas {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
getContext(type: "2d"): unknown;
|
|
15
|
+
/** Mini-program canvases schedule their frames themselves */
|
|
16
|
+
requestAnimationFrame?: (callback: () => void) => number;
|
|
17
|
+
cancelAnimationFrame?: (id: number) => void;
|
|
18
|
+
}
|
|
19
|
+
/** A touch point relative to the canvas (`x` / `y`) with its identifier */
|
|
20
|
+
export interface ChartTouch {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
identifier?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface CanvasChartConfig {
|
|
26
|
+
canvas: ChartCanvas;
|
|
27
|
+
/** Size of the canvas in CSS pixels (rpx converted by the host) */
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
/**
|
|
31
|
+
* Device pixel ratio (`wx.getWindowInfo().pixelRatio` in mini-programs)
|
|
32
|
+
* @default 1
|
|
33
|
+
*/
|
|
34
|
+
pixelRatio?: number;
|
|
35
|
+
options: ChartOptions;
|
|
36
|
+
/** Colors and fonts: values of the Minerva CSS variables */
|
|
37
|
+
theme?: ChartThemeInput;
|
|
38
|
+
}
|
|
39
|
+
export interface CanvasChartInstance {
|
|
40
|
+
setOptions(options: ChartOptions): void;
|
|
41
|
+
setTheme(theme: ChartThemeInput | undefined): void;
|
|
42
|
+
/** New CSS size (and pixel ratio) of the canvas */
|
|
43
|
+
resize(width: number, height: number, pixelRatio?: number): void;
|
|
44
|
+
/** Draws now (frames are otherwise scheduled automatically) */
|
|
45
|
+
render(): void;
|
|
46
|
+
/** Touch handlers: pass the `touches` / `changedTouches` of the event */
|
|
47
|
+
touchStart(touches: readonly ChartTouch[]): void;
|
|
48
|
+
touchMove(touches: readonly ChartTouch[]): void;
|
|
49
|
+
touchEnd(changedTouches: readonly ChartTouch[]): void;
|
|
50
|
+
touchCancel(changedTouches?: readonly ChartTouch[]): void;
|
|
51
|
+
/** Mouse / pen handlers (H5, desktop mini-programs) */
|
|
52
|
+
pointerDown(x: number, y: number, options?: ChartPointerOptions): void;
|
|
53
|
+
pointerMove(x: number, y: number, options?: ChartPointerOptions): void;
|
|
54
|
+
pointerUp(x: number, y: number, options?: ChartPointerOptions): void;
|
|
55
|
+
pointerLeave(): void;
|
|
56
|
+
/** Zooms around a pixel (factor < 1 zooms in) */
|
|
57
|
+
zoomAt(x: number, y: number, factor: number): void;
|
|
58
|
+
resetZoom(): void;
|
|
59
|
+
getView(): ChartView;
|
|
60
|
+
setView(view: Partial<ChartView>): void;
|
|
61
|
+
toggleSeries(id: string): void;
|
|
62
|
+
clearHover(): void;
|
|
63
|
+
getPlotRect(): ChartRect | null;
|
|
64
|
+
toPixel(x: number, y: number): {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
} | null;
|
|
68
|
+
fromPixel(x: number, y: number): {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
} | null;
|
|
72
|
+
/** The platform-free controller (scene, gestures) */
|
|
73
|
+
getController(): ChartController;
|
|
74
|
+
on<K extends keyof ChartControllerEventMap>(type: K, listener: (event: ChartControllerEventMap[K]) => void): () => void;
|
|
75
|
+
destroy(): void;
|
|
76
|
+
}
|
|
77
|
+
/** Draws a scene (legend, axes, data, labels, hover) on a 2D context */
|
|
78
|
+
export declare const drawScene: (ctx: CanvasRenderingContext2D, scene: ChartScene, items: readonly RenderItem[], origin: Origin, pixelRatio: number, painter?: import('./renderers/canvas2d.js').Canvas2dPainter) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Creates a chart drawn on a 2D canvas: line, area, bar and scatter series,
|
|
81
|
+
* annotations, legend and tooltip, tap / drag / pinch gestures. Works
|
|
82
|
+
* without a DOM (mini-programs); see `createChart` for the GPU version of
|
|
83
|
+
* the web.
|
|
84
|
+
*/
|
|
85
|
+
export declare const createCanvasChart: (config: CanvasChartConfig) => CanvasChartInstance;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { toCss as e } from "./color.js";
|
|
2
|
+
import { buildItems as t } from "./items.js";
|
|
3
|
+
import { drawBackground as n, drawForeground as r, font as i } from "./overlay.js";
|
|
4
|
+
import { createCanvas2dPainter as a } from "./renderers/canvas2d.js";
|
|
5
|
+
import { createChartController as o } from "./controller.js";
|
|
6
|
+
//#region src/engine/canvas.ts
|
|
7
|
+
var s = (e) => (e[0] + e[1]) / 2, c = (e, t, n, r, i, a) => {
|
|
8
|
+
e.beginPath(), e.moveTo(t + a, n), e.lineTo(t + r - a, n), e.arcTo(t + r, n, t + r, n + a, a), e.lineTo(t + r, n + i - a), e.arcTo(t + r, n + i, t + r - a, n + i, a), e.lineTo(t + a, n + i), e.arcTo(t, n + i, t, n + i - a, a), e.lineTo(t, n + a), e.arcTo(t, n, t + a, n, a), e.closePath();
|
|
9
|
+
}, l = (t, o, s, l, u, d = a(t)) => {
|
|
10
|
+
let { width: f, height: p, theme: m, model: h, view: g, layout: _ } = o, { plot: v, scales: y } = _, b = u;
|
|
11
|
+
if (t.setTransform(1, 0, 0, 1, 0, 0), t.clearRect(0, 0, Math.ceil(f * b), Math.ceil(p * b)), t.setTransform(b, 0, 0, b, 0, 0), n(t, {
|
|
12
|
+
width: f,
|
|
13
|
+
height: p,
|
|
14
|
+
scales: y,
|
|
15
|
+
x: h.x,
|
|
16
|
+
y: h.y,
|
|
17
|
+
xTicks: _.xTicks,
|
|
18
|
+
yTicks: _.yTicks,
|
|
19
|
+
theme: m,
|
|
20
|
+
annotations: o.annotations
|
|
21
|
+
}), o.legend) {
|
|
22
|
+
t.font = i(m, 12), t.textBaseline = "middle", t.textAlign = "left";
|
|
23
|
+
for (let n of o.legend.entries) {
|
|
24
|
+
let r = n.box.y + n.box.height / 2;
|
|
25
|
+
if (t.globalAlpha = n.hidden ? .45 : 1, t.fillStyle = n.color, n.shape === "dot" ? (t.beginPath(), t.arc(n.box.x + 5, r, 4, 0, Math.PI * 2), t.fill()) : n.shape === "line" ? t.fillRect(n.box.x, r - 1, 10, 2) : t.fillRect(n.box.x + 1, r - 4, 8, 8), t.fillStyle = e(m.textMuted), t.fillText(n.name, n.box.x + 14, r), n.hidden) {
|
|
26
|
+
let e = n.box.width - 22;
|
|
27
|
+
t.fillRect(n.box.x + 14, r, e, 1);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
t.globalAlpha = 1;
|
|
31
|
+
}
|
|
32
|
+
let x = (e, t, n) => {
|
|
33
|
+
let r = 2 / (e[1] - e[0]), i = (t - e[0]) * r - 1;
|
|
34
|
+
return n ? [-r, -i] : [r, i];
|
|
35
|
+
}, [S, C] = x(g.x, l.x, h.x.reverse), [w, T] = x(g.y, l.y, h.y.reverse);
|
|
36
|
+
if (d.paint(s, {
|
|
37
|
+
transform: {
|
|
38
|
+
xScale: S,
|
|
39
|
+
xOffset: C,
|
|
40
|
+
yScale: w,
|
|
41
|
+
yOffset: T
|
|
42
|
+
},
|
|
43
|
+
width: Math.max(1, Math.round(v.width * b)),
|
|
44
|
+
height: Math.max(1, Math.round(v.height * b)),
|
|
45
|
+
dpr: b
|
|
46
|
+
}, Math.round(v.x * b), Math.round(v.y * b)), t.setTransform(b, 0, 0, b, 0, 0), r(t, {
|
|
47
|
+
width: f,
|
|
48
|
+
height: p,
|
|
49
|
+
scales: y,
|
|
50
|
+
theme: m,
|
|
51
|
+
annotations: o.annotations,
|
|
52
|
+
pointLabels: [],
|
|
53
|
+
clear: !1
|
|
54
|
+
}), o.pointLabels.length) {
|
|
55
|
+
t.save(), t.font = i(m), t.textAlign = "left", t.textBaseline = "middle", t.lineWidth = 3, t.lineJoin = "round", t.strokeStyle = e(m.background, .9), t.fillStyle = e(m.text, .85);
|
|
56
|
+
for (let { label: e, box: n } of o.pointLabels) t.strokeText(e.text, n.x, n.y + n.height / 2), t.fillText(e.text, n.x, n.y + n.height / 2);
|
|
57
|
+
t.restore();
|
|
58
|
+
}
|
|
59
|
+
let E = o.hover;
|
|
60
|
+
if (E) {
|
|
61
|
+
if (E.crosshairX !== null) {
|
|
62
|
+
t.save(), t.strokeStyle = e(m.textMuted, .55), t.lineWidth = 1, t.setLineDash([3, 3]), t.beginPath();
|
|
63
|
+
let n = Math.round(E.crosshairX) + .5;
|
|
64
|
+
t.moveTo(n, v.y), t.lineTo(n, v.y + v.height), t.stroke(), t.restore();
|
|
65
|
+
}
|
|
66
|
+
for (let n of E.marks) {
|
|
67
|
+
if (n.kind === "bar") {
|
|
68
|
+
t.fillStyle = e(m.text, .08), t.fillRect(n.x - 2, n.y - 2, n.width + 4, n.height + 2);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
t.beginPath(), t.arc(n.x, n.y, n.size / 2, 0, Math.PI * 2), t.fillStyle = n.color, t.fill(), t.lineWidth = 2, t.strokeStyle = e(m.background), t.stroke();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (o.dragging) {
|
|
75
|
+
let n = o.dragging;
|
|
76
|
+
t.beginPath(), t.arc(n.x, n.y, n.size / 2, 0, Math.PI * 2), t.fillStyle = n.color, t.globalAlpha = .85, t.fill(), t.globalAlpha = 1, t.lineWidth = 2, t.strokeStyle = e(m.background), t.stroke();
|
|
77
|
+
}
|
|
78
|
+
let D = E?.tooltip;
|
|
79
|
+
if (D) {
|
|
80
|
+
let { box: n, lineHeight: r, padding: a } = D;
|
|
81
|
+
t.save(), t.shadowColor = "rgba(15, 23, 42, 0.18)", t.shadowBlur = 16, t.shadowOffsetY = 6, c(t, n.x, n.y, n.width, n.height, 8), t.fillStyle = e(m.background), t.fill(), t.restore(), c(t, n.x + .5, n.y + .5, n.width - 1, n.height - 1, 8), t.strokeStyle = e(m.axis), t.lineWidth = 1, t.stroke(), t.textBaseline = "middle";
|
|
82
|
+
let o = n.y + a + r / 2, s = n.x + a + 2, l = n.x + n.width - a - 2;
|
|
83
|
+
if (D.text) {
|
|
84
|
+
t.font = i(m, 12), t.fillStyle = e(m.text), t.textAlign = "left";
|
|
85
|
+
for (let e of D.text) t.fillText(e, s, o), o += r;
|
|
86
|
+
} else {
|
|
87
|
+
let { content: n } = D, a = s;
|
|
88
|
+
n.titleColor && (t.fillStyle = n.titleColor, t.beginPath(), t.arc(a + 4, o, 4, 0, Math.PI * 2), t.fill(), a += 14), t.font = i(m, 12, 600), t.fillStyle = e(m.text), t.textAlign = "left", t.fillText(n.title, a, o), o += r;
|
|
89
|
+
for (let c of n.rows) a = s, c.color && (t.fillStyle = c.color, t.beginPath(), t.arc(a + 4, o, 4, 0, Math.PI * 2), t.fill(), a += 14), t.font = i(m, 12), t.textAlign = "left", t.fillStyle = e(m.textMuted), t.fillText(c.name, a, o), t.font = i(m, 12, 600), t.textAlign = "right", t.fillStyle = e(m.text), t.fillText(c.value, l, o), o += r;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, u = (e) => {
|
|
93
|
+
let { canvas: n } = e, r = n.getContext("2d"), i = e.width, c = e.height, u = e.pixelRatio ?? 1, d = !1, f = null, p = [], m = null, h = {
|
|
94
|
+
x: 0,
|
|
95
|
+
y: 0
|
|
96
|
+
}, g = 0, _ = "", v = (e, t) => r ? (t !== _ && (r.font = t, _ = t), r.measureText(e).width) : e.length * 6.5, y = r ? a(r) : null, b = globalThis, x = () => {
|
|
97
|
+
if (f = null, d || !r || !y) return;
|
|
98
|
+
let e = C.getScene();
|
|
99
|
+
if (!e) return;
|
|
100
|
+
let a = Math.max(1, Math.round(i * u)), o = Math.max(1, Math.round(c * u));
|
|
101
|
+
n.width !== a && (n.width = a), n.height !== o && (n.height = o), _ = "", m !== e.model && (m = e.model, h = {
|
|
102
|
+
x: s(e.model.base.x),
|
|
103
|
+
y: s(e.model.base.y)
|
|
104
|
+
}, p = t(e.model, h, ++g)), l(r, e, p, h, u, y), _ = "";
|
|
105
|
+
}, S = () => {
|
|
106
|
+
d || f !== null || (f = n.requestAnimationFrame ? n.requestAnimationFrame(x) : b.requestAnimationFrame ? b.requestAnimationFrame(x) : setTimeout(x, 16));
|
|
107
|
+
}, C = o({
|
|
108
|
+
options: e.options,
|
|
109
|
+
theme: e.theme,
|
|
110
|
+
measureText: v,
|
|
111
|
+
onInvalidate: S
|
|
112
|
+
});
|
|
113
|
+
C.setSize(i, c);
|
|
114
|
+
let w = (e, t) => ({
|
|
115
|
+
id: e.identifier ?? t,
|
|
116
|
+
touch: !0
|
|
117
|
+
});
|
|
118
|
+
return {
|
|
119
|
+
setOptions: (e) => C.setOptions(e),
|
|
120
|
+
setTheme: (e) => C.setTheme(e),
|
|
121
|
+
resize(e, t, n) {
|
|
122
|
+
i = e, c = t, n && (u = n), C.setSize(e, t), S();
|
|
123
|
+
},
|
|
124
|
+
render() {
|
|
125
|
+
f !== null && (n.cancelAnimationFrame ? n.cancelAnimationFrame(f) : b.cancelAnimationFrame ? b.cancelAnimationFrame(f) : clearTimeout(f)), x();
|
|
126
|
+
},
|
|
127
|
+
touchStart(e) {
|
|
128
|
+
e.forEach((e, t) => C.pointerDown(e.x, e.y, w(e, t)));
|
|
129
|
+
},
|
|
130
|
+
touchMove(e) {
|
|
131
|
+
e.forEach((e, t) => C.pointerMove(e.x, e.y, w(e, t)));
|
|
132
|
+
},
|
|
133
|
+
touchEnd(e) {
|
|
134
|
+
e.forEach((e, t) => C.pointerUp(e.x, e.y, w(e, t)));
|
|
135
|
+
},
|
|
136
|
+
touchCancel(e = [{
|
|
137
|
+
x: 0,
|
|
138
|
+
y: 0
|
|
139
|
+
}]) {
|
|
140
|
+
e.forEach((e, t) => C.pointerCancel(w(e, t)));
|
|
141
|
+
},
|
|
142
|
+
pointerDown: (e, t, n) => C.pointerDown(e, t, n),
|
|
143
|
+
pointerMove: (e, t, n) => C.pointerMove(e, t, n),
|
|
144
|
+
pointerUp: (e, t, n) => C.pointerUp(e, t, n),
|
|
145
|
+
pointerLeave: () => C.pointerLeave(),
|
|
146
|
+
zoomAt: (e, t, n) => C.zoomAt(e, t, n),
|
|
147
|
+
resetZoom: () => C.resetZoom(),
|
|
148
|
+
getView: () => C.getView(),
|
|
149
|
+
setView: (e) => C.setView(e),
|
|
150
|
+
toggleSeries: (e) => C.toggleSeries(e),
|
|
151
|
+
clearHover: () => C.clearHover(),
|
|
152
|
+
getPlotRect: () => C.getPlotRect(),
|
|
153
|
+
toPixel: (e, t) => C.toPixel(e, t),
|
|
154
|
+
fromPixel: (e, t) => C.fromPixel(e, t),
|
|
155
|
+
getController: () => C,
|
|
156
|
+
on: (e, t) => C.on(e, t),
|
|
157
|
+
destroy() {
|
|
158
|
+
d || (d = !0, f !== null && (n.cancelAnimationFrame ? n.cancelAnimationFrame(f) : b.cancelAnimationFrame ? b.cancelAnimationFrame(f) : clearTimeout(f)), y?.destroy(), C.destroy());
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
//#endregion
|
|
163
|
+
export { u as createCanvasChart, l as drawScene };
|
|
164
|
+
|
|
165
|
+
//# sourceMappingURL=canvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.js","names":["mid","r","roundedRect","ctx","x","y","w","h","drawScene","createCanvas2dPainter","scene","layout","dpr","pixelRatio","width","height","drawBackground","model","font","theme","e","cy","toCss","scale","s","range","offset","o","reverse","xScale","xOffset","view","origin","yScale","yOffset","painter","items","plot","drawForeground","label","box","hover","cx","mark","d","tip","padding","lineHeight","left","right","line","content","row","createCanvasChart","config","canvas","destroyed","frameId","itemsModel","version","fontSet","measureText","f","text","g","render","controller","pw","ph","buildItems","schedule","createChartController","touchOptions","t","i","ratio","v","id","type","listener"],"sources":["../../../../charts/src/engine/canvas.ts"],"sourcesContent":["// createCanvasChart: a whole chart drawn on one 2D canvas without any DOM:\n// WeChat / Alipay / ByteDance mini-programs (`<canvas type=\"2d\">`), Taro,\n// uni-app, OffscreenCanvas, or a plain browser canvas. The host forwards\n// touches / pointer events; everything else is handled here.\n\nimport { toCss } from \"./color\";\nimport {\n createChartController,\n type ChartController,\n type ChartControllerEventMap,\n type ChartPointerOptions,\n type ChartScene,\n} from \"./controller\";\nimport { buildItems, type Origin } from \"./items\";\nimport { drawBackground, drawForeground, font } from \"./overlay\";\nimport { createCanvas2dPainter } from \"./renderers/canvas2d\";\nimport type { RenderItem } from \"./renderers/types\";\nimport type { ChartThemeInput } from \"./theme\";\nimport type { ChartOptions, ChartRect, ChartView } from \"./types\";\n\n/**\n * The canvas a chart draws on: a browser `HTMLCanvasElement`, an\n * `OffscreenCanvas` or the node of a mini-program `<canvas type=\"2d\">`\n * (`SelectorQuery.fields({ node: true })`)\n */\nexport interface ChartCanvas {\n width: number;\n height: number;\n getContext(type: \"2d\"): unknown;\n /** Mini-program canvases schedule their frames themselves */\n requestAnimationFrame?: (callback: () => void) => number;\n cancelAnimationFrame?: (id: number) => void;\n}\n\n/** A touch point relative to the canvas (`x` / `y`) with its identifier */\nexport interface ChartTouch {\n x: number;\n y: number;\n identifier?: number;\n}\n\nexport interface CanvasChartConfig {\n canvas: ChartCanvas;\n /** Size of the canvas in CSS pixels (rpx converted by the host) */\n width: number;\n height: number;\n /**\n * Device pixel ratio (`wx.getWindowInfo().pixelRatio` in mini-programs)\n * @default 1\n */\n pixelRatio?: number;\n options: ChartOptions;\n /** Colors and fonts: values of the Minerva CSS variables */\n theme?: ChartThemeInput;\n}\n\nexport interface CanvasChartInstance {\n setOptions(options: ChartOptions): void;\n setTheme(theme: ChartThemeInput | undefined): void;\n /** New CSS size (and pixel ratio) of the canvas */\n resize(width: number, height: number, pixelRatio?: number): void;\n /** Draws now (frames are otherwise scheduled automatically) */\n render(): void;\n /** Touch handlers: pass the `touches` / `changedTouches` of the event */\n touchStart(touches: readonly ChartTouch[]): void;\n touchMove(touches: readonly ChartTouch[]): void;\n touchEnd(changedTouches: readonly ChartTouch[]): void;\n touchCancel(changedTouches?: readonly ChartTouch[]): void;\n /** Mouse / pen handlers (H5, desktop mini-programs) */\n pointerDown(x: number, y: number, options?: ChartPointerOptions): void;\n pointerMove(x: number, y: number, options?: ChartPointerOptions): void;\n pointerUp(x: number, y: number, options?: ChartPointerOptions): void;\n pointerLeave(): void;\n /** Zooms around a pixel (factor < 1 zooms in) */\n zoomAt(x: number, y: number, factor: number): void;\n resetZoom(): void;\n getView(): ChartView;\n setView(view: Partial<ChartView>): void;\n toggleSeries(id: string): void;\n clearHover(): void;\n getPlotRect(): ChartRect | null;\n toPixel(x: number, y: number): { x: number; y: number } | null;\n fromPixel(x: number, y: number): { x: number; y: number } | null;\n /** The platform-free controller (scene, gestures) */\n getController(): ChartController;\n on<K extends keyof ChartControllerEventMap>(\n type: K,\n listener: (event: ChartControllerEventMap[K]) => void,\n ): () => void;\n destroy(): void;\n}\n\nconst mid = (r: [number, number]) => (r[0] + r[1]) / 2;\n\nconst roundedRect = (\n ctx: CanvasRenderingContext2D,\n x: number,\n y: number,\n w: number,\n h: number,\n r: number,\n) => {\n ctx.beginPath();\n ctx.moveTo(x + r, y);\n ctx.lineTo(x + w - r, y);\n ctx.arcTo(x + w, y, x + w, y + r, r);\n ctx.lineTo(x + w, y + h - r);\n ctx.arcTo(x + w, y + h, x + w - r, y + h, r);\n ctx.lineTo(x + r, y + h);\n ctx.arcTo(x, y + h, x, y + h - r, r);\n ctx.lineTo(x, y + r);\n ctx.arcTo(x, y, x + r, y, r);\n ctx.closePath();\n};\n\n/** Draws a scene (legend, axes, data, labels, hover) on a 2D context */\nexport const drawScene = (\n ctx: CanvasRenderingContext2D,\n scene: ChartScene,\n items: readonly RenderItem[],\n origin: Origin,\n pixelRatio: number,\n painter = createCanvas2dPainter(ctx),\n) => {\n const { width, height, theme, model, view, layout } = scene;\n const { plot, scales } = layout;\n const dpr = pixelRatio;\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.clearRect(0, 0, Math.ceil(width * dpr), Math.ceil(height * dpr));\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n drawBackground(ctx, {\n width,\n height,\n scales,\n x: model.x,\n y: model.y,\n xTicks: layout.xTicks,\n yTicks: layout.yTicks,\n theme,\n annotations: scene.annotations,\n });\n\n // legend\n if (scene.legend) {\n ctx.font = font(theme, 12);\n ctx.textBaseline = \"middle\";\n ctx.textAlign = \"left\";\n for (const e of scene.legend.entries) {\n const cy = e.box.y + e.box.height / 2;\n ctx.globalAlpha = e.hidden ? 0.45 : 1;\n ctx.fillStyle = e.color;\n if (e.shape === \"dot\") {\n ctx.beginPath();\n ctx.arc(e.box.x + 5, cy, 4, 0, Math.PI * 2);\n ctx.fill();\n } else if (e.shape === \"line\") {\n ctx.fillRect(e.box.x, cy - 1, 10, 2);\n } else {\n ctx.fillRect(e.box.x + 1, cy - 4, 8, 8);\n }\n ctx.fillStyle = toCss(theme.textMuted);\n ctx.fillText(e.name, e.box.x + 14, cy);\n if (e.hidden) {\n const w = e.box.width - 22;\n ctx.fillRect(e.box.x + 14, cy, w, 1);\n }\n }\n ctx.globalAlpha = 1;\n }\n\n // data\n const scale = (range: [number, number], o: number, reverse: boolean) => {\n const s = 2 / (range[1] - range[0]);\n const offset = (o - range[0]) * s - 1;\n return reverse ? [-s, -offset] : [s, offset];\n };\n const [xScale, xOffset] = scale(view.x, origin.x, model.x.reverse);\n const [yScale, yOffset] = scale(view.y, origin.y, model.y.reverse);\n painter.paint(\n items,\n {\n transform: { xScale, xOffset, yScale, yOffset },\n width: Math.max(1, Math.round(plot.width * dpr)),\n height: Math.max(1, Math.round(plot.height * dpr)),\n dpr,\n },\n Math.round(plot.x * dpr),\n Math.round(plot.y * dpr),\n );\n\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n drawForeground(ctx, {\n width,\n height,\n scales,\n theme,\n annotations: scene.annotations,\n pointLabels: [],\n clear: false,\n });\n // dot labels placed by the scene\n if (scene.pointLabels.length) {\n ctx.save();\n ctx.font = font(theme);\n ctx.textAlign = \"left\";\n ctx.textBaseline = \"middle\";\n ctx.lineWidth = 3;\n ctx.lineJoin = \"round\";\n ctx.strokeStyle = toCss(theme.background, 0.9);\n ctx.fillStyle = toCss(theme.text, 0.85);\n for (const { label, box } of scene.pointLabels) {\n ctx.strokeText(label.text, box.x, box.y + box.height / 2);\n ctx.fillText(label.text, box.x, box.y + box.height / 2);\n }\n ctx.restore();\n }\n\n // hover\n const hover = scene.hover;\n if (hover) {\n if (hover.crosshairX !== null) {\n ctx.save();\n ctx.strokeStyle = toCss(theme.textMuted, 0.55);\n ctx.lineWidth = 1;\n ctx.setLineDash([3, 3]);\n ctx.beginPath();\n const cx = Math.round(hover.crosshairX) + 0.5;\n ctx.moveTo(cx, plot.y);\n ctx.lineTo(cx, plot.y + plot.height);\n ctx.stroke();\n ctx.restore();\n }\n for (const mark of hover.marks) {\n if (mark.kind === \"bar\") {\n ctx.fillStyle = toCss(theme.text, 0.08);\n ctx.fillRect(mark.x - 2, mark.y - 2, mark.width + 4, mark.height + 2);\n continue;\n }\n ctx.beginPath();\n ctx.arc(mark.x, mark.y, mark.size / 2, 0, Math.PI * 2);\n ctx.fillStyle = mark.color;\n ctx.fill();\n ctx.lineWidth = 2;\n ctx.strokeStyle = toCss(theme.background);\n ctx.stroke();\n }\n }\n if (scene.dragging) {\n const d = scene.dragging;\n ctx.beginPath();\n ctx.arc(d.x, d.y, d.size / 2, 0, Math.PI * 2);\n ctx.fillStyle = d.color;\n ctx.globalAlpha = 0.85;\n ctx.fill();\n ctx.globalAlpha = 1;\n ctx.lineWidth = 2;\n ctx.strokeStyle = toCss(theme.background);\n ctx.stroke();\n }\n const tip = hover?.tooltip;\n if (tip) {\n const { box, lineHeight, padding } = tip;\n ctx.save();\n ctx.shadowColor = \"rgba(15, 23, 42, 0.18)\";\n ctx.shadowBlur = 16;\n ctx.shadowOffsetY = 6;\n roundedRect(ctx, box.x, box.y, box.width, box.height, 8);\n ctx.fillStyle = toCss(theme.background);\n ctx.fill();\n ctx.restore();\n roundedRect(\n ctx,\n box.x + 0.5,\n box.y + 0.5,\n box.width - 1,\n box.height - 1,\n 8,\n );\n ctx.strokeStyle = toCss(theme.axis);\n ctx.lineWidth = 1;\n ctx.stroke();\n ctx.textBaseline = \"middle\";\n let y = box.y + padding + lineHeight / 2;\n const left = box.x + padding + 2;\n const right = box.x + box.width - padding - 2;\n if (tip.text) {\n ctx.font = font(theme, 12);\n ctx.fillStyle = toCss(theme.text);\n ctx.textAlign = \"left\";\n for (const line of tip.text) {\n ctx.fillText(line, left, y);\n y += lineHeight;\n }\n } else {\n const { content } = tip;\n let x = left;\n if (content.titleColor) {\n ctx.fillStyle = content.titleColor;\n ctx.beginPath();\n ctx.arc(x + 4, y, 4, 0, Math.PI * 2);\n ctx.fill();\n x += 14;\n }\n ctx.font = font(theme, 12, 600);\n ctx.fillStyle = toCss(theme.text);\n ctx.textAlign = \"left\";\n ctx.fillText(content.title, x, y);\n y += lineHeight;\n for (const row of content.rows) {\n x = left;\n if (row.color) {\n ctx.fillStyle = row.color;\n ctx.beginPath();\n ctx.arc(x + 4, y, 4, 0, Math.PI * 2);\n ctx.fill();\n x += 14;\n }\n ctx.font = font(theme, 12);\n ctx.textAlign = \"left\";\n ctx.fillStyle = toCss(theme.textMuted);\n ctx.fillText(row.name, x, y);\n ctx.font = font(theme, 12, 600);\n ctx.textAlign = \"right\";\n ctx.fillStyle = toCss(theme.text);\n ctx.fillText(row.value, right, y);\n y += lineHeight;\n }\n }\n }\n};\n\n/**\n * Creates a chart drawn on a 2D canvas: line, area, bar and scatter series,\n * annotations, legend and tooltip, tap / drag / pinch gestures. Works\n * without a DOM (mini-programs); see `createChart` for the GPU version of\n * the web.\n */\nexport const createCanvasChart = (\n config: CanvasChartConfig,\n): CanvasChartInstance => {\n const { canvas } = config;\n const ctx = canvas.getContext(\"2d\") as CanvasRenderingContext2D | null;\n let width = config.width;\n let height = config.height;\n let dpr = config.pixelRatio ?? 1;\n let destroyed = false;\n let frameId: number | null = null;\n let items: RenderItem[] = [];\n let itemsModel: unknown = null;\n let origin: Origin = { x: 0, y: 0 };\n let version = 0;\n let fontSet = \"\";\n\n const measureText = (text: string, f: string) => {\n if (!ctx) return text.length * 6.5;\n if (f !== fontSet) {\n ctx.font = f;\n fontSet = f;\n }\n return ctx.measureText(text).width;\n };\n\n const painter = ctx ? createCanvas2dPainter(ctx) : null;\n\n const g = globalThis as {\n requestAnimationFrame?: (cb: () => void) => number;\n cancelAnimationFrame?: (id: number) => void;\n };\n\n const render = () => {\n frameId = null;\n if (destroyed || !ctx || !painter) return;\n const scene = controller.getScene();\n if (!scene) return;\n const pw = Math.max(1, Math.round(width * dpr));\n const ph = Math.max(1, Math.round(height * dpr));\n if (canvas.width !== pw) canvas.width = pw;\n if (canvas.height !== ph) canvas.height = ph;\n fontSet = \"\";\n if (itemsModel !== scene.model) {\n itemsModel = scene.model;\n origin = { x: mid(scene.model.base.x), y: mid(scene.model.base.y) };\n items = buildItems(scene.model, origin, ++version);\n }\n drawScene(ctx, scene, items, origin, dpr, painter);\n fontSet = \"\";\n };\n\n const schedule = () => {\n if (destroyed || frameId !== null) return;\n if (canvas.requestAnimationFrame)\n frameId = canvas.requestAnimationFrame(render);\n else if (g.requestAnimationFrame) frameId = g.requestAnimationFrame(render);\n else frameId = setTimeout(render, 16) as unknown as number;\n };\n\n const controller = createChartController({\n options: config.options,\n theme: config.theme,\n measureText,\n onInvalidate: schedule,\n });\n controller.setSize(width, height);\n\n const touchOptions = (t: ChartTouch, i: number): ChartPointerOptions => ({\n id: t.identifier ?? i,\n touch: true,\n });\n\n return {\n setOptions: (o) => controller.setOptions(o),\n setTheme: (t) => controller.setTheme(t),\n resize(w, h, ratio) {\n width = w;\n height = h;\n if (ratio) dpr = ratio;\n controller.setSize(w, h);\n schedule();\n },\n render() {\n if (frameId !== null) {\n if (canvas.cancelAnimationFrame) canvas.cancelAnimationFrame(frameId);\n else if (g.cancelAnimationFrame) g.cancelAnimationFrame(frameId);\n else clearTimeout(frameId);\n }\n render();\n },\n touchStart(touches) {\n touches.forEach((t, i) =>\n controller.pointerDown(t.x, t.y, touchOptions(t, i)),\n );\n },\n touchMove(touches) {\n touches.forEach((t, i) =>\n controller.pointerMove(t.x, t.y, touchOptions(t, i)),\n );\n },\n touchEnd(touches) {\n touches.forEach((t, i) =>\n controller.pointerUp(t.x, t.y, touchOptions(t, i)),\n );\n },\n touchCancel(touches = [{ x: 0, y: 0 }]) {\n touches.forEach((t, i) => controller.pointerCancel(touchOptions(t, i)));\n },\n pointerDown: (x, y, o) => controller.pointerDown(x, y, o),\n pointerMove: (x, y, o) => controller.pointerMove(x, y, o),\n pointerUp: (x, y, o) => controller.pointerUp(x, y, o),\n pointerLeave: () => controller.pointerLeave(),\n zoomAt: (x, y, f) => controller.zoomAt(x, y, f),\n resetZoom: () => controller.resetZoom(),\n getView: () => controller.getView(),\n setView: (v) => controller.setView(v),\n toggleSeries: (id) => controller.toggleSeries(id),\n clearHover: () => controller.clearHover(),\n getPlotRect: () => controller.getPlotRect(),\n toPixel: (x, y) => controller.toPixel(x, y),\n fromPixel: (x, y) => controller.fromPixel(x, y),\n getController: () => controller,\n on: (type, listener) => controller.on(type, listener),\n destroy() {\n if (destroyed) return;\n destroyed = true;\n if (frameId !== null) {\n if (canvas.cancelAnimationFrame) canvas.cancelAnimationFrame(frameId);\n else if (g.cancelAnimationFrame) g.cancelAnimationFrame(frameId);\n else clearTimeout(frameId);\n }\n painter?.destroy();\n controller.destroy();\n },\n };\n};\n"],"mappings":";;;;;;AA4FA,IAAMA,KAAO,OAAyBC,EAAE,KAAKA,EAAE,MAAM,GAE/CC,KACJ,GACA,GACA,GACA,GACA,GACA,MACG;CAWH,AAVAC,EAAI,UAAU,GACdA,EAAI,OAAOC,IAAIH,GAAGI,CAAC,GACnBF,EAAI,OAAOC,IAAIE,IAAIL,GAAGI,CAAC,GACvBF,EAAI,MAAMC,IAAIE,GAAGD,GAAGD,IAAIE,GAAGD,IAAIJ,GAAGA,CAAC,GACnCE,EAAI,OAAOC,IAAIE,GAAGD,IAAIE,IAAIN,CAAC,GAC3BE,EAAI,MAAMC,IAAIE,GAAGD,IAAIE,GAAGH,IAAIE,IAAIL,GAAGI,IAAIE,GAAGN,CAAC,GAC3CE,EAAI,OAAOC,IAAIH,GAAGI,IAAIE,CAAC,GACvBJ,EAAI,MAAMC,GAAGC,IAAIE,GAAGH,GAAGC,IAAIE,IAAIN,GAAGA,CAAC,GACnCE,EAAI,OAAOC,GAAGC,IAAIJ,CAAC,GACnBE,EAAI,MAAMC,GAAGC,GAAGD,IAAIH,GAAGI,GAAGJ,CAAC,GAC3BE,EAAI,UAAU;AAChB,GAGaK,KACX,GACA,GACA,GACA,GACA,GACA,IAAUC,EAAsBN,CAAG,MAChC;CACH,IAAM,EAAE,UAAO,WAAQ,UAAO,UAAO,SAAM,cAAWO,GAChD,EAAE,SAAM,cAAWC,GACnBC,IAAMC;CAiBZ,IAhBAV,EAAI,aAAa,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC,GACjCA,EAAI,UAAU,GAAG,GAAG,KAAK,KAAKW,IAAQF,CAAG,GAAG,KAAK,KAAKG,IAASH,CAAG,CAAC,GACnET,EAAI,aAAaS,GAAK,GAAG,GAAGA,GAAK,GAAG,CAAC,GACrCI,EAAeb,GAAK;EAClB;EAC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