feat: Migrate more to VueV3 logic, navbar improvements

This commit is contained in:
2026-07-11 22:33:24 +03:00
parent 8b43a8438d
commit 2060a76e0f
24 changed files with 1246 additions and 2977 deletions

43
src/lib/useYaml.js Normal file
View File

@@ -0,0 +1,43 @@
import { ref } from 'vue';
import { loadYaml } from './yaml.js';
/**
* Vue composable for YAML data loading
* Provides reactive YAML data loading
*/
export function useYaml() {
/**
* Load YAML data reactively
* @param {string} path - Path to the YAML file
* @param {any} fallback - Fallback value if loading fails
* @returns {import('vue').Ref<any>} Reactive reference to the loaded data
*/
const loadYamlComposable = (path, fallback) => {
const data = ref(fallback);
const loading = ref(true);
const error = ref(null);
loadYaml(path, fallback)
.then((result) => {
data.value = result;
loading.value = false;
})
.catch((err) => {
error.value = err;
data.value = fallback;
loading.value = false;
});
return {
data,
loading,
error
};
};
return {
loadYamlComposable,
// Original function for backwards compatibility
loadYaml
};
}