@wick-charts/vue 0.2.3 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wick-charts/vue",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "High-performance canvas timeseries charts for Vue — candlestick, line, bar, pie. Tree-shakeable, zero runtime deps.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -45,7 +45,7 @@
45
45
  "vue": ">=3.3.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@wick-charts/core": "^0.2.3"
48
+ "@wick-charts/core": "^0.3.0"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "vite build"
package/src/index.ts CHANGED
@@ -1,4 +1,12 @@
1
- // Re-export core
1
+ /**
2
+ * @wick-charts/vue — Vue bindings for Wick Charts.
3
+ *
4
+ * Everything importable from the library is re-exported here: components
5
+ * (`<ChartContainer>`, `<CandlestickSeries>`, …), option types, and themes.
6
+ * The underlying `@wick-charts/core` engine is bundled into this package —
7
+ * its source lives at
8
+ * https://github.com/mo4islona/wick-charts/tree/main/packages/core/src.
9
+ */
2
10
 
3
11
  export type {
4
12
  AxisBound,
@@ -46,6 +54,7 @@ export type {
46
54
  export {
47
55
  ChartInstance,
48
56
  andromeda,
57
+ autoGradient,
49
58
  ayuMirage,
50
59
  buildHoverSnapshots,
51
60
  buildLastSnapshots,
@@ -76,6 +85,9 @@ export {
76
85
  panda,
77
86
  peachCream,
78
87
  quietLight,
88
+ resolveAxisFontSize,
89
+ resolveAxisTextColor,
90
+ resolveCandlestickBodyColor,
79
91
  rosePineDawn,
80
92
  sandDune,
81
93
  solarizedLight,
@@ -17,7 +17,7 @@ const labelStyle = computed(() => ({
17
17
  // while still masking whatever tick sits underneath.
18
18
  background: `color-mix(in srgb, ${theme.value.crosshair.labelBackground} 80%, transparent)`,
19
19
  color: theme.value.crosshair.labelTextColor,
20
- fontSize: theme.value.typography.axisFontSize + 'px',
20
+ fontSize: theme.value.axis.fontSize + 'px',
21
21
  fontFamily: theme.value.typography.fontFamily,
22
22
  fontVariantNumeric: 'tabular-nums' as const,
23
23
  padding: '2px 6px',
@@ -10,6 +10,7 @@ import {
10
10
  formatCompact,
11
11
  formatPriceAdaptive,
12
12
  formatTime,
13
+ resolveCandlestickBodyColor,
13
14
  } from '@wick-charts/core';
14
15
  import { computed, inject, onMounted, onUnmounted, ref, useSlots } from 'vue';
15
16
 
@@ -155,10 +156,11 @@ function isOHLC(data: OHLCData | TimePoint): data is OHLCData {
155
156
  <span :style="{ color: theme.axis.textColor, opacity: 0.5, marginLeft: '5px' }">{{ cell.label }}</span>
156
157
  <span
157
158
  :style="{
158
- color:
159
+ color: resolveCandlestickBodyColor(
159
160
  (s.data as OHLCData).close >= (s.data as OHLCData).open
160
- ? theme.candlestick.upColor
161
- : theme.candlestick.downColor,
161
+ ? theme.candlestick.up.body
162
+ : theme.candlestick.down.body,
163
+ ),
162
164
  fontWeight: 500,
163
165
  marginLeft: '2px',
164
166
  }"
package/src/ui/Legend.vue CHANGED
@@ -196,7 +196,7 @@ function handleClick(item: LegendItem) {
196
196
  alignItems: position === 'right' ? 'flex-start' : 'center',
197
197
  justifyContent: position === 'right' ? 'flex-start' : 'center',
198
198
  fontFamily: theme.typography.fontFamily,
199
- fontSize: theme.typography.axisFontSize + 'px',
199
+ fontSize: theme.axis.fontSize + 'px',
200
200
  color: theme.axis.textColor,
201
201
  pointerEvents: 'auto',
202
202
  flexShrink: 0,
@@ -217,7 +217,7 @@ function handleClick(item: LegendItem) {
217
217
  alignItems: position === 'right' ? 'flex-start' : 'center',
218
218
  justifyContent: position === 'right' ? 'flex-start' : 'center',
219
219
  fontFamily: theme.typography.fontFamily,
220
- fontSize: theme.typography.axisFontSize + 'px',
220
+ fontSize: theme.axis.fontSize + 'px',
221
221
  color: theme.axis.textColor,
222
222
  pointerEvents: 'auto',
223
223
  flexShrink: 0,
@@ -258,7 +258,7 @@ function handleClick(item: LegendItem) {
258
258
  alignItems: position === 'right' ? 'flex-start' : 'center',
259
259
  justifyContent: position === 'right' ? 'flex-start' : 'center',
260
260
  fontFamily: theme.typography.fontFamily,
261
- fontSize: theme.typography.axisFontSize + 'px',
261
+ fontSize: theme.axis.fontSize + 'px',
262
262
  color: theme.axis.textColor,
263
263
  pointerEvents: 'auto',
264
264
  flexShrink: 0,
@@ -113,7 +113,7 @@ const slices = computed<readonly SliceInfo[]>(() => {
113
113
  :style="{
114
114
  opacity: resolvedMode === 'percent' ? 1 : 0.5,
115
115
  fontWeight: resolvedMode === 'percent' ? 600 : 400,
116
- fontSize: (resolvedMode === 'percent' ? theme.typography.fontSize : theme.typography.axisFontSize) + 'px',
116
+ fontSize: (resolvedMode === 'percent' ? theme.typography.fontSize : theme.axis.fontSize) + 'px',
117
117
  fontVariantNumeric: 'tabular-nums',
118
118
  minWidth: '40px',
119
119
  textAlign: 'right',
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { formatTime } from '@wick-charts/core';
2
+ import { formatTime, resolveAxisFontSize, resolveAxisTextColor } from '@wick-charts/core';
3
3
  import { computed } from 'vue';
4
4
 
5
5
  import { useVisibleRange } from '../composables';
@@ -76,8 +76,8 @@ const tickData = computed(() => {
76
76
  position: 'absolute',
77
77
  left: chart.timeScale.timeToX(time) + 'px',
78
78
  transform: 'translateX(-50%)',
79
- color: theme.axis.textColor,
80
- fontSize: theme.typography.axisFontSize + 'px',
79
+ color: resolveAxisTextColor(theme, 'x'),
80
+ fontSize: resolveAxisFontSize(theme, 'x') + 'px',
81
81
  fontFamily: theme.typography.fontFamily,
82
82
  userSelect: 'none',
83
83
  whiteSpace: 'nowrap',
package/src/ui/Title.vue CHANGED
@@ -47,7 +47,7 @@ if (!theme) {
47
47
  :style="{
48
48
  fontWeight: 400,
49
49
  color: theme.axis.textColor,
50
- fontSize: theme.typography.axisFontSize + 'px',
50
+ fontSize: theme.axis.fontSize + 'px',
51
51
  }"
52
52
  >
53
53
  {{ sub }}
@@ -11,6 +11,7 @@ import {
11
11
  formatDate,
12
12
  formatPriceAdaptive,
13
13
  formatTime,
14
+ resolveCandlestickBodyColor,
14
15
  } from '@wick-charts/core';
15
16
  import { computed, onMounted, onUnmounted, ref, useSlots, watchEffect } from 'vue';
16
17
 
@@ -158,7 +159,7 @@ function isOHLC(data: OHLCData | TimePoint): data is OHLCData {
158
159
  borderRadius: '8px',
159
160
  padding: '10px 14px',
160
161
  boxShadow: '0 4px 16px rgba(0,0,0,0.1), 0 1px 4px rgba(0,0,0,0.06)',
161
- fontSize: theme.typography.tooltipFontSize + 'px',
162
+ fontSize: theme.tooltip.fontSize + 'px',
162
163
  fontFamily: theme.typography.fontFamily,
163
164
  fontVariantNumeric: 'tabular-nums',
164
165
  color: theme.tooltip.textColor,
@@ -169,7 +170,7 @@ function isOHLC(data: OHLCData | TimePoint): data is OHLCData {
169
170
  >
170
171
  <div
171
172
  :style="{
172
- fontSize: theme.typography.axisFontSize + 'px',
173
+ fontSize: theme.axis.fontSize + 'px',
173
174
  color: theme.axis.textColor,
174
175
  marginBottom: '8px',
175
176
  paddingBottom: '6px',
@@ -195,10 +196,11 @@ function isOHLC(data: OHLCData | TimePoint): data is OHLCData {
195
196
  <span
196
197
  :style="{
197
198
  fontWeight: 600,
198
- color:
199
+ color: resolveCandlestickBodyColor(
199
200
  (s.data as OHLCData).close >= (s.data as OHLCData).open
200
- ? theme.candlestick.upColor
201
- : theme.candlestick.downColor,
201
+ ? theme.candlestick.up.body
202
+ : theme.candlestick.down.body,
203
+ ),
202
204
  textAlign: 'right',
203
205
  }"
204
206
  >{{ effectiveFormat(row.val, row.field) }}</span>
@@ -245,7 +247,7 @@ function isOHLC(data: OHLCData | TimePoint): data is OHLCData {
245
247
  padding: '10px 14px',
246
248
  boxShadow: '0 4px 16px rgba(0,0,0,0.1), 0 1px 4px rgba(0,0,0,0.06)',
247
249
  fontFamily: theme.typography.fontFamily,
248
- fontSize: theme.typography.tooltipFontSize + 'px',
250
+ fontSize: theme.tooltip.fontSize + 'px',
249
251
  fontVariantNumeric: 'tabular-nums',
250
252
  color: theme.tooltip.textColor,
251
253
  width: 'max-content',
package/src/ui/YAxis.vue CHANGED
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import type { ValueFormatter } from '@wick-charts/core';
2
+ import { resolveAxisFontSize, resolveAxisTextColor, type ValueFormatter } from '@wick-charts/core';
3
3
  import { computed, onMounted, onUnmounted, watch } from 'vue';
4
4
 
5
5
  import { useVisibleRange } from '../composables';
@@ -84,8 +84,8 @@ const allTicks = computed(() => {
84
84
  right: '8px',
85
85
  top: chart.yScale.valueToY(price) + 'px',
86
86
  transform: 'translateY(-50%)',
87
- color: theme.axis.textColor,
88
- fontSize: theme.typography.axisFontSize + 'px',
87
+ color: resolveAxisTextColor(theme, 'y'),
88
+ fontSize: resolveAxisFontSize(theme, 'y') + 'px',
89
89
  fontFamily: theme.typography.fontFamily,
90
90
  fontVariantNumeric: 'tabular-nums',
91
91
  userSelect: 'none',
package/src/ui/YLabel.vue CHANGED
@@ -179,7 +179,7 @@ const effectiveFormat = computed<ValueFormatter>(() => {
179
179
  zIndex: 3,
180
180
  background: bgColor,
181
181
  color: theme.yLabel.textColor,
182
- fontSize: theme.typography.yFontSize + 'px',
182
+ fontSize: theme.yLabel.fontSize + 'px',
183
183
  fontFamily: theme.typography.fontFamily,
184
184
  padding: '3px 8px',
185
185
  borderRadius: '3px',