@astryx-vue/charts 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +4 -2
- package/charts.css +7 -0
- package/css.d.ts +3 -0
- package/dist/index.d.ts +799 -0
- package/dist/index.js +2667 -0
- package/package.json +74 -3
- package/styles/chart-axis.css +15 -0
- package/styles/chart-grid.css +9 -0
- package/styles/chart-legend.css +13 -0
- package/styles/chart-swatch.css +24 -0
- package/styles/chart-tooltip.css +24 -0
- package/styles/chart.css +45 -0
package/package.json
CHANGED
|
@@ -1,6 +1,77 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryx-vue/charts",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Astryx charts for Vue — a config-model data visualization layer (d3-based).",
|
|
6
|
+
"author": "ShenQingchuan",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"homepage": "https://astryx-vue.pages.dev",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/astryx-vue/astryx-vue.git",
|
|
12
|
+
"directory": "packages/charts"
|
|
13
|
+
},
|
|
14
|
+
"bugs": "https://github.com/astryx-vue/astryx-vue/issues",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"vue",
|
|
17
|
+
"vue3",
|
|
18
|
+
"design-system",
|
|
19
|
+
"astryx",
|
|
20
|
+
"charts",
|
|
21
|
+
"data-visualization"
|
|
22
|
+
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"sideEffects": [
|
|
27
|
+
"**/*.css"
|
|
28
|
+
],
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./charts.css": {
|
|
35
|
+
"types": "./css.d.ts",
|
|
36
|
+
"default": "./charts.css"
|
|
37
|
+
},
|
|
38
|
+
"./styles/*.css": "./styles/*.css",
|
|
39
|
+
"./package.json": "./package.json"
|
|
40
|
+
},
|
|
41
|
+
"main": "./dist/index.js",
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"files": [
|
|
44
|
+
"README.md",
|
|
45
|
+
"charts.css",
|
|
46
|
+
"css.d.ts",
|
|
47
|
+
"dist",
|
|
48
|
+
"styles"
|
|
49
|
+
],
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"vue": "^3.5.0",
|
|
52
|
+
"@astryx-vue/core": "^0.5.1"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"d3-scale": "4.0.2",
|
|
56
|
+
"d3-shape": "3.2.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/d3-scale": "4.0.9",
|
|
60
|
+
"@types/d3-shape": "3.1.8",
|
|
61
|
+
"@types/node": "26.6.4",
|
|
62
|
+
"@vue/compiler-sfc": "3.5.43",
|
|
63
|
+
"@vue/test-utils": "2.5.1",
|
|
64
|
+
"dom-accessibility-api": "0.7.1",
|
|
65
|
+
"tsdown": "0.23.0",
|
|
66
|
+
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
67
|
+
"unplugin-vue": "8.0.0",
|
|
68
|
+
"vue": "3.5.43",
|
|
69
|
+
"vue-tsc": "3.3.12",
|
|
70
|
+
"@astryx-vue/core": "^0.5.1"
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "tsdown",
|
|
74
|
+
"dev": "tsdown --watch",
|
|
75
|
+
"typecheck": "vue-tsc --noEmit -p tsconfig.json"
|
|
76
|
+
}
|
|
6
77
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@layer astryx.reset, astryx.tokens, astryx.base, astryx.components, astryx.overrides;
|
|
2
|
+
|
|
3
|
+
@layer astryx.components {
|
|
4
|
+
/* 轴线和短刻度线都跟正文同色,1px。 */
|
|
5
|
+
.astryx-chart-axis__line,
|
|
6
|
+
.astryx-chart-axis__mark {
|
|
7
|
+
stroke: var(--astryx-color-text-primary, #171717);
|
|
8
|
+
stroke-width: 1;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.astryx-chart-axis__label {
|
|
12
|
+
fill: var(--astryx-color-text-secondary, #525252);
|
|
13
|
+
font-size: 12px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@layer astryx.reset, astryx.tokens, astryx.base, astryx.components, astryx.overrides;
|
|
2
|
+
|
|
3
|
+
@layer astryx.components {
|
|
4
|
+
/* 图例本身没有背景和边框;间距由 HStack / VStack 的 gap 给。 */
|
|
5
|
+
.astryx-chart-legend {
|
|
6
|
+
list-style: none;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* 摆在图表两侧时贴着顶部,不然纵向列表会被拉高、项与项之间散开。 */
|
|
10
|
+
.astryx-chart-legend--vertical {
|
|
11
|
+
align-self: flex-start;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@layer astryx.reset, astryx.tokens, astryx.base, astryx.components, astryx.overrides;
|
|
2
|
+
|
|
3
|
+
@layer astryx.components {
|
|
4
|
+
/* 颜色由调用方从内联样式给(运行时的系列色),形状和尺寸固定在这里。 */
|
|
5
|
+
.astryx-chart-swatch {
|
|
6
|
+
display: block;
|
|
7
|
+
flex-shrink: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* 柱状系列的色块:8×8 的圆角方块,两侧各留 1px。 */
|
|
11
|
+
.astryx-chart-swatch--square {
|
|
12
|
+
width: 8px;
|
|
13
|
+
height: 8px;
|
|
14
|
+
border-radius: 2px;
|
|
15
|
+
margin-inline: 1px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* 其余系列:一小段横线。 */
|
|
19
|
+
.astryx-chart-swatch--line {
|
|
20
|
+
width: 10px;
|
|
21
|
+
height: 3px;
|
|
22
|
+
border-radius: 1.5px;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@layer astryx.reset, astryx.tokens, astryx.base, astryx.components, astryx.overrides;
|
|
2
|
+
|
|
3
|
+
@layer astryx.components {
|
|
4
|
+
/* 竖线用正文色,1px。 */
|
|
5
|
+
.astryx-chart-tooltip__crosshair {
|
|
6
|
+
stroke: var(--astryx-color-text-primary, #171717);
|
|
7
|
+
stroke-width: 1;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* 卡片浮在图表之上,跟着指针走,所以不接收指针事件。 */
|
|
11
|
+
.astryx-chart-tooltip {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
position: fixed;
|
|
14
|
+
z-index: var(--astryx-chart-tooltip-z-index, 1000);
|
|
15
|
+
padding-block: var(--astryx-spacing-2, 8px);
|
|
16
|
+
padding-inline: var(--astryx-spacing-3, 12px);
|
|
17
|
+
background-color: var(--astryx-color-background-popover, #fff);
|
|
18
|
+
border: 1px solid var(--astryx-color-border, #e5e5e5);
|
|
19
|
+
border-radius: var(--astryx-radius-container, 8px);
|
|
20
|
+
box-shadow: var(--astryx-shadow-med, 0 4px 16px rgb(0 0 0 / 12%));
|
|
21
|
+
white-space: nowrap;
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
}
|
|
24
|
+
}
|
package/styles/chart.css
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@layer astryx.reset, astryx.tokens, astryx.base, astryx.components, astryx.overrides;
|
|
2
|
+
|
|
3
|
+
@layer astryx.components {
|
|
4
|
+
/* 图表根撑满父容器宽度,高度由内联样式给(来自 height prop)。 */
|
|
5
|
+
.astryx-chart {
|
|
6
|
+
width: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* 标题和副标题这一块,和下面的图表区之间留一个间距。 */
|
|
10
|
+
.astryx-chart__header {
|
|
11
|
+
margin-block-end: var(--astryx-spacing-4);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* 图表区:图例和绘图区按图例位置排成一行或一列。 */
|
|
15
|
+
.astryx-chart__body {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
gap: var(--astryx-spacing-4);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* 图例摆在左右两侧时改成横向排列。 */
|
|
22
|
+
.astryx-chart__body[data-legend-position='start'],
|
|
23
|
+
.astryx-chart__body[data-legend-position='end'] {
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* 图例放在下面或右侧时排在绘图区之后。DOM 里图例始终在前,
|
|
28
|
+
这样图例内容变化不会影响绘图区的重排顺序。 */
|
|
29
|
+
.astryx-chart__body[data-legend-position='bottom'] > .astryx-chart__legend,
|
|
30
|
+
.astryx-chart__body[data-legend-position='end'] > .astryx-chart__legend {
|
|
31
|
+
order: 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* 绘图区吃掉剩下的空间;宽度为 0 的容器量出 0 宽,所以这里必须挡住内容撑宽。 */
|
|
35
|
+
.astryx-chart__plot {
|
|
36
|
+
flex: 1;
|
|
37
|
+
min-width: 0;
|
|
38
|
+
overflow: clip;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* 去掉 SVG 的行内基线空隙,高度完全由 height prop 决定。 */
|
|
42
|
+
.astryx-chart__plot > svg {
|
|
43
|
+
display: block;
|
|
44
|
+
}
|
|
45
|
+
}
|