@363045841yyt/klinechart 0.7.5 → 0.7.6

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.
@@ -70,7 +70,7 @@ export interface KLineData {
70
70
  const props = defineProps<{
71
71
  k: KLineData | null
72
72
  index: number | null
73
- data: KLineData[]
73
+ data: ReadonlyArray<KLineData>
74
74
  pos: { x: number; y: number }
75
75
  useAnchor?: boolean
76
76
  anchorPlacement?: 'right-bottom' | 'left-bottom'
@@ -109,7 +109,7 @@ const UP_COLOR = '#ef4444'
109
109
  const DOWN_COLOR = '#22c55e'
110
110
  const NEUTRAL_COLOR = '#6b7280'
111
111
 
112
- function calcDirection(k: KLineData, data: KLineData[], idx: number | null): number {
112
+ function calcDirection(k: KLineData, data: ReadonlyArray<KLineData>, idx: number | null): number {
113
113
  if (k.close >= k.open) return 1
114
114
  const prev = typeof idx === 'number' && idx > 0 ? data[idx - 1] : undefined
115
115
  if (prev && k.close > prev.close) return 1
@@ -19,18 +19,7 @@
19
19
  <script setup lang="ts">
20
20
  import { computed } from 'vue'
21
21
  import type { ComponentPublicInstance } from 'vue'
22
-
23
- interface MarkerEntity {
24
- markerType: string
25
- metadata: Record<string, unknown>
26
- }
27
-
28
- interface CustomMarkerEntity {
29
- date: string
30
- shape: string
31
- label?: { text: string }
32
- metadata: Record<string, unknown>
33
- }
22
+ import type { MarkerEntity, CustomMarkerEntity } from '@363045841yyt/klinechart-core/engine/marker/registry'
34
23
 
35
24
  const MARKER_TYPE_LABELS: Record<string, string> = {
36
25
  support: '支撑位',
@@ -8,11 +8,9 @@ export function provideFullscreenTeleportTarget(targetRef: Ref<HTMLElement | nul
8
8
  }
9
9
 
10
10
  export function useFullscreenTeleportTarget() {
11
- // null = no provider in ancestor tree (degraded scenario)
12
11
  const targetRef = inject(FULLSCREEN_TARGET_KEY, null)
13
12
 
14
13
  return computed<HTMLElement | string>(() => {
15
- // targetRef null → no provider; targetRef.value null → container not mounted yet
16
14
  return targetRef?.value ?? 'body'
17
15
  })
18
16
  }
@@ -0,0 +1,14 @@
1
+ import { defineCustomElement } from 'vue'
2
+ import KLineChartVue from './components/KLineChart.vue'
3
+ import type { SemanticChartConfig, DataFetcher } from '@363045841yyt/klinechart-core/semantic'
4
+
5
+ const KLineChartElement = defineCustomElement(KLineChartVue, {
6
+ shadowRoot: true,
7
+ })
8
+
9
+ customElements.define('kline-chart', KLineChartElement)
10
+
11
+ export { KLineChartElement }
12
+ export default KLineChartElement
13
+
14
+ export type { SemanticChartConfig, DataFetcher }