${code}`;
16 | } catch (__) { }
17 | }
18 | return ''; // use external default escaping
19 | },
20 | });
21 |
--------------------------------------------------------------------------------
/unocss.ts:
--------------------------------------------------------------------------------
1 | import { VitePluginConfig } from '@unocss/vite';
2 | import presetUno from '@unocss/preset-uno'
3 | import presetAttributify from '@unocss/preset-attributify';
4 |
5 | export default {
6 | rules: [
7 | // ### font ###
8 | [/^fs-?(\d+)(\w+)?$/, ([, d, w]) => ({ 'font-size': w ? `${d}${w}` : `${+d / 16}em` })],
9 | ],
10 | shortcuts: [
11 | {
12 | 'hv-center': 'flex items-center justify-center',
13 | 'omb-hover': 'cursor-pointer select-none',
14 | }
15 | ],
16 | presets: [
17 | presetUno(),
18 | presetAttributify(),
19 | ],
20 | } as VitePluginConfig;
21 |
22 | // const fmtRules = (list: Array<[string, string]>) =>
23 | // list.map((i) => [new RegExp(`^${i[0]}-?(\d+)(\w+)?$`), ([, d, w]) => ({ [i[1]]: w ? `${d}${w}` : `${+d / 4}rem` })]);
24 |
--------------------------------------------------------------------------------
/src-tauri/src/main.rs:
--------------------------------------------------------------------------------
1 | #![cfg_attr(
2 | all(not(debug_assertions), target_os = "windows"),
3 | windows_subsystem = "windows"
4 | )]
5 |
6 | mod omb;
7 |
8 | fn main() {
9 | let context = tauri::generate_context!();
10 | let app = tauri::Builder::default()
11 | .setup(omb::setup::init)
12 | .plugin(omb::fs::FsExtra::default())
13 | .menu(tauri::Menu::os_default(&context.package_info().name))
14 | .system_tray(omb::tray::menu())
15 | .on_system_tray_event(omb::tray::handler)
16 | .build(context)
17 | .expect("error while running OhMyBox application");
18 |
19 | app.run(|_app_handle, event| match event {
20 | tauri::RunEvent::Updater(updater_event) => {
21 | dbg!(updater_event);
22 | }
23 | _ => {}
24 | })
25 | }
26 |
--------------------------------------------------------------------------------
/src/components/SwitchLang/index.tsx:
--------------------------------------------------------------------------------
1 | import { Icon } from '@iconify/react/dist/offline';
2 | import langIcon from '@iconify-icons/fa/language';
3 |
4 | import { useGetLang, useSetLang } from '@/hooks/useLang';
5 |
6 | export default function DashboardView() {
7 | const lang = useGetLang();
8 | const setLang = useSetLang();
9 |
10 | const handleChange: React.ChangeEventHandler
62 |
63 | ## License
64 |
65 | GPL-3.0 license © 2022 lencx
66 |
--------------------------------------------------------------------------------
/src/components/Slider/index.tsx:
--------------------------------------------------------------------------------
1 | import { useRef, useEffect } from 'react';
2 | import Slider from 'rc-slider';
3 | import raf from 'rc-util/lib/raf';
4 | import Tooltip from 'rc-tooltip';
5 | import type { SliderProps } from 'rc-slider';
6 |
7 | import './index.scss';
8 |
9 | interface HandleTooltipProps {
10 | value: number;
11 | children: React.ReactElement;
12 | visible: boolean;
13 | tipFormatter?: (value: number) => React.ReactNode;
14 | }
15 |
16 | const HandleTooltip: React.FC