@tsingroc/tsingroc-components 5.0.0-alpha.10 → 5.0.0-alpha.12

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 (140) hide show
  1. package/dist/components/Auth.d.ts +310 -0
  2. package/dist/components/Auth.js +267 -0
  3. package/dist/components/AutoResizedECharts.d.ts +21 -0
  4. package/dist/components/AutoResizedECharts.js +98 -0
  5. package/dist/components/Calendar.d.ts +50 -0
  6. package/dist/components/Calendar.js +130 -0
  7. package/dist/components/CircularProgress.d.ts +21 -0
  8. package/dist/components/CircularProgress.js +34 -0
  9. package/dist/components/ConnectedECharts.d.ts +31 -0
  10. package/dist/components/ConnectedECharts.js +100 -0
  11. package/dist/components/ECharts.d.ts +57 -0
  12. package/dist/components/ECharts.js +255 -0
  13. package/dist/components/Header.d.ts +67 -0
  14. package/dist/components/Header.js +171 -0
  15. package/dist/components/ImageBackground.d.ts +32 -0
  16. package/dist/components/ImageBackground.js +76 -0
  17. package/dist/components/IndicatorLight.d.ts +44 -0
  18. package/dist/components/IndicatorLight.js +124 -0
  19. package/dist/components/LeftAlignedECharts.d.ts +42 -0
  20. package/dist/components/LeftAlignedECharts.js +270 -0
  21. package/dist/components/LineChartEditor.d.ts +74 -0
  22. package/dist/components/LineChartEditor.js +458 -0
  23. package/dist/components/LineChartTable.d.ts +38 -0
  24. package/dist/components/LineChartTable.js +245 -0
  25. package/dist/components/LinkedLineChart.d.ts +45 -0
  26. package/dist/components/LinkedLineChart.js +159 -0
  27. package/dist/components/QuickDateRangePicker.d.ts +30 -0
  28. package/dist/components/QuickDateRangePicker.js +58 -0
  29. package/dist/components/SegmentedButtons.d.ts +22 -0
  30. package/dist/components/SegmentedButtons.js +86 -0
  31. package/dist/components/Sidebar.d.ts +79 -0
  32. package/dist/components/Sidebar.js +178 -0
  33. package/dist/components/TsingrocDatePicker.d.ts +38 -0
  34. package/dist/components/TsingrocDatePicker.js +64 -0
  35. package/dist/components/TsingrocTheme.d.ts +15 -0
  36. package/dist/components/TsingrocTheme.js +72 -0
  37. package/dist/components/UserButton.d.ts +42 -0
  38. package/dist/components/UserButton.js +105 -0
  39. package/dist/components/VerticalColorLegend.d.ts +7 -0
  40. package/dist/components/VerticalColorLegend.js +208 -0
  41. package/dist/components/WeatherMap.d.ts +18 -0
  42. package/dist/components/WeatherMap.js +658 -0
  43. package/dist/deckgl/TiandituLayer.d.ts +13 -0
  44. package/dist/deckgl/TiandituLayer.js +44 -0
  45. package/dist/deckgl/WeatherData.d.ts +53 -0
  46. package/dist/deckgl/WeatherData.js +94 -0
  47. package/dist/deckgl/index.d.ts +1 -0
  48. package/dist/deckgl/index.js +1 -0
  49. package/dist/echarts/coordinateSystems/grid.d.ts +43 -0
  50. package/dist/echarts/coordinateSystems/grid.js +107 -0
  51. package/dist/echarts/coordinateSystems/index.js +2 -0
  52. package/dist/echarts/coordinateSystems/polar.d.ts +45 -0
  53. package/dist/echarts/coordinateSystems/polar.js +96 -0
  54. package/dist/echarts/gl-types.d.js +0 -0
  55. package/dist/echarts/gl.d.ts +115 -0
  56. package/dist/echarts/gl.js +47 -0
  57. package/dist/echarts/index.d.ts +46 -0
  58. package/dist/echarts/index.js +46 -0
  59. package/dist/echarts/legend.d.ts +17 -0
  60. package/dist/echarts/legend.js +15 -0
  61. package/dist/echarts/radar.d.ts +24 -0
  62. package/dist/echarts/radar.js +22 -0
  63. package/dist/echarts/series/barSeries.d.ts +23 -0
  64. package/dist/echarts/series/barSeries.js +18 -0
  65. package/dist/echarts/series/boxplotSeries.d.ts +21 -0
  66. package/dist/echarts/series/boxplotSeries.js +40 -0
  67. package/dist/echarts/series/index.js +7 -0
  68. package/dist/echarts/series/intervalSeries.d.ts +32 -0
  69. package/dist/echarts/series/intervalSeries.js +55 -0
  70. package/dist/echarts/series/lineSeries.d.ts +36 -0
  71. package/dist/echarts/series/lineSeries.js +45 -0
  72. package/dist/echarts/series/maxBarSeries.d.ts +18 -0
  73. package/dist/echarts/series/maxBarSeries.js +39 -0
  74. package/dist/echarts/series/pieSeries.d.ts +31 -0
  75. package/dist/echarts/series/pieSeries.js +47 -0
  76. package/dist/echarts/series/windLineSeries.d.ts +47 -0
  77. package/dist/echarts/series/windLineSeries.js +51 -0
  78. package/{src/echarts/tooltip.ts → dist/echarts/tooltip.d.ts} +1 -5
  79. package/dist/echarts/tooltip.js +18 -0
  80. package/dist/env.d.js +0 -0
  81. package/dist/index.d.ts +20 -0
  82. package/dist/index.js +20 -0
  83. package/dist/utils/debug.d.ts +1 -0
  84. package/dist/utils/debug.js +25 -0
  85. package/dist/utils/index.d.ts +4 -0
  86. package/dist/utils/index.js +4 -0
  87. package/dist/utils/math.d.ts +9 -0
  88. package/{src/utils/math.ts → dist/utils/math.js} +2 -2
  89. package/dist/utils/mock.d.ts +8 -0
  90. package/dist/utils/mock.js +40 -0
  91. package/dist/utils/startOfQuarter.d.ts +2 -0
  92. package/dist/utils/startOfQuarter.js +4 -0
  93. package/package.json +26 -14
  94. package/src/components/Auth.tsx +0 -623
  95. package/src/components/AutoResizedECharts.tsx +0 -70
  96. package/src/components/Calendar.tsx +0 -182
  97. package/src/components/CircularProgress.tsx +0 -38
  98. package/src/components/ConnectedECharts.tsx +0 -62
  99. package/src/components/ECharts.tsx +0 -206
  100. package/src/components/Header.tsx +0 -136
  101. package/src/components/ImageBackground.tsx +0 -58
  102. package/src/components/IndicatorLight.tsx +0 -106
  103. package/src/components/LeftAlignedECharts.tsx +0 -190
  104. package/src/components/LineChartEditor.tsx +0 -558
  105. package/src/components/LineChartTable.tsx +0 -286
  106. package/src/components/LinkedECharts.tsx +0 -51
  107. package/src/components/LinkedLineChart.tsx +0 -144
  108. package/src/components/QuickDateRangePicker.tsx +0 -84
  109. package/src/components/SegmentedButtons.tsx +0 -46
  110. package/src/components/Sidebar.tsx +0 -271
  111. package/src/components/StrictECharts.d.ts +0 -47
  112. package/src/components/StrictECharts.js +0 -1
  113. package/src/components/TsingrocDatePicker.tsx +0 -103
  114. package/src/components/TsingrocTheme.tsx +0 -48
  115. package/src/components/UserButton.tsx +0 -165
  116. package/src/components/VerticalColorLegend.tsx +0 -73
  117. package/src/components/WeatherMap.tsx +0 -522
  118. package/src/deckgl/TiandituLayer.ts +0 -56
  119. package/src/deckgl/WeatherData.ts +0 -157
  120. package/src/deckgl/index.ts +0 -4
  121. package/src/echarts/coordinateSystems/grid.ts +0 -143
  122. package/src/echarts/coordinateSystems/polar.ts +0 -148
  123. package/src/echarts/gl.ts +0 -159
  124. package/src/echarts/index.ts +0 -129
  125. package/src/echarts/legend.ts +0 -36
  126. package/src/echarts/radar.ts +0 -46
  127. package/src/echarts/series/barSeries.ts +0 -37
  128. package/src/echarts/series/boxplotSeries.ts +0 -62
  129. package/src/echarts/series/intervalSeries.ts +0 -70
  130. package/src/echarts/series/lineSeries.ts +0 -78
  131. package/src/echarts/series/maxBarSeries.ts +0 -55
  132. package/src/echarts/series/pieSeries.ts +0 -76
  133. package/src/echarts/series/windLineSeries.ts +0 -113
  134. package/src/index.ts +0 -118
  135. package/src/types.d.ts +0 -5
  136. package/src/utils/debug.ts +0 -39
  137. package/src/utils/mock.ts +0 -69
  138. package/src/utils/startOfQuarter.ts +0 -6
  139. /package/{src/echarts/coordinateSystems/index.ts → dist/echarts/coordinateSystems/index.d.ts} +0 -0
  140. /package/{src/echarts/series/index.ts → dist/echarts/series/index.d.ts} +0 -0
