refactor: remove vitepress dependency and rename project

This commit is contained in:
kerms 2026-01-23 14:52:47 +01:00
parent 599ae714ab
commit a51958648a
3 changed files with 16 additions and 14 deletions

View File

@ -1,6 +1,6 @@
# Yunsi Toolbox # Yunsi Toolbox Vue
A collection of web-based tools for hardware development and debugging. A collection of web-based tools.
## Components ## Components
@ -9,7 +9,7 @@ A browser-based firmware flasher for ESP32 microcontrollers using Web Serial.
## Installation ## Installation
This is intended to be used as a git submodule in Vue 3 projects (specifically optimized for VitePress). This is intended to be used as a git submodule in Vue 3 projects.
```bash ```bash
git submodule add <repository-url> src/components/yunsi-toolbox git submodule add <repository-url> src/components/yunsi-toolbox

View File

@ -17,16 +17,10 @@ import 'xterm/css/xterm.css';
import {onBeforeMount, onMounted, reactive, ref, watch} from "vue"; import {onBeforeMount, onMounted, reactive, ref, watch} from "vue";
import {ESPLoader, type FlashOptions, type IEspLoaderTerminal, type LoaderOptions, Transport} from "./lib_esptools-js"; import {ESPLoader, type FlashOptions, type IEspLoaderTerminal, type LoaderOptions, Transport} from "./lib_esptools-js";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import {useData} from 'vitepress';
const terminalContainer = ref(); const terminalContainer = ref();
let terminal: any; let terminal: any;
let fitAddon: any; let fitAddon: any;
const isDarkMode = useData().isDark;
watch(isDarkMode, value => {
});
const terminalConfig = { const terminalConfig = {
theme: { theme: {
@ -99,8 +93,13 @@ type ImageOption = {
const props = defineProps<{ const props = defineProps<{
imageOptions: ImageOption[]; imageOptions: ImageOption[];
isDark?: boolean;
}>(); }>();
watch(() => props.isDark, (value) => {
// Handle dark mode change if needed for xterm
});
const imageSelect = ref(props.imageOptions[0]); const imageSelect = ref(props.imageOptions[0]);
let transport: Transport | null; let transport: Transport | null;

View File

@ -7,7 +7,7 @@ A Vue 3 component for flashing ESP32 series microcontrollers directly from the b
- Supports ESP32, ESP32-C3, ESP32-S3, and more. - Supports ESP32, ESP32-C3, ESP32-S3, and more.
- Built-in Xterm.js terminal for progress and logging. - Built-in Xterm.js terminal for progress and logging.
- Support for multiple firmware image options. - Support for multiple firmware image options.
- Dark mode support (compatible with VitePress). - Dark mode support via prop.
## Usage ## Usage
@ -16,6 +16,7 @@ A Vue 3 component for flashing ESP32 series microcontrollers directly from the b
| Prop | Type | Description | | Prop | Type | Description |
| :--- | :--- | :--- | | :--- | :--- | :--- |
| `imageOptions` | `ImageOption[]` | An array of firmware images available for flashing. | | `imageOptions` | `ImageOption[]` | An array of firmware images available for flashing. |
| `isDark` | `boolean` | (Optional) Toggle dark mode for the terminal. |
#### ImageOption Object #### ImageOption Object
@ -32,6 +33,9 @@ type ImageOption = {
```vue ```vue
<script setup lang="ts"> <script setup lang="ts">
import EspFlasher from './path/to/yunsi-toolbox/esp-flasher/EspFlasher.vue'; import EspFlasher from './path/to/yunsi-toolbox/esp-flasher/EspFlasher.vue';
import { ref } from 'vue';
const isDark = ref(false);
const imageOptions = [ const imageOptions = [
{ {
@ -48,7 +52,7 @@ const imageOptions = [
</script> </script>
<template> <template>
<EspFlasher :imageOptions="imageOptions" /> <EspFlasher :imageOptions="imageOptions" :isDark="isDark" />
</template> </template>
``` ```
@ -58,7 +62,6 @@ const imageOptions = [
- `xterm` - `xterm`
- `xterm-addon-fit` - `xterm-addon-fit`
- `crypto-js` - `crypto-js`
- `vitepress` (for `useData` dark mode toggle)
## Credits ## Credits