This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-theme-builder.git


The following commit(s) were added to refs/heads/master by this push:
     new 50ceb4b  tweak
50ceb4b is described below

commit 50ceb4bbc47760ed22577bf0302c3a46c60e892a
Author: plainheart <[email protected]>
AuthorDate: Mon Nov 10 13:08:58 2025 +0800

    tweak
---
 .vscode/settings.json         |  5 +++--
 index.html                    |  6 +-----
 src/App.vue                   |  2 +-
 src/components/ThemePanel.vue |  5 ++++-
 src/utils/chartConfigs.ts     | 11 -----------
 src/utils/download.ts         | 22 ----------------------
 src/vite-env.d.ts             | 10 ++++++++++
 vite.config.ts                |  4 +++-
 8 files changed, 22 insertions(+), 43 deletions(-)

diff --git a/.vscode/settings.json b/.vscode/settings.json
index 4e71344..85ea00b 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,5 +1,6 @@
 {
     "i18n-ally.localesPaths": [
         "src/locales"
-    ]
-}
\ No newline at end of file
+    ],
+    "typescript.tsdk": "node_modules\\typescript\\lib"
+}
diff --git a/index.html b/index.html
index a633b9c..3bef0bc 100644
--- a/index.html
+++ b/index.html
@@ -6,7 +6,7 @@
     <link rel="shortcut icon" 
href="https://echarts.apache.org/en/images/favicon.png";>
     <title>Apache ECharts Theme Builder</title>
     <style>
-      /* only for dev environment */
+      /* only for non-release environment */
       html, body {
         height: 100%;
         margin: 0;
@@ -14,10 +14,6 @@
     </style>
     <!-- include echarts CDN lib if NOT IN dev environment -->
     %VITE_EXTERNAL_ECHARTS_SCRIPT%
-    <script>
-      // show language selector in dev/preview environment
-      window.SHOW_LANGUAGE_SELECTOR = true;
-    </script>
   </head>
   <body>
     <div id="theme-builder-app"></div>
diff --git a/src/App.vue b/src/App.vue
index 5e28642..4e4ab91 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -11,7 +11,7 @@ const { switchLanguage, currentLanguage, availableLanguages } 
= useLocalization(
 const currentLang = ref(currentLanguage)
 // Only show language selector in dev/preview mode
 // Use import.meta.env.DEV to only show in development mode
-const showLanguageSelector = import.meta.env.DEV || (window as 
any).SHOW_LANGUAGE_SELECTOR
+const showLanguageSelector = import.meta.env.VITE_SHOW_LANGUAGE_SELECTOR
 
 const onLanguageChange = (lang: string) => {
   switchLanguage(lang)
diff --git a/src/components/ThemePanel.vue b/src/components/ThemePanel.vue
index d69c55e..5302996 100644
--- a/src/components/ThemePanel.vue
+++ b/src/components/ThemePanel.vue
@@ -700,7 +700,10 @@ const downloadTheme = async () => {
       // User chose JavaScript
       downloadJsFile(jsContent, filename)
       showUsageInstructions('js', filename)
-    } catch {
+    } catch (e) {
+      if (e !== 'cancel') {
+        throw e
+      }
       // User chose JSON (clicked cancel button)
       downloadJsonFile(themeConfig, filename)
       showUsageInstructions('json', filename)
diff --git a/src/utils/chartConfigs.ts b/src/utils/chartConfigs.ts
index 43c8dd2..e0e211a 100644
--- a/src/utils/chartConfigs.ts
+++ b/src/utils/chartConfigs.ts
@@ -557,14 +557,3 @@ export function getChartConfigs(seriesCnt: number = 4): 
ChartConfig[] {
 
   return configs
 }
-
-// Get specific chart by type
-export function getChartByType(type: string, seriesCnt: number = 4): 
ChartConfig | undefined {
-  const configs = getChartConfigs(seriesCnt)
-  return configs.find(config => config.type === type)
-}
-
-// Get all available chart types
-export function getAvailableChartTypes(): string[] {
-  return ['line', 'area', 'bar', 'stackedBar', 'scatter', 'pie', 'radar', 
'candlestick', 'heatmap', 'treemap', 'graph', 'timeline']
-}
diff --git a/src/utils/download.ts b/src/utils/download.ts
index d84937a..344a900 100644
--- a/src/utils/download.ts
+++ b/src/utils/download.ts
@@ -10,21 +10,6 @@ function isSafari(): boolean {
          navigator.userAgent.indexOf('Chrome') < 0
 }
 
-/**
- * Check if the browser is Internet Explorer
- */
-function isIE(): boolean {
-  return navigator.userAgent.indexOf('MSIE') > 0 ||
-         navigator.userAgent.indexOf('Trident') > 0
-}
-
-/**
- * Check if the browser is Edge (legacy)
- */
-function isEdge(): boolean {
-  return navigator.userAgent.indexOf('Edge') > 0
-}
-
 /**
  * Save a file with the given content and filename
  * @param data - File content
@@ -74,13 +59,6 @@ export function downloadJsFile(content: string, filename: 
string): void {
   saveFile(content, `${filename}.js`, 'application/javascript')
 }
 
-/**
- * Check if the browser supports downloads
- */
-export function isDownloadSupported(): boolean {
-  return !isIE() && !isEdge()
-}
-
 /**
  * Copy text to clipboard
  * @param text - Text to copy
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
index 11f02fe..6e0b787 100644
--- a/src/vite-env.d.ts
+++ b/src/vite-env.d.ts
@@ -1 +1,11 @@
 /// <reference types="vite/client" />
+
+interface ImportMetaEnv {
+  readonly VITE_SHOW_LANGUAGE_SELECTOR?: boolean;
+  readonly VITE_APP_ASSETS_DIR: string;
+  readonly VITE_EXTERNAL_ECHARTS_SCRIPT?: string;
+}
+
+interface ImportMeta {
+  readonly env: ImportMetaEnv
+}
diff --git a/vite.config.ts b/vite.config.ts
index 334c2cc..7c6aa7d 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
 import { viteStaticCopy } from 'vite-plugin-static-copy'
 
 export default defineConfig((env) => {
+  const isDev = env.mode === 'development'
   const isBuildForApp = env.mode === 'app'
   const publicDir = 'public'
   const assetsDir = isBuildForApp ? './theme-builder/' : './'
@@ -67,7 +68,8 @@ export default defineConfig((env) => {
       }
     },
     define: {
-      'import.meta.env.VITE_EXTERNAL_ECHARTS_SCRIPT': isBuildForApp
+      'import.meta.env.VITE_SHOW_LANGUAGE_SELECTOR': true,
+      'import.meta.env.VITE_EXTERNAL_ECHARTS_SCRIPT': isDev || isBuildForApp
         ? `""`
         : `"<script 
src=\\"https://echarts.apache.org/en/js/vendors/echarts/dist/echarts.min.js\\";></script>"`,
       'import.meta.env.VITE_APP_ASSETS_DIR': JSON.stringify(assetsDir)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to