@@ -0,0 +1,18 @@
1
+ import { TooltipComponent } from "echarts/components";
2
+ import * as echarts from "echarts/core";
3
+ /**
4
+ * 添加悬停提示。这只是对官方 tooltip 组件的简单包装,设置参见 [ECharts 文档][1]。
5
+ *
6
+ * **注意**:ECharts 尚不支持多个 tooltip,在含有多个图表的
7
+ * ECharts 实例中 tooltip 的 `trigger` 值必须支持所有图表。
8
+ * 因此,若需要对每个图表使用不同的 tooltip 设置,请将其拆分成多个
9
+ * ECharts 实例。
10
+ *
11
+ * [1]: https://echarts.apache.org/zh/option.html#tooltip
12
+ */
13
+ export function tooltip(option = {}) {
14
+ echarts.use(TooltipComponent);
15
+ return {
16
+ tooltip: [option]
17
+ };
18
+ }
package/dist/env.d.js ADDED
File without changes
@@ -0,0 +1,20 @@
1
+ export { AuthProvider, type AuthProviderProps, AuthCheck, type AuthCheckProps, AuthCallback, type AuthCallbackProps, useAuth, type Auth, type CasdoorAuth, type LocalAuth, } from "./components/Auth";
2
+ export { default as AutoResizedECharts, withAutoResize, } from "./components/AutoResizedECharts";
3
+ export { default as Calendar, type CalendarProps } from "./components/Calendar";
4
+ export { default as CircularProgress, type CircularProgressProps, } from "./components/CircularProgress";
5
+ export { default as ConnectedECharts, EChartsConnector, withConnector, } from "./components/ConnectedECharts";
6
+ export { default as ECharts, type EChartsProps, type EChartsRef, type EChartsComponentType, type EChartsHOCType, } from "./components/ECharts";
7
+ export { default as Header, type HeaderProps } from "./components/Header";
8
+ export { default as ImageBackground, type ImageBackgroundProps, } from "./components/ImageBackground";
9
+ export { default as IndicatorLight, type IndicatorLightProps, } from "./components/IndicatorLight";
10
+ export { default as LeftAlignedECharts, EChartsLeftAligner, withLeftAlign, } from "./components/LeftAlignedECharts";
11
+ export { default as LineChartEditor, type LineChartEditorProps, } from "./components/LineChartEditor";
12
+ export { default as LineChartTable, type LineChartTableProps, } from "./components/LineChartTable";
13
+ export { default as LinkedLineChart, LineChartLinkProvider, type LinkedLineChartProps, type LineChartLinkProviderProps, } from "./components/LinkedLineChart";
14
+ export { default as QuickDateRangePicker, type QuickDateRangePickerProps, } from "./components/QuickDateRangePicker";
15
+ export { default as SegmentedButtons, TimeUnitSwitcher, type TimeUnitSwitcherProps, } from "./components/SegmentedButtons";
16
+ export { default as Sidebar, type SidebarProps } from "./components/Sidebar";
17
+ export { default as TsingrocDatePicker, type DatePickerProps, } from "./components/TsingrocDatePicker";
18
+ export { default as TsingrocTheme, type TsingrocThemeProps, } from "./components/TsingrocTheme";
19
+ export { default as UserButton, type UserButtonProps, } from "./components/UserButton";
20
+ export { default as WeatherMap, type WeatherMapProps, type WeatherData, } from "./components/WeatherMap";
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ export { AuthProvider, AuthCheck, AuthCallback, useAuth } from "./components/Auth";
2
+ export { default as AutoResizedECharts, withAutoResize } from "./components/AutoResizedECharts";
3
+ export { default as Calendar } from "./components/Calendar";
4
+ export { default as CircularProgress } from "./components/CircularProgress";
5
+ export { default as ConnectedECharts, EChartsConnector, withConnector } from "./components/ConnectedECharts";
6
+ export { default as ECharts } from "./components/ECharts";
7
+ export { default as Header } from "./components/Header";
8
+ export { default as ImageBackground } from "./components/ImageBackground";
9
+ export { default as IndicatorLight } from "./components/IndicatorLight";
10
+ export { default as LeftAlignedECharts, EChartsLeftAligner, withLeftAlign } from "./components/LeftAlignedECharts";
11
+ export { default as LineChartEditor } from "./components/LineChartEditor";
12
+ export { default as LineChartTable } from "./components/LineChartTable";
13
+ export { default as LinkedLineChart, LineChartLinkProvider } from "./components/LinkedLineChart";
14
+ export { default as QuickDateRangePicker } from "./components/QuickDateRangePicker";
15
+ export { default as SegmentedButtons, TimeUnitSwitcher } from "./components/SegmentedButtons";
16
+ export { default as Sidebar } from "./components/Sidebar";
17
+ export { default as TsingrocDatePicker } from "./components/TsingrocDatePicker";
18
+ export { default as TsingrocTheme } from "./components/TsingrocTheme";
19
+ export { default as UserButton } from "./components/UserButton";
20
+ export { default as WeatherMap } from "./components/WeatherMap";
@@ -0,0 +1 @@
1
+ export declare const debugAssert: (cond: any, ...msg: any[]) => asserts cond;
@@ -0,0 +1,25 @@
1
+ export const debugAssert = process.env.NODE_ENV !== "production" ? (cond, ...msg) => {
2
+ if (!cond) {
3
+ throw new AssertionError(...msg);
4
+ }
5
+ } : () => {};
6
+ class AssertionError extends Error {
7
+ constructor(...msg) {
8
+ super();
9
+ this.originalMessage = msg;
10
+ }
11
+ }
12
+ if (process.env.NODE_ENV !== "production") {
13
+ const consoleError = console.error;
14
+ console.error = (...msg) => {
15
+ if (msg.length === 4 && msg[1] instanceof AssertionError) {
16
+ const error = msg[1];
17
+ const originalMessage = error.originalMessage;
18
+ console.groupCollapsed("%c❌ Assertion failed:" + " %c%o".repeat(originalMessage.length), "color: orange; font-weight: normal;", ...originalMessage.flatMap(item => ["color: unset; font-weight: normal;", item]));
19
+ console.log(error);
20
+ console.groupEnd();
21
+ } else {
22
+ consoleError(...msg);
23
+ }
24
+ };
25
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./debug";
2
+ export * from "./math";
3
+ export * from "./mock";
4
+ export * from "./startOfQuarter";
@@ -0,0 +1,4 @@
1
+ export * from "./debug";
2
+ export * from "./math";
3
+ export * from "./mock";
4
+ export * from "./startOfQuarter";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 将一个数值限制在 `min` 和 `max` 之间。
3
+ */
4
+ export declare function clamp(value: number, min: number, max: number): number;
5
+ /**
6
+ * 生成一个标准正态分布的随机变量
7
+ * @see [Box-Muller transform](https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform)
8
+ */
9
+ export declare function normal(): number;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 将一个数值限制在 `min` 和 `max` 之间。
3
3
  */
4
- export function clamp(value: number, min: number, max: number) {
4
+ export function clamp(value, min, max) {
5
5
  return Math.min(Math.max(value, min), max);
6
6
  }
7
7
 
@@ -13,4 +13,4 @@ export function normal() {
13
13
  const u = 1 - Math.random();
14
14
  const v = Math.random();
15
15
  return Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v);
16
- }
16
+ }
@@ -0,0 +1,8 @@
1
+ import type { Dayjs } from "dayjs";
2
+ export declare function mockData(length: number, mean: number, sd: number, sdDelta: number, min?: number, max?: number): number[];
3
+ export declare function mockPrediction(length: number, mean: number, sd: number, sdDelta: number, sdError: number, pManual: number, min?: number, max?: number): {
4
+ prediction: number[];
5
+ manual: number[];
6
+ real: number[];
7
+ };
8
+ export declare function mockTimeSeries(length: number, start: Dayjs): Dayjs[];
@@ -0,0 +1,40 @@
1
+ import { clamp, normal } from "./math";
2
+ export function mockData(length, mean, sd, sdDelta, min = -Infinity, max = Infinity) {
3
+ if (sd === 0) {
4
+ return Array(length).fill(mean);
5
+ }
6
+ const result = [];
7
+ if (length <= 0) {
8
+ return result;
9
+ }
10
+ result.push(clamp(mean + normal() * sd, min, max));
11
+ for (let i = 0; i < length - 1; i++) {
12
+ const diffMean = result[i] - mean;
13
+ const delta = normal() * sdDelta;
14
+ result.push(clamp(result[i] + delta * (Math.sign(diffMean * delta) > 0 ? Math.exp(-Math.abs(diffMean / sd)) : Math.log(Math.E + Math.abs(diffMean / sd))), min, max));
15
+ }
16
+ return result;
17
+ }
18
+ export function mockPrediction(length, mean, sd, sdDelta, sdError, pManual, min = -Infinity, max = Infinity) {
19
+ const real = mockData(length, mean, sd, sdDelta, min, max);
20
+ const error = mockData(length, 0, sdError, sdDelta);
21
+ const prediction = real.map((x, i) => clamp(x + error[i], min, max));
22
+ const manualAdjust = mockData(length, 0, sdError, sdDelta);
23
+ const manual = prediction.map((x, i) => Math.random() < pManual ? clamp(x + manualAdjust[i], min, max) : x);
24
+ return {
25
+ prediction,
26
+ manual,
27
+ real
28
+ };
29
+ }
30
+ export function mockTimeSeries(length, start) {
31
+ const result = [];
32
+ if (length <= 0) {
33
+ return result;
34
+ }
35
+ result.push(start);
36
+ for (let i = 1; i < length; i++) {
37
+ result.push(start.add(15 * i, "minutes"));
38
+ }
39
+ return result;
40
+ }
@@ -0,0 +1,2 @@
1
+ import type { Dayjs } from "dayjs";
2
+ export declare function startOfQuarter(date: Dayjs): Dayjs;
@@ -0,0 +1,4 @@
1
+ export function startOfQuarter(date) {
2
+ date = date.startOf("minute");
3
+ return date.subtract(date.minute() % 15, "minutes");
4
+ }
package/package.json CHANGED
@@ -1,31 +1,39 @@
1
1
  {
2
2
  "name": "@tsingroc/tsingroc-components",
3
- "version": "5.0.0-alpha.10",
3
+ "version": "5.0.0-alpha.12",
4
4
  "author": "",
5
5
  "license": "ISC",
6
6
  "description": "",
7
7
  "keywords": [],
8
8
  "type": "module",
9
- "main": "src/index.ts",
9
+ "main": "./dist/index.js",
10
10
  "sideEffects": [
11
11
  "**/*.css"
12
12
  ],
13
13
  "exports": {
14
- ".": "./src/index.ts",
15
- "./echarts": "./src/echarts/index.ts",
16
- "./echarts/gl": "./src/echarts/gl.ts",
17
- "./utils/*": "./src/utils/*.ts"
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ },
18
+ "./echarts": {
19
+ "types": "./dist/echarts/index.d.ts",
20
+ "default": "./dist/echarts/index.js"
21
+ },
22
+ "./utils": {
23
+ "types": "./dist/utils/index.d.ts",
24
+ "default": "./dist/utils/index.js"
25
+ }
18
26
  },
