From 8e85823d3234d148d8093a47109f1143dc7c23f2 Mon Sep 17 00:00:00 2001 From: zernonia Date: Sat, 23 Mar 2024 10:02:49 +0800 Subject: [PATCH] chore: wip --- apps/www/.vitepress/theme/layout/DocsLayout.vue | 8 ++++---- apps/www/.vitepress/theme/style.css | 3 +++ .../src/lib/registry/default/ui/chart/ChartCrosshair.vue | 4 ++-- apps/www/src/lib/registry/default/ui/chart/index.ts | 4 +++- .../lib/registry/new-york/ui/chart-donut/DonutChart.vue | 1 + .../src/lib/registry/new-york/ui/chart/ChartCrosshair.vue | 6 +++--- apps/www/src/lib/registry/new-york/ui/chart/index.ts | 4 +++- 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/apps/www/.vitepress/theme/layout/DocsLayout.vue b/apps/www/.vitepress/theme/layout/DocsLayout.vue index 015d2682..195c5db7 100644 --- a/apps/www/.vitepress/theme/layout/DocsLayout.vue +++ b/apps/www/.vitepress/theme/layout/DocsLayout.vue @@ -28,9 +28,9 @@ const sourceLink = 'https://github.com/radix-vue/shadcn-vue/tree/dev/' > {{ docsGroup.title }} - + {{ docsGroup.label }} - +
{{ frontmatter.title }} - + {{ frontmatter.label }} - +

