You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2025/11/07 06:41:00 UTC
(echarts-theme-builder) 17/28: feat: update build src
This is an automated email from the ASF dual-hosted git repository.
ovilia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-theme-builder.git
commit 38e8264df5f14ac17dbd6b12c6bd8d9a930bce8d
Author: Ovilia <zw...@gmail.com>
AuthorDate: Tue Sep 16 14:58:39 2025 +0800
feat: update build src
---
src/App.vue | 35 ++++++++++++++++++-----------------
src/assets/vue.svg | 1 -
src/components/ChartPreviewPanel.vue | 3 +--
src/components/ColorList.vue | 4 ----
src/components/ColorPicker.vue | 4 ----
src/composables/useLocalization.ts | 6 ++++++
src/i18n.ts | 6 ++++++
src/main.ts | 2 +-
8 files changed, 32 insertions(+), 29 deletions(-)
diff --git a/src/App.vue b/src/App.vue
index 1c3d598..2e38523 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -3,15 +3,16 @@ import { ref } from 'vue'
// Simple fixed sidebar layout without responsive design
import ChartPreviewPanel from './components/ChartPreviewPanel.vue'
import ThemePanel from './components/ThemePanel.vue'
-import { useI18n } from 'vue-i18n'
import { useLocalization } from './composables/useLocalization'
-
-// Initialize i18n
-const { t } = useI18n()
+import { RadioGroup as VanRadioGroup, Radio as VanRadio, Row as VanRow, Col as VanCol } from 'vant'
// Set up language control
-const { switchLanguage, currentLanguage } = useLocalization()
+const { switchLanguage, currentLanguage, getAvailableLanguages } = useLocalization()
const currentLang = ref(currentLanguage)
+const availableLocales = getAvailableLanguages()
+// Only show language selector in dev/preview mode
+const showLanguageSelector = availableLocales.length > 0
+
const onLanguageChange = (lang: string) => {
switchLanguage(lang)
}
@@ -22,24 +23,24 @@ const chartPreviewRef = ref<InstanceType<typeof ChartPreviewPanel> | null>(null)
<template>
<div id="theme-builder">
- <!-- Language Selector -->
- <div class="language-selector">
- <van-radio-group v-model="currentLang" direction="horizontal" @change="onLanguageChange">
- <van-radio name="en">English</van-radio>
- <van-radio name="zh">中文</van-radio>
- </van-radio-group>
+ <!-- Language Selector - only shown in dev/preview mode -->
+ <div v-if="showLanguageSelector" class="language-selector">
+ <VanRadioGroup v-model="currentLang" direction="horizontal" @change="onLanguageChange">
+ <VanRadio name="en">English</VanRadio>
+ <VanRadio name="zh">中文</VanRadio>
+ </VanRadioGroup>
</div>
<div class="container-fluid" id="content">
- <van-row class="row-container" :gutter="0">
- <van-col span="6" class="theme-config">
+ <VanRow class="row-container" :gutter="0">
+ <VanCol span="6" class="theme-config">
<ThemePanel :chart-preview-ref="chartPreviewRef" />
- </van-col>
+ </VanCol>
- <van-col span="18" class="chart-container">
+ <VanCol span="18" class="chart-container">
<ChartPreviewPanel ref="chartPreviewRef" />
- </van-col>
- </van-row>
+ </VanCol>
+ </VanRow>
</div>
</div>
</template>
diff --git a/src/assets/vue.svg b/src/assets/vue.svg
deleted file mode 100644
index 770e9d3..0000000
--- a/src/assets/vue.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
\ No newline at end of file
diff --git a/src/components/ChartPreviewPanel.vue b/src/components/ChartPreviewPanel.vue
index 3a43f71..839e29a 100644
--- a/src/components/ChartPreviewPanel.vue
+++ b/src/components/ChartPreviewPanel.vue
@@ -24,11 +24,10 @@ import { ref, onMounted, onUnmounted, nextTick, watch, computed } from 'vue'
import * as echarts from 'echarts'
import { getChartConfigs } from '../utils/chartConfigs'
import { useThemeStore } from '../stores/theme'
-import { useI18n } from 'vue-i18n'
import type { ECharts } from 'echarts'
// Initialize i18n
-const { t } = useI18n()
+// const { t } = useI18n() // Not currently being used
const themeStore = useThemeStore()
const chartInstances = ref<ECharts[]>([])
diff --git a/src/components/ColorList.vue b/src/components/ColorList.vue
index 71f384f..6ffb2d6 100644
--- a/src/components/ColorList.vue
+++ b/src/components/ColorList.vue
@@ -59,10 +59,6 @@
import { defineProps, defineEmits } from 'vue'
import { ColorPicker } from 'vue3-colorpicker'
import 'vue3-colorpicker/style.css'
-import { useI18n } from 'vue-i18n'
-
-// Initialize i18n
-const { t } = useI18n()
interface Props {
modelValue: string[]
diff --git a/src/components/ColorPicker.vue b/src/components/ColorPicker.vue
index 24ef87d..d79e58d 100644
--- a/src/components/ColorPicker.vue
+++ b/src/components/ColorPicker.vue
@@ -26,10 +26,6 @@
import { defineProps, defineEmits } from 'vue'
import { ColorPicker } from 'vue3-colorpicker'
import 'vue3-colorpicker/style.css'
-import { useI18n } from 'vue-i18n'
-
-// Initialize i18n
-const { t } = useI18n()
interface Props {
modelValue: string
diff --git a/src/composables/useLocalization.ts b/src/composables/useLocalization.ts
index 106834b..8f55899 100644
--- a/src/composables/useLocalization.ts
+++ b/src/composables/useLocalization.ts
@@ -26,6 +26,11 @@ export function useLocalization() {
*/
const availableLanguages = getAvailableLocales()
+ /**
+ * Get available languages list function
+ */
+ const getAvailableLanguages = () => getAvailableLocales()
+
/**
* Check if current language matches specified language
* @param lang Language code
@@ -62,6 +67,7 @@ export function useLocalization() {
switchLanguage,
currentLanguage,
availableLanguages,
+ getAvailableLanguages,
isLanguage,
formatDate,
formatNumber
diff --git a/src/i18n.ts b/src/i18n.ts
index bfcad36..f7d0ff8 100644
--- a/src/i18n.ts
+++ b/src/i18n.ts
@@ -41,6 +41,12 @@ export const getCurrentLocale = () => {
// Get available languages list
export const getAvailableLocales = () => {
+ // 在 release 模式下不显示语言切换选项
+ if (import.meta.env.VITE_MODE === 'release') {
+ return []
+ }
+
+ // 在开发/预览模式下显示语言切换选项
return [
{ code: 'en', name: 'English' },
{ code: 'zh', name: '中文' }
diff --git a/src/main.ts b/src/main.ts
index 075f4ac..86df650 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -28,4 +28,4 @@ app.use(Icon)
app.use(Checkbox)
app.use(RadioGroup)
app.use(Radio)
-app.mount('#app')
+app.mount('#theme-builder')
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org