19
27
  "files": [
20
- "src"
28
+ "dist"
21
29
  ],
22
30
  "scripts": {
23
31
  "test": "echo \"Error: no test specified\" && exit 1",
24
32
  "dev": "rspress",
25
33
  "lint": "eslint .",
26
34
  "format": "prettier . -w && eslint . --fix",
27
- "build": "tsc -b --force && copyfiles -u 1 src/**/*.d.ts dist",
28
- "prepublishOnly": "tsc -b --force",
35
+ "build": "rm -rf dist && (npx babel src --out-dir dist --extensions .ts,.tsx & tsc -p tsconfig.lib.json & copyfiles src/**/*.css dist --up 1 & wait)",
36
+ "prepublishOnly": "npm run build",
29
37
  "docs:build": "rspress build",
30
38
  "docs:preview": "rspress preview"
31
39
  },
@@ -41,10 +49,10 @@
41
49
  },
42
50
  "peerDependencies": {
43
51
  "@ant-design/icons": "^6.0.0",
52
+ "@ant-design/v5-patch-for-react-19": "^1.0.3",
44
53
  "antd": "^5.27.5",
45
54
  "antd-style": "^3.7.1",
46
55
  "echarts": "^5.6.0 || ^6.0.0",
47
- "echarts-for-react": "^3.0.2",
48
56
  "echarts-gl": "^2.0.9",
49
57
  "react": "^19.2.0",
50
58
  "react-dom": "^19.2.0"
@@ -52,18 +60,22 @@
52
60
  "devDependencies": {
53
61
  "@ant-design/icons": "^6.1.0",
54
62
  "@ant-design/v5-patch-for-react-19": "^1.0.3",
63
+ "@babel/cli": "^7.28.3",
64
+ "@babel/core": "^7.28.4",
65
+ "@babel/preset-react": "^7.27.1",
66
+ "@babel/preset-typescript": "^7.27.1",
55
67
  "@eslint/js": "^9.38.0",
56
68
  "@ianvs/prettier-plugin-sort-imports": "^4.7.0",
57
69
  "@rspress/core": "^2.0.0-beta.34",
58
70
  "@rspress/plugin-preview": "^2.0.0-beta.34",
59
- "@types/node": "^22.18.11",
71
+ "@types/node": "^22.18.12",
60
72
  "@types/react": "^19.2.2",
61
73
  "@types/react-dom": "^19.2.2",
62
- "antd": "^5.27.5",
74
+ "antd": "^5.27.6",
63
75
  "antd-style": "^3.7.1",
76
+ "babel-plugin-react-compiler": "^1.0.0",
64
77
  "copyfiles": "^2.4.1",
65
78
  "echarts": "^6.0.0",
66
- "echarts-for-react": "^3.0.4",
67
79
  "echarts-gl": "^2.0.9",
68
80
  "eslint": "^9.38.0",
69
81
  "eslint-plugin-react-hooks": "^7.0.0",
@@ -75,7 +87,7 @@
75
87
  "remark-gfm": "^4.0.1",
76
88
  "typedoc": "^0.28.14",
77
89
  "typescript": "^5.9.3",
78
- "typescript-eslint": "^8.46.1"
90
+ "typescript-eslint": "^8.46.2"
79
91
  },
80
92
  "overrides": {
81
93
  "echarts-gl": {