{{ frontmatter.description }} diff --git a/apps/www/.vitepress/theme/style.css b/apps/www/.vitepress/theme/style.css index 8ff930c6..d8386c9f 100644 --- a/apps/www/.vitepress/theme/style.css +++ b/apps/www/.vitepress/theme/style.css @@ -28,6 +28,9 @@ --ring: 240 5% 64.9%; --radius: 0.5rem; + --vis-font-family: inherit !important; + --vis-area-stroke-width: 2px !important; + --vis-donut-central-label-text-color: hsl(var(--muted-foreground)) !important; --vis-tooltip-background-color: none !important; --vis-tooltip-border-color: none !important; --vis-tooltip-text-color: none !important; diff --git a/apps/www/src/lib/registry/default/ui/chart/ChartCrosshair.vue b/apps/www/src/lib/registry/default/ui/chart/ChartCrosshair.vue index 026d4f27..82ec3fdd 100644 --- a/apps/www/src/lib/registry/default/ui/chart/ChartCrosshair.vue +++ b/apps/www/src/lib/registry/default/ui/chart/ChartCrosshair.vue @@ -2,7 +2,7 @@ import { VisCrosshair, VisTooltip } from '@unovis/vue' import type { BulletLegendItemInterface } from '@unovis/ts' import { omit } from '@unovis/ts' -import { createApp } from 'vue' +import { createApp, watch } from 'vue' import { ChartTooltip } from '@/lib/registry/default/ui/chart' const props = withDefaults(defineProps<{ @@ -15,7 +15,7 @@ const props = withDefaults(defineProps<{ // Use weakmap to store reference to each datapoint for Tooltip const wm = new WeakMap() -function template(d: any, ...a: any) { +function template(d: any) { if (wm.has(d)) { return wm.get(d) } diff --git a/apps/www/src/lib/registry/default/ui/chart/index.ts b/apps/www/src/lib/registry/default/ui/chart/index.ts index a71f604c..e336de57 100644 --- a/apps/www/src/lib/registry/default/ui/chart/index.ts +++ b/apps/www/src/lib/registry/default/ui/chart/index.ts @@ -3,6 +3,8 @@ export { default as ChartSingleTooltip } from './ChartSingleTooltip.vue' export { default as ChartLegend } from './ChartLegend.vue' export { default as ChartCrosshair } from './ChartCrosshair.vue' +const SECONDARY_COLOR = '153 48% 49%' + export function defaultColors(count: number = 3) { const quotient = Math.floor(count / 2) const remainder = count % 2 @@ -11,6 +13,6 @@ export function defaultColors(count: number = 3) { const secondaryCount = quotient return [ ...Array.from(Array(primaryCount).keys()).map(i => `hsl(var(--primary) / ${1 - (1 / primaryCount) * i})`), - ...Array.from(Array(secondaryCount).keys()).map(i => `hsl(var(--border) / ${1 - (1 / secondaryCount) * i})`), + ...Array.from(Array(secondaryCount).keys()).map(i => `hsl(${SECONDARY_COLOR} / ${1 - (1 / secondaryCount) * i})`), ] } diff --git a/apps/www/src/lib/registry/new-york/ui/chart-donut/DonutChart.vue b/apps/www/src/lib/registry/new-york/ui/chart-donut/DonutChart.vue index 24b0a1f3..62034837 100644 --- a/apps/www/src/lib/registry/new-york/ui/chart-donut/DonutChart.vue +++ b/apps/www/src/lib/registry/new-york/ui/chart-donut/DonutChart.vue @@ -100,6 +100,7 @@ const totalValue = computed(() => props.data.reduce((prev, curr) => { :events="{ [Donut.selectors.segment]: { click: (d: Data, ev: PointerEvent, i: number, elements: HTMLElement[]) => { + console.log(d, ev, i, elements) if (d?.data?.[index] === activeSegmentKey) { activeSegmentKey = undefined elements.forEach(el => el.style.opacity = '1') diff --git a/apps/www/src/lib/registry/new-york/ui/chart/ChartCrosshair.vue b/apps/www/src/lib/registry/new-york/ui/chart/ChartCrosshair.vue index 153df841..aa1c2668 100644 --- a/apps/www/src/lib/registry/new-york/ui/chart/ChartCrosshair.vue +++ b/apps/www/src/lib/registry/new-york/ui/chart/ChartCrosshair.vue @@ -2,7 +2,7 @@ import { VisCrosshair, VisTooltip } from '@unovis/vue' import type { BulletLegendItemInterface } from '@unovis/ts' import { omit } from '@unovis/ts' -import { createApp } from 'vue' +import { createApp, watch } from 'vue' import { ChartTooltip } from '@/lib/registry/new-york/ui/chart' const props = withDefaults(defineProps<{ @@ -15,7 +15,7 @@ const props = withDefaults(defineProps<{ // Use weakmap to store reference to each datapoint for Tooltip const wm = new WeakMap() -function template(d: any, ...a: any) { +function template(d: any) { if (wm.has(d)) { return wm.get(d) } @@ -34,5 +34,5 @@ function template(d: any, ...a: any) { diff --git a/apps/www/src/lib/registry/new-york/ui/chart/index.ts b/apps/www/src/lib/registry/new-york/ui/chart/index.ts index a71f604c..e336de57 100644 --- a/apps/www/src/lib/registry/new-york/ui/chart/index.ts +++ b/apps/www/src/lib/registry/new-york/ui/chart/index.ts @@ -3,6 +3,8 @@ export { default as ChartSingleTooltip } from './ChartSingleTooltip.vue' export { default as ChartLegend } from './ChartLegend.vue' export { default as ChartCrosshair } from './ChartCrosshair.vue' +const SECONDARY_COLOR = '153 48% 49%' + export function defaultColors(count: number = 3) { const quotient = Math.floor(count / 2) const remainder = count % 2 @@ -11,6 +13,6 @@ export function defaultColors(count: number = 3) { const secondaryCount = quotient return [ ...Array.from(Array(primaryCount).keys()).map(i => `hsl(var(--primary) / ${1 - (1 / primaryCount) * i})`), - ...Array.from(Array(secondaryCount).keys()).map(i => `hsl(var(--border) / ${1 - (1 / secondaryCount) * i})`), + ...Array.from(Array(secondaryCount).keys()).map(i => `hsl(${SECONDARY_COLOR} / ${1 - (1 / secondaryCount) * i})`), ] }